1
0
mirror of https://github.com/golang/go synced 2024-11-25 09:07:58 -07:00

need to unmap the Addr in AddrFromSlice due to that there may be an IPv4-mapped IPv6 address

This commit is contained in:
zhlsunshine 2022-10-25 15:10:28 +08:00
parent 55eaae452c
commit 6186106b99

View File

@ -354,7 +354,9 @@ func AddrFromSlice(slice []byte) (ip Addr, ok bool) {
case 4:
return AddrFrom4(*(*[4]byte)(slice)), true
case 16:
return ipv6Slice(slice), true
ipAddr := ipv6Slice(slice)
unwrapAddr := ipAddr.Unmap()
return unwrapAddr, true
}
return Addr{}, false
}