diff --git a/src/net/lookup.go b/src/net/lookup.go index 969c902b1d4..5d7cd4c14ff 100644 --- a/src/net/lookup.go +++ b/src/net/lookup.go @@ -255,9 +255,11 @@ func (r *Resolver) LookupNetIP(ctx context.Context, network, host string) ([]net } ret := make([]netip.Addr, 0, len(ips)) for _, ip := range ips { - if a, ok := netip.AddrFromSlice(ip); ok { - ret = append(ret, a) + a, err := netip.ParseAddr(ip.String()) + if err != nil { + continue } + ret = append(ret, a) } return ret, nil } diff --git a/src/net/netip/netip.go b/src/net/netip/netip.go index 99f9c279426..2d7c8384993 100644 --- a/src/net/netip/netip.go +++ b/src/net/netip/netip.go @@ -354,9 +354,7 @@ func AddrFromSlice(slice []byte) (ip Addr, ok bool) { case 4: return AddrFrom4(*(*[4]byte)(slice)), true case 16: - ipAddr := ipv6Slice(slice) - unwrapAddr := ipAddr.Unmap() - return unwrapAddr, true + return ipv6Slice(slice), true } return Addr{}, false }