增加协议屏蔽支持

This commit is contained in:
qaq
2025-08-17 21:05:29 +08:00
parent 79618585aa
commit a046365763
57 changed files with 8669 additions and 93 deletions
+18
View File
@@ -0,0 +1,18 @@
package builtins
import (
"net"
)
func MatchCIDR(ip string, cidr *net.IPNet) bool {
ipAddr := net.ParseIP(ip)
if ipAddr == nil {
return false
}
return cidr.Contains(ipAddr)
}
func CompileCIDR(cidr string) (*net.IPNet, error) {
_, ipNet, err := net.ParseCIDR(cidr)
return ipNet, err
}