mirror of
https://github.com/golang/net.git
synced 2026-03-31 18:37:08 +09:00
x/net/internal/nettest: make routableIP not return the ipv6 loopback address
On some platform the IPv6 loopback address is not suitable to assign a name. LGTM=iant R=iant CC=golang-codereviews https://golang.org/cl/165710043
This commit is contained in:
@@ -76,6 +76,9 @@ func routableIP(network string, ip net.IP) net.IP {
|
||||
return ip
|
||||
}
|
||||
case "ip6":
|
||||
if ip.IsLoopback() { // addressing scope of the loopback address depends on each implementation
|
||||
return nil
|
||||
}
|
||||
if ip := ip.To16(); ip != nil && ip.To4() == nil {
|
||||
return ip
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user