]> Cypherpunks repositories - gostls13.git/commitdiff
net: document ParseIP always returns IPv6 addresses
authorSean Liao <sean@liao.dev>
Fri, 12 Jul 2024 20:03:38 +0000 (21:03 +0100)
committerGopher Robot <gobot@golang.org>
Tue, 16 Jul 2024 18:03:01 +0000 (18:03 +0000)
Fixes #65131

Change-Id: I050c6459a8e0a6c99425759d3131cf775b05aac9
Reviewed-on: https://go-review.googlesource.com/c/go/+/598076
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
src/net/ip.go

index 49124d95e79df1c933106410491c09d4070ce4b3..3e0e85e168a72f0d84c61747e55410eabc420012 100644 (file)
@@ -491,7 +491,8 @@ func (n *IPNet) String() string {
 // The string s can be in IPv4 dotted decimal ("192.0.2.1"), IPv6
 // ("2001:db8::68"), or IPv4-mapped IPv6 ("::ffff:192.0.2.1") form.
 // If s is not a valid textual representation of an IP address,
-// ParseIP returns nil.
+// ParseIP returns nil. The returned address is always 16 bytes,
+// IPv4 addresses are returned in IPv4-mapped IPv6 form.
 func ParseIP(s string) IP {
        if addr, valid := parseIP(s); valid {
                return IP(addr[:])