diff --git a/1.7/client/network.go b/1.7/client/network.go new file mode 100644 index 0000000..e9a41fb --- /dev/null +++ b/1.7/client/network.go @@ -0,0 +1,15 @@ +package utils + +import "net" + +func IPv6(ip string) bool { + return net.ParseIP(ip) != nil && net.ParseIP(ip).To4() == nil +} + +func DefaultSubnet(ip string) string { + if IPv6(ip) { + return "64" + } + return "24" +} +