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:
parent
55eaae452c
commit
6186106b99
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user