mirror of
https://github.com/golang/go
synced 2024-11-22 05:04:40 -07:00
net/netip: clarify Addr.Is4In6 documentation
For #65635 Change-Id: I4e4b0309d9139f970d6fd6b41303dfd2e0ec6236 Reviewed-on: https://go-review.googlesource.com/c/go/+/617835 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
This commit is contained in:
parent
fe87349002
commit
b3312065ce
@ -462,7 +462,9 @@ func (ip Addr) Is4() bool {
|
||||
return ip.z == z4
|
||||
}
|
||||
|
||||
// Is4In6 reports whether ip is an IPv4-mapped IPv6 address.
|
||||
// Is4In6 reports whether ip is an "IPv4-mapped IPv6 address"
|
||||
// as defined by RFC 4291.
|
||||
// That is, it reports whether ip is in ::ffff:0:0/96.
|
||||
func (ip Addr) Is4In6() bool {
|
||||
return ip.Is6() && ip.addr.hi == 0 && ip.addr.lo>>32 == 0xffff
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user