Skip to content

Commit 32ef0f5

Browse files
committed
disco: func IsCGN supports ipv6
1 parent fdb6698 commit 32ef0f5

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

disco/local_addr.go

+3
Original file line numberDiff line numberDiff line change
@@ -127,5 +127,8 @@ func ListLocalIPs() ([]net.IP, error) {
127127
var carrierGradeNAT = netip.MustParsePrefix("100.64.0.0/10")
128128

129129
func IsCGN(ip net.IP) bool {
130+
if ip.To4() == nil {
131+
return false
132+
}
130133
return carrierGradeNAT.Contains(netip.AddrFrom4([4]byte(ip.To4())))
131134
}

0 commit comments

Comments
 (0)