mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-11 21:27:31 +00:00
net/{netns,netstat}: use new x/sys/cpu.IsBigEndian
See golang/go#57237 Change-Id: If47ab6de7c1610998a5808e945c4177c561eab45 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:

committed by
Brad Fitzpatrick

parent
2755f3843c
commit
03645f0c27
@@ -11,7 +11,7 @@ import (
|
||||
"net/netip"
|
||||
"unsafe"
|
||||
|
||||
"github.com/josharian/native"
|
||||
"golang.org/x/sys/cpu"
|
||||
"golang.org/x/sys/windows"
|
||||
"tailscale.com/net/netaddr"
|
||||
)
|
||||
@@ -202,7 +202,7 @@ func state(v uint32) string {
|
||||
}
|
||||
|
||||
func ipport4(addr uint32, port uint16) netip.AddrPort {
|
||||
if !native.IsBigEndian {
|
||||
if !cpu.IsBigEndian {
|
||||
addr = bits.ReverseBytes32(addr)
|
||||
}
|
||||
return netip.AddrPortFrom(
|
||||
@@ -220,7 +220,7 @@ func ipport6(addr [16]byte, scope uint32, port uint16) netip.AddrPort {
|
||||
}
|
||||
|
||||
func port(v *uint32) uint16 {
|
||||
if !native.IsBigEndian {
|
||||
if !cpu.IsBigEndian {
|
||||
return uint16(bits.ReverseBytes32(*v) >> 16)
|
||||
}
|
||||
return uint16(*v >> 16)
|
||||
|
Reference in New Issue
Block a user