Closed
Description
We already have net.IPv6loopback
today, but lack an equivalent in net/netip
. I'd like to propose adding netip.IPv6Loopback
specifically; IPv6 defines exactly one loopback address: ::1
.
IPv4 assigns the entire 127.0.0.0/8
and thus should be out of scope for this proposal.
Concretely:
// IPv6Loopback returns the IPv6 loopback address ::1.
func IPv6Loopback() Addr { return AddrFrom16([16]byte{15: 0x01}) }
See also #51766 for a similar addition and rationale. Thanks!