简化IP名单中创建IP操作/支持IP以CIDR方式显示

This commit is contained in:
GoEdgeLab
2024-04-13 16:45:56 +08:00
parent 58e508c8e3
commit 7e4a5ecff7
11 changed files with 544 additions and 411 deletions
+4
View File
@@ -54,6 +54,10 @@ func IsIPv6(ipString string) bool {
return rawIP != nil && rawIP.To4() == nil && rawIP.To16() != nil
}
func IsSameVersion(ip1 string, ip2 string) bool {
return IsIPv4(ip1) == IsIPv4(ip2)
}
func IsValid(ipString string) bool {
return net.ParseIP(ipString) != nil
}