From b3312065ce68465639c796b36a3671ac031223fb Mon Sep 17 00:00:00 2001 From: Damien Neil Date: Thu, 3 Oct 2024 10:00:20 -0700 Subject: [PATCH] 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 --- src/net/netip/netip.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 } -- 2.48.1