Skip to content

Commit fee6dd0

Browse files
authored
Create network.go
1 parent e08bb4c commit fee6dd0

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

1.7/server/network.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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+
}

0 commit comments

Comments
 (0)