diff options
| author | Sean Liao <sean@liao.dev> | 2024-07-12 21:03:38 +0100 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2024-07-16 18:03:01 +0000 |
| commit | d5479e197d8a9eb98c30d7ec6ddc3fcbde459ebe (patch) | |
| tree | 641d68d4b04bb6869faf87048639ba9b8d695974 | |
| parent | 5c7f5413866b4b84654705ab49251b48b2b05ed4 (diff) | |
| download | go-d5479e197d8a9eb98c30d7ec6ddc3fcbde459ebe.tar.xz | |
net: document ParseIP always returns IPv6 addresses
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>
| -rw-r--r-- | src/net/ip.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/net/ip.go b/src/net/ip.go index 49124d95e7..3e0e85e168 100644 --- a/src/net/ip.go +++ b/src/net/ip.go @@ -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[:]) |
