mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
net/netip: make Prefix.MarshalText format 4-in-6 IPs consistently
Fixes #50115. Change-Id: Iac76e5b486d3a2a784583345eaeb22c31cc4a36d Reviewed-on: https://go-review.googlesource.com/c/go/+/371134 Trust: Matt Layher <mdlayher@gmail.com> Run-TryBot: Matt Layher <mdlayher@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Trust: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
parent
56817040d5
commit
49b7c9caec
2 changed files with 32 additions and 2 deletions
|
|
@ -1422,7 +1422,12 @@ func (p Prefix) AppendTo(b []byte) []byte {
|
|||
if p.ip.z == z4 {
|
||||
b = p.ip.appendTo4(b)
|
||||
} else {
|
||||
b = p.ip.appendTo6(b)
|
||||
if p.ip.Is4In6() {
|
||||
b = append(b, "::ffff:"...)
|
||||
b = p.ip.Unmap().appendTo4(b)
|
||||
} else {
|
||||
b = p.ip.appendTo6(b)
|
||||
}
|
||||
}
|
||||
|
||||
b = append(b, '/')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue