mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
net: make IPv6 String method standards compliant
draft-ietf-6man-text-addr-representation-07 will introduce a canonical textual representation format for IPv6 address. R=rsc CC=golang-dev https://golang.org/cl/1856047
This commit is contained in:
parent
d31ee536e8
commit
e41987c821
2 changed files with 48 additions and 0 deletions
|
|
@ -222,6 +222,11 @@ func (ip IP) String() string {
|
|||
e1 = j
|
||||
}
|
||||
}
|
||||
// The symbol "::" MUST NOT be used to shorten just one 16 bit 0 field.
|
||||
if e1-e0 <= 2 {
|
||||
e0 = -1
|
||||
e1 = -1
|
||||
}
|
||||
|
||||
// Print with possible :: in place of run of zeros
|
||||
var s string
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue