feat: add Internet-Only captcha rule (#3919)

This commit is contained in:
Robin Ye
2025-07-03 02:39:06 +08:00
committed by GitHub
parent 3ccc0339c7
commit bf91ad6c97
34 changed files with 122 additions and 35 deletions

View File

@ -185,17 +185,3 @@ func removePort(s string) string {
}
return ipStr
}
func isHostIntranet(s string) bool {
ipStr, _, err := net.SplitHostPort(s)
if err != nil {
ipStr = s
}
ip := net.ParseIP(ipStr)
if ip == nil {
return false
}
return ip.IsPrivate() || ip.IsLoopback() || ip.IsLinkLocalUnicast() || ip.IsLinkLocalMulticast()
}