Skip to content

Commit 6817deb

Browse files
committed
fix loopback
1 parent f130dc9 commit 6817deb

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

client.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -729,16 +729,19 @@ func isPrivateIP(config Config, addr multiaddr.Multiaddr) bool {
729729
// IPv6
730730
{IP: net.ParseIP("fc00::"), Mask: net.CIDRMask(7, 128)}, // Unique local address
731731
{IP: net.ParseIP("fe80::"), Mask: net.CIDRMask(10, 128)}, // Link-local unicast
732-
{IP: net.IPv6loopback, Mask: net.CIDRMask(128, 128)}, // Loopback }
733732
}
734-
735-
// Check if the IP falls into any of the private ranges
733+
734+
// Check if the IP falls into any of the private ranges or is loopback (::1)
736735
for _, r := range privateRanges {
737736
if r.Contains(ip) {
738737
config.Logger.Infof("Found private IP: %s", ip)
739738
return true
740739
}
741740
}
741+
if ip.Equal(net.IPv6loopback) { // ::1
742+
config.Logger.Infof("Found IPv6 loopback: %s", ip)
743+
return true
744+
}
742745
return false
743746
}
744747

0 commit comments

Comments
 (0)