block local ips and service worker; util function to resolve arbitrary 'host-like' string, unit testing
This commit is contained in:
parent
cd4b160b4d
commit
48e5d7b3a2
@ -251,7 +251,7 @@ func (e *PwExtractor) allowHost(rawUrl string) (bool, error) {
|
|||||||
deny := ip.IsPrivate() || ip.IsLoopback() || ip.IsUnspecified() || ip.IsLinkLocalUnicast() || ip.IsMulticast()
|
deny := ip.IsPrivate() || ip.IsLoopback() || ip.IsUnspecified() || ip.IsLinkLocalUnicast() || ip.IsMulticast()
|
||||||
deny = deny || e.proxyIP.Equal(ip)
|
deny = deny || e.proxyIP.Equal(ip)
|
||||||
if deny {
|
if deny {
|
||||||
log.Debugf("Banned address: %s", rawUrl)
|
log.Warnf("Banned address: %s", rawUrl)
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user