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>
This commit is contained in:
@@ -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[:])
|
||||
|
||||
Reference in New Issue
Block a user