no message

This commit is contained in:
arraykeys
2018-06-25 20:43:35 +08:00
parent 7101530b22
commit 16f1d80588
4 changed files with 7 additions and 4 deletions

View File

@ -1,6 +1,7 @@
proxy更新日志
v5.1
1.优化了kcp默认mtu配置,调整为450.
2.优化了HTTP(S)\SOCKS5代理智能判断更加精确。
v5.0
1.修复了SPS多端口无效的bug.

View File

@ -278,7 +278,7 @@ func (s *HTTP) callback(inConn net.Conn) {
useProxy = true
} else {
k := s.Resolve(address)
s.checker.Add(k)
s.checker.Add(address, k)
//var n, m uint
useProxy, _, _ = s.checker.IsBlocked(k)
//s.log.Printf("blocked ? : %v, %s , fail:%d ,success:%d", useProxy, address, n, m)

View File

@ -563,7 +563,7 @@ func (s *Socks) proxyTCP(inConn *net.Conn, methodReq socks.MethodsRequest, reque
useProxy = false
} else {
k := s.Resolve(request.Addr())
s.checker.Add(k)
s.checker.Add(request.Addr(), k)
useProxy, _, _ = s.checker.IsBlocked(k)
}
if useProxy {

View File

@ -41,6 +41,7 @@ type CheckerItem struct {
Data []byte
SuccessCount uint
FailCount uint
Key string
}
//NewChecker args:
@ -173,13 +174,14 @@ func (c *Checker) domainIsInMap(address string, blockedMap bool) bool {
}
return false
}
func (c *Checker) Add(address string) {
if c.domainIsInMap(address, false) || c.domainIsInMap(address, true) {
func (c *Checker) Add(key, address string) {
if c.domainIsInMap(key, false) || c.domainIsInMap(key, true) {
return
}
var item CheckerItem
item = CheckerItem{
Host: address,
Key: key,
}
c.data.SetIfAbsent(item.Host, item)
}