add options for ECS full subnet mask in server & TLS verification bypass in client (#92)

* add ECS full size & limit filtering

* add tls certification bypass in configuration

* flush log lines

* changes following pull request comments

* with fmt and reorg of libs in client.go
This commit is contained in:
Alex Chauvin
2020-11-24 13:35:23 +01:00
committed by GitHub
parent 2aa7370aaf
commit 967faec56c
8 changed files with 64 additions and 20 deletions
+6 -1
View File
@@ -265,17 +265,22 @@ func (s *Server) findClientIP(r *http.Request) net.IP {
if XRealIP != "" {
addr := strings.TrimSpace(XRealIP)
ip := net.ParseIP(addr)
if jsondns.IsGlobalIP(ip) {
if !s.conf.LocalIPFilter || jsondns.IsGlobalIP(ip) {
return ip
}
}
remoteAddr, err := net.ResolveTCPAddr("tcp", r.RemoteAddr)
if err != nil {
return nil
}
if !s.conf.LocalIPFilter {
return remoteAddr.IP
}
if ip := remoteAddr.IP; jsondns.IsGlobalIP(ip) {
return ip
}
return nil
}