]> Cypherpunks repositories - gostls13.git/commitdiff
net/netip: fix uses of "IPv4-mapped IPv6" in doc comments
authorAdam Pritchard <pritchard.adam@gmail.com>
Fri, 25 Mar 2022 19:08:19 +0000 (19:08 +0000)
committerIan Lance Taylor <iant@golang.org>
Fri, 25 Mar 2022 20:23:27 +0000 (20:23 +0000)
The correct (or at least mostly commonly used) name for addresses of the
form ::ffff:192.0.2.128 is "IPv4-mapped IPv6". Some of the comments in
the netip package used that name, but others used "IPv6-mapped IPv4" or
"v6-mapped". This change makes the usage of the term consistent.

Change-Id: Ic01309ddf9252705a2387322d940b777e88800a5
GitHub-Last-Rev: 56044dcb97aeae1aa09bde635118ad46c979bbaf
GitHub-Pull-Request: golang/go#51950
Reviewed-on: https://go-review.googlesource.com/c/go/+/395914
Reviewed-by: Damien Neil <dneil@google.com>
Trust: Damien Neil <dneil@google.com>
Run-TryBot: Damien Neil <dneil@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Trust: Ian Lance Taylor <iant@golang.org>

src/net/netip/netip.go
src/net/netip/netip_test.go

index f27984ab574baeb967e65743ca93ea3fbc11a8e0..1cf75fb5a1ff60df6ead5931ade71da20904dc36 100644 (file)
@@ -90,7 +90,7 @@ func AddrFrom4(addr [4]byte) Addr {
 }
 
 // AddrFrom16 returns the IPv6 address given by the bytes in addr.
-// An IPv6-mapped IPv4 address is left as an IPv6 address.
+// An IPv4-mapped IPv6 address is left as an IPv6 address.
 // (Use Unmap to convert them if needed.)
 func AddrFrom16(addr [16]byte) Addr {
        return Addr{
@@ -675,7 +675,7 @@ const (
 )
 
 // As16 returns the IP address in its 16-byte representation.
-// IPv4 addresses are returned in their v6-mapped form.
+// IPv4 addresses are returned in their IPv4-mapped IPv6 form.
 // IPv6 addresses with zones are returned without their zone (use the
 // Zone method to get it).
 // The ip zero value returns all zeroes.
@@ -1340,7 +1340,7 @@ func (p Prefix) Masked() Prefix {
 // Contains reports whether the network p includes ip.
 //
 // An IPv4 address will not match an IPv6 prefix.
-// A v6-mapped IPv6 address will not match an IPv4 prefix.
+// An IPv4-mapped IPv6 address will not match an IPv4 prefix.
 // A zero-value IP will not match any prefix.
 // If ip has an IPv6 zone, Contains returns false,
 // because Prefixes strip zones.
@@ -1372,8 +1372,8 @@ func (p Prefix) Contains(ip Addr) bool {
 // Overlaps reports whether p and o contain any IP addresses in common.
 //
 // 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 a
-// v6-mapped IPv4 IP is still treated as an IPv6 mask.
+// IP, it reports false. Like the Contains method, a prefix with an
+// IPv4-mapped IPv6 IP is still treated as an IPv6 mask.
 func (p Prefix) Overlaps(o Prefix) bool {
        if !p.IsValid() || !o.IsValid() {
                return false
index d988864827b6ebe2f9af17a9f9444b7895e8403c..a72390fd5b08ecfb4f096ce324ec2386b085600b 100644 (file)
@@ -1776,7 +1776,7 @@ func TestPrefixOverlaps(t *testing.T) {
                {pfx("1::1/128"), pfx("2::2/128"), false},
                {pfx("0100::0/8"), pfx("::1/128"), false},
 
-               // v6-mapped v4 should not overlap with IPv4.
+               // IPv4-mapped IPv6 should not overlap with IPv4.
                {PrefixFrom(AddrFrom16(mustIP("1.2.0.0").As16()), 16), pfx("1.2.3.0/24"), false},
 
                // Invalid prefixes