fix #84
fix #81 Signed-off-by: arraykeys@gmail.com <arraykeys@gmail.com>
This commit is contained in:
@ -1,4 +1,7 @@
|
|||||||
proxy更新日志
|
proxy更新日志
|
||||||
|
v4.9
|
||||||
|
1.修复了HTTP Basic代理返回不合适的头部,导致浏览器不会弹框,个别代理插件无法认证的问题.
|
||||||
|
|
||||||
v4.8
|
v4.8
|
||||||
1.优化了SPS连接HTTP上级的指令,避免了某些代理不响应的问题.
|
1.优化了SPS连接HTTP上级的指令,避免了某些代理不响应的问题.
|
||||||
2.SPS功能增加了参数:
|
2.SPS功能增加了参数:
|
||||||
|
|||||||
@ -229,7 +229,7 @@ func (s *HTTP) callback(inConn net.Conn) {
|
|||||||
address := req.Host
|
address := req.Host
|
||||||
host, _, _ := net.SplitHostPort(address)
|
host, _, _ := net.SplitHostPort(address)
|
||||||
useProxy := false
|
useProxy := false
|
||||||
if !utils.IsIternalIP(host) {
|
if !utils.IsIternalIP(host, *s.cfg.Always) {
|
||||||
useProxy = true
|
useProxy = true
|
||||||
if *s.cfg.Parent == "" {
|
if *s.cfg.Parent == "" {
|
||||||
useProxy = false
|
useProxy = false
|
||||||
|
|||||||
@ -519,7 +519,7 @@ func (s *Socks) proxyTCP(inConn *net.Conn, methodReq socks.MethodsRequest, reque
|
|||||||
if *s.cfg.Parent != "" {
|
if *s.cfg.Parent != "" {
|
||||||
host, _, _ := net.SplitHostPort(request.Addr())
|
host, _, _ := net.SplitHostPort(request.Addr())
|
||||||
useProxy := false
|
useProxy := false
|
||||||
if utils.IsIternalIP(host) {
|
if utils.IsIternalIP(host, *s.cfg.Always) {
|
||||||
useProxy = false
|
useProxy = false
|
||||||
} else {
|
} else {
|
||||||
k := s.Resolve(request.Addr())
|
k := s.Resolve(request.Addr())
|
||||||
|
|||||||
@ -579,9 +579,23 @@ func HttpGet(URL string, timeout int, host ...string) (body []byte, code int, er
|
|||||||
body, err = ioutil.ReadAll(resp.Body)
|
body, err = ioutil.ReadAll(resp.Body)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
func IsIternalIP(domainOrIP string) bool {
|
func IsIternalIP(domainOrIP string, always bool) bool {
|
||||||
var outIPs []net.IP
|
var outIPs []net.IP
|
||||||
outIPs, err := net.LookupIP(domainOrIP)
|
var err error
|
||||||
|
var isDomain bool
|
||||||
|
if net.ParseIP(domainOrIP) == nil {
|
||||||
|
isDomain = true
|
||||||
|
}
|
||||||
|
if always && isDomain {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
if isDomain {
|
||||||
|
outIPs, err = net.LookupIP(domainOrIP)
|
||||||
|
} else {
|
||||||
|
outIPs = []net.IP{net.ParseIP(domainOrIP)}
|
||||||
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user