Skip to content

Commit 4f9195c

Browse files
authored
Create network.go
1 parent 7e0750b commit 4f9195c

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

1.7/client/network.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package utils
2+
3+
import "net"
4+
5+
func IPv6(ip string) bool {
6+
return net.ParseIP(ip) != nil && net.ParseIP(ip).To4() == nil
7+
}
8+
9+
func DefaultSubnet(ip string) string {
10+
if IPv6(ip) {
11+
return "64"
12+
}
13+
return "24"
14+
}
15+

0 commit comments

Comments
 (0)