mirror of
https://github.com/tailscale/tailscale.git
synced 2025-04-22 08:51:41 +00:00
all: cleanup unused code, part 1 (#10661)
Run `staticcheck` with `U1000` to find unused code. This cleans up about a half of it. I'll do the other half separately to keep PRs manageable. Updates #cleanup Signed-off-by: Andrew Lytvynov <awly@tailscale.com>
This commit is contained in:
parent
3c333f6341
commit
1302bd1181
@ -74,18 +74,6 @@ var icmp4ReplyBuffer = []byte{
|
|||||||
0x72, 0x65, 0x70, 0x6c, 0x79, 0x5f, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64,
|
0x72, 0x65, 0x70, 0x6c, 0x79, 0x5f, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64,
|
||||||
}
|
}
|
||||||
|
|
||||||
var icmp4ReplyDecode = Parsed{
|
|
||||||
b: icmp4ReplyBuffer,
|
|
||||||
subofs: 20,
|
|
||||||
dataofs: 24,
|
|
||||||
length: len(icmp4ReplyBuffer),
|
|
||||||
|
|
||||||
IPVersion: 4,
|
|
||||||
IPProto: ICMPv4,
|
|
||||||
Src: mustIPPort("1.2.3.4:0"),
|
|
||||||
Dst: mustIPPort("5.6.7.8:0"),
|
|
||||||
}
|
|
||||||
|
|
||||||
// ICMPv6 Router Solicitation
|
// ICMPv6 Router Solicitation
|
||||||
var icmp6PacketBuffer = []byte{
|
var icmp6PacketBuffer = []byte{
|
||||||
0x60, 0x00, 0x00, 0x00, 0x00, 0x08, 0x3a, 0xff,
|
0x60, 0x00, 0x00, 0x00, 0x00, 0x08, 0x3a, 0xff,
|
||||||
@ -257,17 +245,6 @@ var udp4ReplyBuffer = []byte{
|
|||||||
0x72, 0x65, 0x70, 0x6c, 0x79, 0x5f, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64,
|
0x72, 0x65, 0x70, 0x6c, 0x79, 0x5f, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64,
|
||||||
}
|
}
|
||||||
|
|
||||||
var udp4ReplyDecode = Parsed{
|
|
||||||
b: udp4ReplyBuffer,
|
|
||||||
subofs: 20,
|
|
||||||
dataofs: 28,
|
|
||||||
length: len(udp4ReplyBuffer),
|
|
||||||
|
|
||||||
IPProto: UDP,
|
|
||||||
Src: mustIPPort("1.2.3.4:567"),
|
|
||||||
Dst: mustIPPort("5.6.7.8:123"),
|
|
||||||
}
|
|
||||||
|
|
||||||
// First TCP fragment of a packet with leading 24 bytes of 'a's
|
// First TCP fragment of a packet with leading 24 bytes of 'a's
|
||||||
var tcp4MediumFragmentBuffer = []byte{
|
var tcp4MediumFragmentBuffer = []byte{
|
||||||
// IP header up to checksum
|
// IP header up to checksum
|
||||||
|
@ -50,9 +50,7 @@ type TestIGDOptions struct {
|
|||||||
type igdCounters struct {
|
type igdCounters struct {
|
||||||
numUPnPDiscoRecv int32
|
numUPnPDiscoRecv int32
|
||||||
numUPnPOtherUDPRecv int32
|
numUPnPOtherUDPRecv int32
|
||||||
numUPnPHTTPRecv int32
|
|
||||||
numPMPRecv int32
|
numPMPRecv int32
|
||||||
numPMPDiscoRecv int32
|
|
||||||
numPCPRecv int32
|
numPCPRecv int32
|
||||||
numPCPDiscoRecv int32
|
numPCPDiscoRecv int32
|
||||||
numPCPMapRecv int32
|
numPCPMapRecv int32
|
||||||
|
@ -138,8 +138,8 @@ func mkWorld(t *testing.T) (ret *world) {
|
|||||||
}
|
}
|
||||||
go httpProxy.Serve(ret.httpListener)
|
go httpProxy.Serve(ret.httpListener)
|
||||||
|
|
||||||
socksProxy := socks5.Server{}
|
ret.socksProxy = &socks5.Server{}
|
||||||
go socksProxy.Serve(ret.socksListener)
|
go ret.socksProxy.Serve(ret.socksListener)
|
||||||
|
|
||||||
ret.httpClient = &http.Client{
|
ret.httpClient = &http.Client{
|
||||||
Transport: &http.Transport{
|
Transport: &http.Transport{
|
||||||
|
@ -16,6 +16,7 @@ import (
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
defaultRouteIPv4 = RouteDestination{Prefix: netip.PrefixFrom(netip.IPv4Unspecified(), 0)}
|
defaultRouteIPv4 = RouteDestination{Prefix: netip.PrefixFrom(netip.IPv4Unspecified(), 0)}
|
||||||
|
//lint:ignore U1000 used in routetable_bsd_test.go
|
||||||
defaultRouteIPv6 = RouteDestination{Prefix: netip.PrefixFrom(netip.IPv6Unspecified(), 0)}
|
defaultRouteIPv6 = RouteDestination{Prefix: netip.PrefixFrom(netip.IPv6Unspecified(), 0)}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -37,7 +37,6 @@ func CGNATRange() netip.Prefix {
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
cgnatRange oncePrefix
|
cgnatRange oncePrefix
|
||||||
ulaRange oncePrefix
|
|
||||||
tsUlaRange oncePrefix
|
tsUlaRange oncePrefix
|
||||||
tsViaRange oncePrefix
|
tsViaRange oncePrefix
|
||||||
ula4To6Range oncePrefix
|
ula4To6Range oncePrefix
|
||||||
|
@ -26,7 +26,7 @@ func peerDialControlFuncNetworkExtension(d *Dialer) func(network, address string
|
|||||||
defer d.mu.Unlock()
|
defer d.mu.Unlock()
|
||||||
|
|
||||||
index := -1
|
index := -1
|
||||||
if x, ok := d.interfaceIndexLocked(d.tunName); ok {
|
if x, ok := interfaceIndexLocked(d); ok {
|
||||||
index = x
|
index = x
|
||||||
}
|
}
|
||||||
var lc net.ListenConfig
|
var lc net.ListenConfig
|
||||||
@ -38,3 +38,15 @@ func peerDialControlFuncNetworkExtension(d *Dialer) func(network, address string
|
|||||||
return lc.Control(network, address, c)
|
return lc.Control(network, address, c)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func interfaceIndexLocked(d *Dialer) (index int, ok bool) {
|
||||||
|
if d.netMon == nil {
|
||||||
|
return 0, false
|
||||||
|
}
|
||||||
|
st := d.netMon.InterfaceState()
|
||||||
|
iface, ok := st.Interface[d.tunName]
|
||||||
|
if !ok {
|
||||||
|
return 0, false
|
||||||
|
}
|
||||||
|
return iface.Index, true
|
||||||
|
}
|
||||||
|
@ -196,18 +196,6 @@ func (d *Dialer) closeSysConn(id int) {
|
|||||||
go c.Close() // ignore the error
|
go c.Close() // ignore the error
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *Dialer) interfaceIndexLocked(ifName string) (index int, ok bool) {
|
|
||||||
if d.netMon == nil {
|
|
||||||
return 0, false
|
|
||||||
}
|
|
||||||
st := d.netMon.InterfaceState()
|
|
||||||
iface, ok := st.Interface[ifName]
|
|
||||||
if !ok {
|
|
||||||
return 0, false
|
|
||||||
}
|
|
||||||
return iface.Index, true
|
|
||||||
}
|
|
||||||
|
|
||||||
// peerDialControlFunc is non-nil on platforms that require a way to
|
// peerDialControlFunc is non-nil on platforms that require a way to
|
||||||
// bind to dial out to other peers.
|
// bind to dial out to other peers.
|
||||||
var peerDialControlFunc func(*Dialer) func(network, address string, c syscall.RawConn) error
|
var peerDialControlFunc func(*Dialer) func(network, address string, c syscall.RawConn) error
|
||||||
|
@ -258,7 +258,6 @@ func TestWriteAndInject(t *testing.T) {
|
|||||||
chtun, tun := newChannelTUN(t.Logf, false)
|
chtun, tun := newChannelTUN(t.Logf, false)
|
||||||
defer tun.Close()
|
defer tun.Close()
|
||||||
|
|
||||||
const size = 2 // all payloads have this size
|
|
||||||
written := []string{"w0", "w1"}
|
written := []string{"w0", "w1"}
|
||||||
injected := []string{"i0", "i1"}
|
injected := []string{"i0", "i1"}
|
||||||
|
|
||||||
|
21
release/dist/cli/cli.go
vendored
21
release/dist/cli/cli.go
vendored
@ -6,10 +6,7 @@ package cli
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"crypto"
|
|
||||||
"crypto/x509"
|
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"encoding/pem"
|
|
||||||
"errors"
|
"errors"
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -213,24 +210,6 @@ func runBuild(ctx context.Context, filters []string, targets []dist.Target) erro
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func parseSigningKey(path string) (crypto.Signer, error) {
|
|
||||||
if path == "" {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
raw, err := os.ReadFile(path)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
b, rest := pem.Decode(raw)
|
|
||||||
if b == nil {
|
|
||||||
return nil, fmt.Errorf("failed to decode PEM data in %q", path)
|
|
||||||
}
|
|
||||||
if len(rest) > 0 {
|
|
||||||
return nil, fmt.Errorf("trailing data in %q, please check that the key file was not corrupted", path)
|
|
||||||
}
|
|
||||||
return x509.ParseECPrivateKey(b.Bytes)
|
|
||||||
}
|
|
||||||
|
|
||||||
var genKeyArgs struct {
|
var genKeyArgs struct {
|
||||||
root bool
|
root bool
|
||||||
signing bool
|
signing bool
|
||||||
|
@ -1907,11 +1907,9 @@ func envEq(a, b string) bool {
|
|||||||
var (
|
var (
|
||||||
metricActiveSessions = clientmetric.NewGauge("ssh_active_sessions")
|
metricActiveSessions = clientmetric.NewGauge("ssh_active_sessions")
|
||||||
metricIncomingConnections = clientmetric.NewCounter("ssh_incoming_connections")
|
metricIncomingConnections = clientmetric.NewCounter("ssh_incoming_connections")
|
||||||
metricPublicKeyConnections = clientmetric.NewCounter("ssh_publickey_connections") // total
|
|
||||||
metricPublicKeyAccepts = clientmetric.NewCounter("ssh_publickey_accepts") // accepted subset of ssh_publickey_connections
|
metricPublicKeyAccepts = clientmetric.NewCounter("ssh_publickey_accepts") // accepted subset of ssh_publickey_connections
|
||||||
metricTerminalAccept = clientmetric.NewCounter("ssh_terminalaction_accept")
|
metricTerminalAccept = clientmetric.NewCounter("ssh_terminalaction_accept")
|
||||||
metricTerminalReject = clientmetric.NewCounter("ssh_terminalaction_reject")
|
metricTerminalReject = clientmetric.NewCounter("ssh_terminalaction_reject")
|
||||||
metricTerminalInterrupt = clientmetric.NewCounter("ssh_terminalaction_interrupt")
|
|
||||||
metricTerminalMalformed = clientmetric.NewCounter("ssh_terminalaction_malformed")
|
metricTerminalMalformed = clientmetric.NewCounter("ssh_terminalaction_malformed")
|
||||||
metricTerminalFetchError = clientmetric.NewCounter("ssh_terminalaction_fetch_error")
|
metricTerminalFetchError = clientmetric.NewCounter("ssh_terminalaction_fetch_error")
|
||||||
metricHolds = clientmetric.NewCounter("ssh_holds")
|
metricHolds = clientmetric.NewCounter("ssh_holds")
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
package tailcfg_test
|
package tailcfg_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding"
|
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"net/netip"
|
"net/netip"
|
||||||
"os"
|
"os"
|
||||||
@ -639,30 +638,6 @@ func TestNetInfoFields(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type keyIn interface {
|
|
||||||
String() string
|
|
||||||
MarshalText() ([]byte, error)
|
|
||||||
}
|
|
||||||
|
|
||||||
func testKey(t *testing.T, prefix string, in keyIn, out encoding.TextUnmarshaler) {
|
|
||||||
got, err := in.MarshalText()
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
if err := out.UnmarshalText(got); err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
if s := in.String(); string(got) != s {
|
|
||||||
t.Errorf("MarshalText = %q != String %q", got, s)
|
|
||||||
}
|
|
||||||
if !strings.HasPrefix(string(got), prefix) {
|
|
||||||
t.Errorf("%q didn't start with prefix %q", got, prefix)
|
|
||||||
}
|
|
||||||
if reflect.ValueOf(out).Elem().Interface() != in {
|
|
||||||
t.Errorf("mismatch after unmarshal")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestCloneUser(t *testing.T) {
|
func TestCloneUser(t *testing.T) {
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
|
@ -5,9 +5,7 @@ package tka
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/ed25519"
|
"crypto/ed25519"
|
||||||
"fmt"
|
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -100,22 +98,6 @@ func (s *scenarioTest) mkNodeWithForks(name string, signWithDefault bool, chains
|
|||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
||||||
func aumsToNames(n *scenarioNode, aums []AUM) string {
|
|
||||||
out := make([]string, 0, len(aums))
|
|
||||||
outer:
|
|
||||||
for _, a := range aums {
|
|
||||||
for name, candidate := range n.AUMs {
|
|
||||||
if candidate.Hash() == a.Hash() {
|
|
||||||
out = append(out, name)
|
|
||||||
continue outer
|
|
||||||
}
|
|
||||||
}
|
|
||||||
out = append(out, fmt.Sprintf("%x", a.Hash()))
|
|
||||||
}
|
|
||||||
|
|
||||||
return strings.Join(out, ",")
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *scenarioTest) syncBetween(n1, n2 *scenarioNode) error {
|
func (s *scenarioTest) syncBetween(n1, n2 *scenarioNode) error {
|
||||||
o1, err := n1.A.SyncOffer(n1.storage)
|
o1, err := n1.A.SyncOffer(n1.storage)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -6,7 +6,6 @@ package main
|
|||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
|
||||||
"io/fs"
|
"io/fs"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
@ -42,30 +41,6 @@ func makeGoroot(toolchainRoot, outPath string) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func copyFile(src, dst string) error {
|
|
||||||
s, err := os.Open(src)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("opening %q: %v", src, err)
|
|
||||||
}
|
|
||||||
defer s.Close()
|
|
||||||
|
|
||||||
d, err := os.OpenFile(dst, os.O_RDWR|os.O_CREATE, 0755)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("opening %q: %v", dst, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if _, err := io.Copy(d, s); err != nil {
|
|
||||||
d.Close()
|
|
||||||
return fmt.Errorf("copying %q to %q: %v", src, dst, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := d.Close(); err != nil {
|
|
||||||
return fmt.Errorf("closing %q: %v", dst, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// linkFarm symlinks every entry in srcDir into outDir, unless that
|
// linkFarm symlinks every entry in srcDir into outDir, unless that
|
||||||
// directory entry already exists.
|
// directory entry already exists.
|
||||||
func linkFarm(srcDir, outDir string) error {
|
func linkFarm(srcDir, outDir string) error {
|
||||||
|
@ -14,7 +14,7 @@ import (
|
|||||||
func TestAlignedAtomicInt64(t *testing.T) {
|
func TestAlignedAtomicInt64(t *testing.T) {
|
||||||
type T struct {
|
type T struct {
|
||||||
A atomicbitops.Int64
|
A atomicbitops.Int64
|
||||||
x int32
|
_ int32
|
||||||
B atomicbitops.Int64
|
B atomicbitops.Int64
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
package vms
|
package vms
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io"
|
|
||||||
"net/netip"
|
"net/netip"
|
||||||
"runtime"
|
"runtime"
|
||||||
"testing"
|
"testing"
|
||||||
@ -43,9 +42,3 @@ func TestDeriveBindhost(t *testing.T) {
|
|||||||
}
|
}
|
||||||
t.Log(deriveBindhost(t))
|
t.Log(deriveBindhost(t))
|
||||||
}
|
}
|
||||||
|
|
||||||
type nopWriteCloser struct {
|
|
||||||
io.Writer
|
|
||||||
}
|
|
||||||
|
|
||||||
func (nwc nopWriteCloser) Close() error { return nil }
|
|
||||||
|
@ -19,8 +19,6 @@ import (
|
|||||||
"golang.org/x/crypto/ssh"
|
"golang.org/x/crypto/ssh"
|
||||||
)
|
)
|
||||||
|
|
||||||
const timeout = 15 * time.Second
|
|
||||||
|
|
||||||
func retry(t *testing.T, fn func() error) {
|
func retry(t *testing.T, fn func() error) {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
const tries = 3
|
const tries = 3
|
||||||
|
@ -442,16 +442,6 @@ func (m *Machine) forwardPacket(p *Packet, iif *Interface) {
|
|||||||
oif.net.write(p)
|
oif.net.write(p)
|
||||||
}
|
}
|
||||||
|
|
||||||
func unspecOf(ip netip.Addr) netip.Addr {
|
|
||||||
if ip.Is4() {
|
|
||||||
return v4unspec
|
|
||||||
}
|
|
||||||
if ip.Is6() {
|
|
||||||
return v6unspec
|
|
||||||
}
|
|
||||||
panic(fmt.Sprintf("bogus IP %#v", ip))
|
|
||||||
}
|
|
||||||
|
|
||||||
// Attach adds an interface to a machine.
|
// Attach adds an interface to a machine.
|
||||||
//
|
//
|
||||||
// The first interface added to a Machine becomes that machine's
|
// The first interface added to a Machine becomes that machine's
|
||||||
@ -572,19 +562,6 @@ func (m *Machine) interfaceForIP(ip netip.Addr) (*Interface, error) {
|
|||||||
return nil, fmt.Errorf("no route found to %v", ip)
|
return nil, fmt.Errorf("no route found to %v", ip)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Machine) hasv6() bool {
|
|
||||||
m.mu.Lock()
|
|
||||||
defer m.mu.Unlock()
|
|
||||||
for _, f := range m.interfaces {
|
|
||||||
for _, ip := range f.ips {
|
|
||||||
if ip.Is6() {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *Machine) pickEphemPort() (port uint16, err error) {
|
func (m *Machine) pickEphemPort() (port uint16, err error) {
|
||||||
m.mu.Lock()
|
m.mu.Lock()
|
||||||
defer m.mu.Unlock()
|
defer m.mu.Unlock()
|
||||||
|
@ -12,7 +12,6 @@
|
|||||||
package rate
|
package rate
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
|
||||||
"math"
|
"math"
|
||||||
"sync"
|
"sync"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
@ -59,10 +58,6 @@ var (
|
|||||||
t0 = mono.Now()
|
t0 = mono.Now()
|
||||||
t1 = t0.Add(time.Duration(1) * d)
|
t1 = t0.Add(time.Duration(1) * d)
|
||||||
t2 = t0.Add(time.Duration(2) * d)
|
t2 = t0.Add(time.Duration(2) * d)
|
||||||
t3 = t0.Add(time.Duration(3) * d)
|
|
||||||
t4 = t0.Add(time.Duration(4) * d)
|
|
||||||
t5 = t0.Add(time.Duration(5) * d)
|
|
||||||
t9 = t0.Add(time.Duration(9) * d)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type allow struct {
|
type allow struct {
|
||||||
@ -152,33 +147,6 @@ func TestSimultaneousRequests(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type request struct {
|
|
||||||
t time.Time
|
|
||||||
n int
|
|
||||||
act time.Time
|
|
||||||
ok bool
|
|
||||||
}
|
|
||||||
|
|
||||||
// dFromDuration converts a duration to a multiple of the global constant d
|
|
||||||
func dFromDuration(dur time.Duration) int {
|
|
||||||
// Adding a millisecond to be swallowed by the integer division
|
|
||||||
// because we don't care about small inaccuracies
|
|
||||||
return int((dur + time.Millisecond) / d)
|
|
||||||
}
|
|
||||||
|
|
||||||
// dSince returns multiples of d since t0
|
|
||||||
func dSince(t mono.Time) int {
|
|
||||||
return dFromDuration(t.Sub(t0))
|
|
||||||
}
|
|
||||||
|
|
||||||
type wait struct {
|
|
||||||
name string
|
|
||||||
ctx context.Context
|
|
||||||
n int
|
|
||||||
delay int // in multiples of d
|
|
||||||
nilErr bool
|
|
||||||
}
|
|
||||||
|
|
||||||
func BenchmarkAllowN(b *testing.B) {
|
func BenchmarkAllowN(b *testing.B) {
|
||||||
lim := NewLimiter(Every(1*time.Second), 1)
|
lim := NewLimiter(Every(1*time.Second), 1)
|
||||||
now := mono.Now()
|
now := mono.Now()
|
||||||
|
@ -342,11 +342,11 @@ func getVal() *tailscaleTypes {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type IntThenByte struct {
|
type IntThenByte struct {
|
||||||
i int
|
_ int
|
||||||
b byte
|
_ byte
|
||||||
}
|
}
|
||||||
|
|
||||||
type TwoInts struct{ a, b int }
|
type TwoInts struct{ _, _ int }
|
||||||
|
|
||||||
type IntIntByteInt struct {
|
type IntIntByteInt struct {
|
||||||
i1, i2 int32
|
i1, i2 int32
|
||||||
@ -355,7 +355,6 @@ type IntIntByteInt struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func u8(n uint8) string { return string([]byte{n}) }
|
func u8(n uint8) string { return string([]byte{n}) }
|
||||||
func u16(n uint16) string { return string(binary.LittleEndian.AppendUint16(nil, n)) }
|
|
||||||
func u32(n uint32) string { return string(binary.LittleEndian.AppendUint32(nil, n)) }
|
func u32(n uint32) string { return string(binary.LittleEndian.AppendUint32(nil, n)) }
|
||||||
func u64(n uint64) string { return string(binary.LittleEndian.AppendUint64(nil, n)) }
|
func u64(n uint64) string { return string(binary.LittleEndian.AppendUint64(nil, n)) }
|
||||||
func ux(n uint) string {
|
func ux(n uint) string {
|
||||||
|
@ -78,7 +78,7 @@ func TestTypeIsMemHashable(t *testing.T) {
|
|||||||
|
|
||||||
func TestTypeIsRecursive(t *testing.T) {
|
func TestTypeIsRecursive(t *testing.T) {
|
||||||
type RecursiveStruct struct {
|
type RecursiveStruct struct {
|
||||||
v *RecursiveStruct
|
_ *RecursiveStruct
|
||||||
}
|
}
|
||||||
type RecursiveChan chan *RecursiveChan
|
type RecursiveChan chan *RecursiveChan
|
||||||
|
|
||||||
|
@ -73,33 +73,3 @@ const (
|
|||||||
// The default is "user-decides" unless otherwise stated.
|
// The default is "user-decides" unless otherwise stated.
|
||||||
PostureChecking Key = "PostureChecking"
|
PostureChecking Key = "PostureChecking"
|
||||||
)
|
)
|
||||||
|
|
||||||
var stringKeys = []Key{
|
|
||||||
ControlURL,
|
|
||||||
LogTarget,
|
|
||||||
Tailnet,
|
|
||||||
ExitNodeID,
|
|
||||||
ExitNodeIP,
|
|
||||||
EnableIncomingConnections,
|
|
||||||
EnableServerMode,
|
|
||||||
ExitNodeAllowLANAccess,
|
|
||||||
EnableTailscaleDNS,
|
|
||||||
EnableTailscaleSubnets,
|
|
||||||
AdminConsoleVisibility,
|
|
||||||
NetworkDevicesVisibility,
|
|
||||||
TestMenuVisibility,
|
|
||||||
UpdateMenuVisibility,
|
|
||||||
RunExitNodeVisibility,
|
|
||||||
PreferencesMenuVisibility,
|
|
||||||
ExitNodeMenuVisibility,
|
|
||||||
AutoUpdateVisibility,
|
|
||||||
KeyExpirationNoticeTime,
|
|
||||||
PostureChecking,
|
|
||||||
}
|
|
||||||
|
|
||||||
var boolKeys = []Key{
|
|
||||||
LogSCMInteractions,
|
|
||||||
FlushDNSOnSessionUnlock,
|
|
||||||
}
|
|
||||||
|
|
||||||
var uint64Keys = []Key{}
|
|
||||||
|
34
util/syspolicy/policy_keys_windows.go
Normal file
34
util/syspolicy/policy_keys_windows.go
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
// Copyright (c) Tailscale Inc & AUTHORS
|
||||||
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
|
package syspolicy
|
||||||
|
|
||||||
|
var stringKeys = []Key{
|
||||||
|
ControlURL,
|
||||||
|
LogTarget,
|
||||||
|
Tailnet,
|
||||||
|
ExitNodeID,
|
||||||
|
ExitNodeIP,
|
||||||
|
EnableIncomingConnections,
|
||||||
|
EnableServerMode,
|
||||||
|
ExitNodeAllowLANAccess,
|
||||||
|
EnableTailscaleDNS,
|
||||||
|
EnableTailscaleSubnets,
|
||||||
|
AdminConsoleVisibility,
|
||||||
|
NetworkDevicesVisibility,
|
||||||
|
TestMenuVisibility,
|
||||||
|
UpdateMenuVisibility,
|
||||||
|
RunExitNodeVisibility,
|
||||||
|
PreferencesMenuVisibility,
|
||||||
|
ExitNodeMenuVisibility,
|
||||||
|
AutoUpdateVisibility,
|
||||||
|
KeyExpirationNoticeTime,
|
||||||
|
PostureChecking,
|
||||||
|
}
|
||||||
|
|
||||||
|
var boolKeys = []Key{
|
||||||
|
LogSCMInteractions,
|
||||||
|
FlushDNSOnSessionUnlock,
|
||||||
|
}
|
||||||
|
|
||||||
|
var uint64Keys = []Key{}
|
@ -7,7 +7,6 @@ import (
|
|||||||
"flag"
|
"flag"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"runtime"
|
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
@ -36,13 +35,6 @@ func TestFindModuleInfo(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func exe() string {
|
|
||||||
if runtime.GOOS == "windows" {
|
|
||||||
return ".exe"
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
var findModuleInfoName = flag.String("module-info-file", "", "if non-empty, test findModuleInfo against this filename")
|
var findModuleInfoName = flag.String("module-info-file", "", "if non-empty, test findModuleInfo against this filename")
|
||||||
|
|
||||||
func TestFindModuleInfoManual(t *testing.T) {
|
func TestFindModuleInfoManual(t *testing.T) {
|
||||||
|
@ -40,8 +40,6 @@ func OS() string {
|
|||||||
return runtime.GOOS
|
return runtime.GOOS
|
||||||
}
|
}
|
||||||
|
|
||||||
var isSandboxedMacOS lazy.SyncValue[bool]
|
|
||||||
|
|
||||||
// IsSandboxedMacOS reports whether this process is a sandboxed macOS
|
// IsSandboxedMacOS reports whether this process is a sandboxed macOS
|
||||||
// process (either the app or the extension). It is true for the Mac App Store
|
// process (either the app or the extension). It is true for the Mac App Store
|
||||||
// and macsys (System Extension) version on macOS, and false for
|
// and macsys (System Extension) version on macOS, and false for
|
||||||
@ -210,6 +208,7 @@ var getMeta lazy.SyncValue[Meta]
|
|||||||
|
|
||||||
// GetMeta returns version metadata about the current build.
|
// GetMeta returns version metadata about the current build.
|
||||||
func GetMeta() Meta {
|
func GetMeta() Meta {
|
||||||
|
return getMeta.Get(func() Meta {
|
||||||
return Meta{
|
return Meta{
|
||||||
MajorMinorPatch: majorMinorPatch(),
|
MajorMinorPatch: majorMinorPatch(),
|
||||||
Short: Short(),
|
Short: Short(),
|
||||||
@ -221,4 +220,5 @@ func GetMeta() Meta {
|
|||||||
UnstableBranch: IsUnstableBuild(),
|
UnstableBranch: IsUnstableBuild(),
|
||||||
Cap: int(tailcfg.CurrentCapabilityVersion),
|
Cap: int(tailcfg.CurrentCapabilityVersion),
|
||||||
}
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
@ -605,10 +605,6 @@ func (r *linuxRouter) getV6Available() bool {
|
|||||||
return r.nfr.HasIPV6()
|
return r.nfr.HasIPV6()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *linuxRouter) getV6NATAvailable() bool {
|
|
||||||
return r.nfr.HasIPV6NAT()
|
|
||||||
}
|
|
||||||
|
|
||||||
// addAddress adds an IP/mask to the tunnel interface. Fails if the
|
// addAddress adds an IP/mask to the tunnel interface. Fails if the
|
||||||
// address is already assigned to the interface, or if the addition
|
// address is already assigned to the interface, or if the addition
|
||||||
// fails.
|
// fails.
|
||||||
|
@ -985,8 +985,6 @@ func (e *userspaceEngine) getStatusCallback() StatusCallback {
|
|||||||
return e.statusCallback
|
return e.statusCallback
|
||||||
}
|
}
|
||||||
|
|
||||||
var singleNewline = []byte{'\n'}
|
|
||||||
|
|
||||||
var ErrEngineClosing = errors.New("engine closing; no status")
|
var ErrEngineClosing = errors.New("engine closing; no status")
|
||||||
|
|
||||||
func (e *userspaceEngine) getPeerStatusLite(pk key.NodePublic) (status ipnstate.PeerStatusLite, ok bool) {
|
func (e *userspaceEngine) getPeerStatusLite(pk key.NodePublic) (status ipnstate.PeerStatusLite, ok bool) {
|
||||||
@ -1487,7 +1485,6 @@ func (ls fwdDNSLinkSelector) PickLink(ip netip.Addr) (linkName string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
metricMagicDNSPacketIn = clientmetric.NewCounter("magicdns_packet_in") // for 100.100.100.100
|
|
||||||
metricReflectToOS = clientmetric.NewCounter("packet_reflect_to_os")
|
metricReflectToOS = clientmetric.NewCounter("packet_reflect_to_os")
|
||||||
|
|
||||||
metricNumMajorChanges = clientmetric.NewCounter("wgengine_major_changes")
|
metricNumMajorChanges = clientmetric.NewCounter("wgengine_major_changes")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user