]> Cypherpunks repositories - gostls13.git/commitdiff
net/netip: improve documentation terminology for IPv4-mapped IPv6 addresses
authorhopehook <hopehook.com@gmail.com>
Mon, 21 Mar 2022 08:18:00 +0000 (16:18 +0800)
committerEmmanuel Odeke <emmanuel@orijtech.com>
Sat, 2 Apr 2022 06:45:40 +0000 (06:45 +0000)
Updates #51834

Change-Id: I07a43457e2e328b51fea8131f7d6d5a4f1de4dc5
Reviewed-on: https://go-review.googlesource.com/c/go/+/394078
Trust: Damien Neil <dneil@google.com>
Run-TryBot: Damien Neil <dneil@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
src/net/netip/netip.go
src/net/netip/netip_test.go

index 893eeea7f0de624f86495f5628cca4194ce4247f..8fad25db8d352abba6ce1b338a3cfb41239f5fc0 100644 (file)
@@ -456,7 +456,7 @@ func (ip Addr) lessOrEq(ip2 Addr) bool { return ip.Compare(ip2) <= 0 }
 
 // Is4 reports whether ip is an IPv4 address.
 //
-// It returns false for IP4-mapped IPv6 addresses. See IP.Unmap.
+// It returns false for IPv4-mapped IPv6 addresses. See IP.Unmap.
 func (ip Addr) Is4() bool {
        return ip.z == z4
 }
@@ -675,7 +675,7 @@ const (
 )
 
 // As16 returns the IP address in its 16-byte representation.
-// IPv4 addresses are returned in their IPv4-mapped IPv6 form.
+// IPv4 addresses are returned as IPv4-mapped IPv6 addresses.
 // IPv6 addresses with zones are returned without their zone (use the
 // Zone method to get it).
 // The ip zero value returns all zeroes.
@@ -758,7 +758,7 @@ func (ip Addr) Prev() Addr {
 //   - IPv6 with zone ("fe80:db8::1%eth0")
 //
 // Note that unlike package net's IP.String method,
-// IP4-mapped IPv6 addresses format with a "::ffff:"
+// IPv4-mapped IPv6 addresses format with a "::ffff:"
 // prefix before the dotted quad.
 func (ip Addr) String() string {
        switch ip.z {
@@ -1380,7 +1380,7 @@ func (p Prefix) Contains(ip Addr) bool {
 //
 // If p and o are of different address families or either have a zero
 // IP, it reports false. Like the Contains method, a prefix with an
-// IPv4-mapped IPv6 IP is still treated as an IPv6 mask.
+// IPv4-mapped IPv6 address is still treated as an IPv6 mask.
 func (p Prefix) Overlaps(o Prefix) bool {
        if !p.IsValid() || !o.IsValid() {
                return false
index c2811c47030638d2e1cff42b81c9e8b5b9ea9637..35f7cd69e11df01a6ecf0cbed38264f2632573fe 100644 (file)
@@ -1757,7 +1757,7 @@ func TestPrefixOverlaps(t *testing.T) {
                {pfx("1::1/128"), pfx("2::2/128"), false},
                {pfx("0100::0/8"), pfx("::1/128"), false},
 
-               // IPv4-mapped IPv6 should not overlap with IPv4.
+               // IPv4-mapped IPv6 addresses should not overlap with IPv4.
                {PrefixFrom(AddrFrom16(mustIP("1.2.0.0").As16()), 16), pfx("1.2.3.0/24"), false},
 
                // Invalid prefixes