block local ips and service worker; util function to resolve arbitrary 'host-like' string, unit testing

This commit is contained in:
Egor Aristov 2025-02-19 12:41:08 +03:00
parent 08326debdd
commit 220bc50e47
Signed by: egor3f
GPG Key ID: 40482A264AAEC85F

View File

@ -251,7 +251,7 @@ func (e *PwExtractor) allowHost(rawUrl string) (bool, error) {
deny := ip.IsPrivate() || ip.IsLoopback() || ip.IsUnspecified() || ip.IsLinkLocalUnicast() || ip.IsMulticast()
deny = deny || e.proxyIP.Equal(ip)
if deny {
log.Debugf("Banned address: %s", rawUrl)
log.Warnf("Banned address: %s", rawUrl)
return false, nil
}
}