all: use Go 1.21's binary.NativeEndian
Some checks are pending
checklocks / checklocks (push) Waiting to run
CodeQL / Analyze (go) (push) Waiting to run
Dockerfile build / deploy (push) Waiting to run
CI / race-root-integration (1/4) (push) Waiting to run
CI / race-root-integration (2/4) (push) Waiting to run
CI / race-root-integration (3/4) (push) Waiting to run
CI / race-root-integration (4/4) (push) Waiting to run
CI / test (-coverprofile=/tmp/coverage.out, amd64) (push) Waiting to run
CI / test (-race, amd64, 1/3) (push) Waiting to run
CI / test (-race, amd64, 2/3) (push) Waiting to run
CI / test (-race, amd64, 3/3) (push) Waiting to run
CI / test (386) (push) Waiting to run
CI / windows (push) Waiting to run
CI / privileged (push) Waiting to run
CI / vm (push) Waiting to run
CI / race-build (push) Waiting to run
CI / cross (386, linux) (push) Waiting to run
CI / cross (amd64, darwin) (push) Waiting to run
CI / cross (amd64, freebsd) (push) Waiting to run
CI / cross (amd64, openbsd) (push) Waiting to run
CI / cross (amd64, windows) (push) Waiting to run
CI / cross (arm, 5, linux) (push) Waiting to run
CI / cross (arm, 7, linux) (push) Waiting to run
CI / cross (arm64, darwin) (push) Waiting to run
CI / cross (arm64, linux) (push) Waiting to run
CI / cross (arm64, windows) (push) Waiting to run
CI / cross (loong64, linux) (push) Waiting to run
CI / ios (push) Waiting to run
CI / crossmin (amd64, illumos) (push) Waiting to run
CI / crossmin (amd64, plan9) (push) Waiting to run
CI / crossmin (amd64, solaris) (push) Waiting to run
CI / crossmin (ppc64, aix) (push) Waiting to run
CI / android (push) Waiting to run
CI / wasm (push) Waiting to run
CI / tailscale_go (push) Waiting to run
CI / fuzz (push) Waiting to run
CI / depaware (push) Waiting to run
CI / go_generate (push) Waiting to run
CI / go_mod_tidy (push) Waiting to run
CI / licenses (push) Waiting to run
CI / staticcheck (386, windows) (push) Waiting to run
CI / staticcheck (amd64, darwin) (push) Waiting to run
CI / staticcheck (amd64, linux) (push) Waiting to run
CI / staticcheck (amd64, windows) (push) Waiting to run
CI / notify_slack (push) Blocked by required conditions
CI / check_mergeability (push) Blocked by required conditions
update-flake / update-flake (push) Waiting to run
Some checks are pending
checklocks / checklocks (push) Waiting to run
CodeQL / Analyze (go) (push) Waiting to run
Dockerfile build / deploy (push) Waiting to run
CI / race-root-integration (1/4) (push) Waiting to run
CI / race-root-integration (2/4) (push) Waiting to run
CI / race-root-integration (3/4) (push) Waiting to run
CI / race-root-integration (4/4) (push) Waiting to run
CI / test (-coverprofile=/tmp/coverage.out, amd64) (push) Waiting to run
CI / test (-race, amd64, 1/3) (push) Waiting to run
CI / test (-race, amd64, 2/3) (push) Waiting to run
CI / test (-race, amd64, 3/3) (push) Waiting to run
CI / test (386) (push) Waiting to run
CI / windows (push) Waiting to run
CI / privileged (push) Waiting to run
CI / vm (push) Waiting to run
CI / race-build (push) Waiting to run
CI / cross (386, linux) (push) Waiting to run
CI / cross (amd64, darwin) (push) Waiting to run
CI / cross (amd64, freebsd) (push) Waiting to run
CI / cross (amd64, openbsd) (push) Waiting to run
CI / cross (amd64, windows) (push) Waiting to run
CI / cross (arm, 5, linux) (push) Waiting to run
CI / cross (arm, 7, linux) (push) Waiting to run
CI / cross (arm64, darwin) (push) Waiting to run
CI / cross (arm64, linux) (push) Waiting to run
CI / cross (arm64, windows) (push) Waiting to run
CI / cross (loong64, linux) (push) Waiting to run
CI / ios (push) Waiting to run
CI / crossmin (amd64, illumos) (push) Waiting to run
CI / crossmin (amd64, plan9) (push) Waiting to run
CI / crossmin (amd64, solaris) (push) Waiting to run
CI / crossmin (ppc64, aix) (push) Waiting to run
CI / android (push) Waiting to run
CI / wasm (push) Waiting to run
CI / tailscale_go (push) Waiting to run
CI / fuzz (push) Waiting to run
CI / depaware (push) Waiting to run
CI / go_generate (push) Waiting to run
CI / go_mod_tidy (push) Waiting to run
CI / licenses (push) Waiting to run
CI / staticcheck (386, windows) (push) Waiting to run
CI / staticcheck (amd64, darwin) (push) Waiting to run
CI / staticcheck (amd64, linux) (push) Waiting to run
CI / staticcheck (amd64, windows) (push) Waiting to run
CI / notify_slack (push) Blocked by required conditions
CI / check_mergeability (push) Blocked by required conditions
update-flake / update-flake (push) Waiting to run
We still use josharian/native (hi @josharian!) via netlink, but I also sent https://github.com/mdlayher/netlink/pull/220 Updates #8632 Change-Id: I2eedcb7facb36ec894aee7f152c8a1f56d7fc8ba Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
parent
69b90742fe
commit
60d19fa00d
2
go.mod
2
go.mod
@ -52,7 +52,6 @@ require (
|
|||||||
github.com/inetaf/tcpproxy v0.0.0-20240214030015-3ce58045626c
|
github.com/inetaf/tcpproxy v0.0.0-20240214030015-3ce58045626c
|
||||||
github.com/insomniacslk/dhcp v0.0.0-20231206064809-8c70d406f6d2
|
github.com/insomniacslk/dhcp v0.0.0-20231206064809-8c70d406f6d2
|
||||||
github.com/jellydator/ttlcache/v3 v3.1.0
|
github.com/jellydator/ttlcache/v3 v3.1.0
|
||||||
github.com/josharian/native v1.1.1-0.20230202152459-5c7d0dd6ab86
|
|
||||||
github.com/jsimonetti/rtnetlink v1.4.0
|
github.com/jsimonetti/rtnetlink v1.4.0
|
||||||
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
|
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
|
||||||
github.com/klauspost/compress v1.17.11
|
github.com/klauspost/compress v1.17.11
|
||||||
@ -152,6 +151,7 @@ require (
|
|||||||
github.com/google/pprof v0.0.0-20240409012703-83162a5b38cd // indirect
|
github.com/google/pprof v0.0.0-20240409012703-83162a5b38cd // indirect
|
||||||
github.com/gorilla/securecookie v1.1.2 // indirect
|
github.com/gorilla/securecookie v1.1.2 // indirect
|
||||||
github.com/jjti/go-spancheck v0.5.3 // indirect
|
github.com/jjti/go-spancheck v0.5.3 // indirect
|
||||||
|
github.com/josharian/native v1.1.1-0.20230202152459-5c7d0dd6ab86 // indirect
|
||||||
github.com/karamaru-alpha/copyloopvar v1.0.8 // indirect
|
github.com/karamaru-alpha/copyloopvar v1.0.8 // indirect
|
||||||
github.com/macabu/inamedparam v0.1.3 // indirect
|
github.com/macabu/inamedparam v0.1.3 // indirect
|
||||||
github.com/moby/docker-image-spec v1.3.1 // indirect
|
github.com/moby/docker-image-spec v1.3.1 // indirect
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/binary"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
"net/netip"
|
"net/netip"
|
||||||
@ -14,7 +15,6 @@
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/godbus/dbus/v5"
|
"github.com/godbus/dbus/v5"
|
||||||
"github.com/josharian/native"
|
|
||||||
"tailscale.com/net/tsaddr"
|
"tailscale.com/net/tsaddr"
|
||||||
"tailscale.com/util/dnsname"
|
"tailscale.com/util/dnsname"
|
||||||
)
|
)
|
||||||
@ -137,7 +137,7 @@ func (m *nmManager) trySet(ctx context.Context, config OSConfig) error {
|
|||||||
for _, ip := range config.Nameservers {
|
for _, ip := range config.Nameservers {
|
||||||
b := ip.As16()
|
b := ip.As16()
|
||||||
if ip.Is4() {
|
if ip.Is4() {
|
||||||
dnsv4 = append(dnsv4, native.Endian.Uint32(b[12:]))
|
dnsv4 = append(dnsv4, binary.NativeEndian.Uint32(b[12:]))
|
||||||
} else {
|
} else {
|
||||||
dnsv6 = append(dnsv6, b[:])
|
dnsv6 = append(dnsv6, b[:])
|
||||||
}
|
}
|
||||||
|
@ -6,10 +6,9 @@
|
|||||||
package cstruct
|
package cstruct
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/binary"
|
||||||
"errors"
|
"errors"
|
||||||
"io"
|
"io"
|
||||||
|
|
||||||
"github.com/josharian/native"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Size of a pointer-typed value, in bits
|
// Size of a pointer-typed value, in bits
|
||||||
@ -120,7 +119,7 @@ func (d *Decoder) Uint16() uint16 {
|
|||||||
d.err = err
|
d.err = err
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
return native.Endian.Uint16(d.dbuf[0:2])
|
return binary.NativeEndian.Uint16(d.dbuf[0:2])
|
||||||
}
|
}
|
||||||
|
|
||||||
// Uint32 returns a uint32 decoded from the buffer.
|
// Uint32 returns a uint32 decoded from the buffer.
|
||||||
@ -133,7 +132,7 @@ func (d *Decoder) Uint32() uint32 {
|
|||||||
d.err = err
|
d.err = err
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
return native.Endian.Uint32(d.dbuf[0:4])
|
return binary.NativeEndian.Uint32(d.dbuf[0:4])
|
||||||
}
|
}
|
||||||
|
|
||||||
// Uint64 returns a uint64 decoded from the buffer.
|
// Uint64 returns a uint64 decoded from the buffer.
|
||||||
@ -146,7 +145,7 @@ func (d *Decoder) Uint64() uint64 {
|
|||||||
d.err = err
|
d.err = err
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
return native.Endian.Uint64(d.dbuf[0:8])
|
return binary.NativeEndian.Uint64(d.dbuf[0:8])
|
||||||
}
|
}
|
||||||
|
|
||||||
// Uintptr returns a uintptr decoded from the buffer.
|
// Uintptr returns a uintptr decoded from the buffer.
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"cmp"
|
"cmp"
|
||||||
|
"encoding/binary"
|
||||||
"fmt"
|
"fmt"
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
@ -15,7 +16,6 @@
|
|||||||
"github.com/google/nftables"
|
"github.com/google/nftables"
|
||||||
"github.com/google/nftables/expr"
|
"github.com/google/nftables/expr"
|
||||||
"github.com/google/nftables/xt"
|
"github.com/google/nftables/xt"
|
||||||
"github.com/josharian/native"
|
|
||||||
"golang.org/x/sys/unix"
|
"golang.org/x/sys/unix"
|
||||||
"tailscale.com/types/logger"
|
"tailscale.com/types/logger"
|
||||||
)
|
)
|
||||||
@ -235,8 +235,8 @@ func printMatchInfo(name string, info xt.InfoAny) string {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
pkttype := int(native.Endian.Uint32(data[0:4]))
|
pkttype := int(binary.NativeEndian.Uint32(data[0:4]))
|
||||||
invert := int(native.Endian.Uint32(data[4:8]))
|
invert := int(binary.NativeEndian.Uint32(data[4:8]))
|
||||||
var invertPrefix string
|
var invertPrefix string
|
||||||
if invert != 0 {
|
if invert != 0 {
|
||||||
invertPrefix = "!"
|
invertPrefix = "!"
|
||||||
|
Loading…
Reference in New Issue
Block a user