From: Damien Neil Date: Thu, 3 Oct 2024 17:00:20 +0000 (-0700) Subject: net/netip: clarify Addr.Is4In6 documentation X-Git-Tag: go1.24rc1~757 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=b3312065ce68465639c796b36a3671ac031223fb;p=gostls13.git 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 Reviewed-by: Ian Lance Taylor --- diff --git a/src/net/netip/netip.go b/src/net/netip/netip.go index 4a8ebc6785..1ff87d2e1e 100644 --- a/src/net/netip/netip.go +++ b/src/net/netip/netip.go @@ -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 }