修改客户端分配的ip为CIDR格式,请注意原来network格式

This commit is contained in:
bjd
2021-02-04 13:32:10 +08:00
parent 1c6572f5e3
commit edb0fe2dc9
32 changed files with 155 additions and 139 deletions

View File

@@ -48,7 +48,7 @@ func tableLookup(ip net.IP) *Addr {
}
// 判断老化过期时间
tsub := time.Now().Sub(addr.disTime)
tsub := time.Since(addr.disTime)
switch addr.Type {
case TypeNormal:
if tsub > StaleTimeNormal {

View File

@@ -48,7 +48,7 @@ func doPing(ip string) error {
return err
}
conn.SetReadDeadline(time.Now().Add(time.Second * 2))
_ = conn.SetReadDeadline(time.Now().Add(time.Second * 2))
for {
buf := make([]byte, 512)

View File

@@ -198,8 +198,10 @@ func (p *Conn) checkPrefixOnce() {
func (p *Conn) checkPrefix() error {
if p.proxyHeaderTimeout != 0 {
readDeadLine := time.Now().Add(p.proxyHeaderTimeout)
p.conn.SetReadDeadline(readDeadLine)
defer p.conn.SetReadDeadline(time.Time{})
_ = p.conn.SetReadDeadline(readDeadLine)
defer func() {
_ = p.conn.SetReadDeadline(time.Time{})
}()
}
// Incrementally check each byte of the prefix