mirror of
https://github.com/m13253/dns-over-https.git
synced 2026-05-25 20:44:17 +00:00
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:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user