diff --git a/cmd/tailscaled/depaware.txt b/cmd/tailscaled/depaware.txt index 6552b7aab..91321b316 100644 --- a/cmd/tailscaled/depaware.txt +++ b/cmd/tailscaled/depaware.txt @@ -290,7 +290,7 @@ tailscale.com/cmd/tailscaled dependencies: (generated by github.com/tailscale/de tailscale.com/paths from tailscale.com/ipn/ipnlocal+ 💣 tailscale.com/portlist from tailscale.com/ipn/ipnlocal tailscale.com/safesocket from tailscale.com/client/tailscale+ - tailscale.com/smallzstd from tailscale.com/cmd/tailscaled+ + tailscale.com/smallzstd from tailscale.com/control/controlclient+ LD 💣 tailscale.com/ssh/tailssh from tailscale.com/cmd/tailscaled tailscale.com/syncs from tailscale.com/net/netcheck+ tailscale.com/tailcfg from tailscale.com/client/tailscale/apitype+ diff --git a/cmd/tailscaled/tailscaled.go b/cmd/tailscaled/tailscaled.go index ce0f46b52..9fbbe4869 100644 --- a/cmd/tailscaled/tailscaled.go +++ b/cmd/tailscaled/tailscaled.go @@ -48,7 +48,6 @@ import ( "tailscale.com/net/tstun" "tailscale.com/paths" "tailscale.com/safesocket" - "tailscale.com/smallzstd" "tailscale.com/syncs" "tailscale.com/tsd" "tailscale.com/tsweb/varz" @@ -551,9 +550,6 @@ func getLocalBackend(ctx context.Context, logf logger.Logf, logID logid.PublicID if root := lb.TailscaleVarRoot(); root != "" { dnsfallback.SetCachePath(filepath.Join(root, "derpmap.cached.json"), logf) } - lb.SetDecompressor(func() (controlclient.Decompressor, error) { - return smallzstd.NewDecoder(nil) - }) configureTaildrop(logf, lb) if err := ns.Start(lb); err != nil { log.Fatalf("failed to start netstack: %v", err) diff --git a/cmd/tsconnect/wasm/wasm_js.go b/cmd/tsconnect/wasm/wasm_js.go index 31267a2ef..6066612fc 100644 --- a/cmd/tsconnect/wasm/wasm_js.go +++ b/cmd/tsconnect/wasm/wasm_js.go @@ -35,7 +35,6 @@ import ( "tailscale.com/net/netns" "tailscale.com/net/tsdial" "tailscale.com/safesocket" - "tailscale.com/smallzstd" "tailscale.com/tailcfg" "tailscale.com/tsd" "tailscale.com/wgengine" @@ -133,9 +132,6 @@ func newIPN(jsConfig js.Value) map[string]any { if err := ns.Start(lb); err != nil { log.Fatalf("failed to start netstack: %v", err) } - lb.SetDecompressor(func() (controlclient.Decompressor, error) { - return smallzstd.NewDecoder(nil) - }) srv.SetLocalBackend(lb) jsIPN := &jsIPN{ diff --git a/control/controlclient/direct.go b/control/controlclient/direct.go index b8951564d..dfd8efb12 100644 --- a/control/controlclient/direct.go +++ b/control/controlclient/direct.go @@ -43,6 +43,7 @@ import ( "tailscale.com/net/tlsdial" "tailscale.com/net/tsdial" "tailscale.com/net/tshttpproxy" + "tailscale.com/smallzstd" "tailscale.com/syncs" "tailscale.com/tailcfg" "tailscale.com/tka" @@ -68,7 +69,6 @@ type Direct struct { serverURL string // URL of the tailcontrol server clock tstime.Clock lastPrintMap time.Time - newDecompressor func() (Decompressor, error) logf logger.Logf netMon *netmon.Monitor // or nil discoPubKey key.DiscoPublic @@ -119,7 +119,6 @@ type Options struct { Clock tstime.Clock Hostinfo *tailcfg.Hostinfo // non-nil passes ownership, nil means to use default using os.Hostname, etc DiscoPublicKey key.DiscoPublic - NewDecompressor func() (Decompressor, error) Logf logger.Logf HTTPTestClient *http.Client // optional HTTP client to use (for tests only) NoiseTestClient *http.Client // optional HTTP client to use for noise RPCs (tests only) @@ -254,7 +253,6 @@ func NewDirect(opts Options) (*Direct, error) { serverURL: opts.ServerURL, clock: opts.Clock, logf: opts.Logf, - newDecompressor: opts.NewDecompressor, persist: opts.Persist.View(), authKey: opts.AuthKey, discoPubKey: opts.DiscoPublicKey, @@ -891,9 +889,7 @@ func (c *Direct) sendMapRequest(ctx context.Context, isStreaming bool, nu Netmap old := request.DebugFlags request.DebugFlags = append(old[:len(old):len(old)], extraDebugFlags...) } - if c.newDecompressor != nil { - request.Compress = "zstd" - } + request.Compress = "zstd" bodyData, err := encode(request, serverKey, serverNoiseKey, machinePrivKey) if err != nil { @@ -1177,19 +1173,14 @@ func (c *Direct) decodeMsg(msg []byte, v any, mkey key.MachinePrivate) error { } else { decrypted = msg } - var b []byte - if c.newDecompressor == nil { - b = decrypted - } else { - decoder, err := c.newDecompressor() - if err != nil { - return err - } - defer decoder.Close() - b, err = decoder.DecodeAll(decrypted, nil) - if err != nil { - return err - } + decoder, err := smallzstd.NewDecoder(nil) + if err != nil { + return err + } + defer decoder.Close() + b, err := decoder.DecodeAll(decrypted, nil) + if err != nil { + return err } if debugMap() { var buf bytes.Buffer diff --git a/ipn/ipnlocal/local.go b/ipn/ipnlocal/local.go index 6e3bfe032..d3024af81 100644 --- a/ipn/ipnlocal/local.go +++ b/ipn/ipnlocal/local.go @@ -153,10 +153,9 @@ type LocalBackend struct { portpoll *portlist.Poller // may be nil portpollOnce sync.Once // guards starting readPoller gotPortPollRes chan struct{} // closed upon first readPoller result - newDecompressor func() (controlclient.Decompressor, error) - varRoot string // or empty if SetVarRoot never called - logFlushFunc func() // or nil if SetLogFlusher wasn't called - em *expiryManager // non-nil + varRoot string // or empty if SetVarRoot never called + logFlushFunc func() // or nil if SetLogFlusher wasn't called + em *expiryManager // non-nil sshAtomicBool atomic.Bool shutdownCalled bool // if Shutdown has been called debugSink *capture.Sink @@ -898,16 +897,6 @@ func (b *LocalBackend) peerCapsLocked(src netip.Addr) tailcfg.PeerCapMap { return nil } -// SetDecompressor sets a decompression function, which must be a zstd -// reader. -// -// This exists because the iOS/Mac NetworkExtension is very resource -// constrained, and the zstd package is too heavy to fit in the -// constrained RSS limit. -func (b *LocalBackend) SetDecompressor(fn func() (controlclient.Decompressor, error)) { - b.newDecompressor = fn -} - // SetControlClientStatus is the callback invoked by the control client whenever it posts a new status. // Among other things, this is where we update the netmap, packet filters, DNS and DERP maps. func (b *LocalBackend) SetControlClientStatus(c controlclient.Client, st controlclient.Status) { @@ -1460,7 +1449,6 @@ func (b *LocalBackend) Start(opts ipn.Options) error { ServerURL: serverURL, AuthKey: opts.AuthKey, Hostinfo: hostinfo, - NewDecompressor: b.newDecompressor, HTTPTestClient: httpTestClient, DiscoPublicKey: discoPublic, DebugFlags: debugFlags, diff --git a/tsnet/tsnet.go b/tsnet/tsnet.go index 30c2dc738..94ae47911 100644 --- a/tsnet/tsnet.go +++ b/tsnet/tsnet.go @@ -550,9 +550,6 @@ func (s *Server) start() (reterr error) { return fmt.Errorf("failed to start netstack: %w", err) } closePool.addFunc(func() { s.lb.Shutdown() }) - lb.SetDecompressor(func() (controlclient.Decompressor, error) { - return smallzstd.NewDecoder(nil) - }) prefs := ipn.NewPrefs() prefs.Hostname = s.hostname prefs.WantRunning = true diff --git a/tstest/integration/tailscaled_deps_test_darwin.go b/tstest/integration/tailscaled_deps_test_darwin.go index 75ef83af0..1c8e928a1 100644 --- a/tstest/integration/tailscaled_deps_test_darwin.go +++ b/tstest/integration/tailscaled_deps_test_darwin.go @@ -33,7 +33,6 @@ import ( _ "tailscale.com/net/tstun" _ "tailscale.com/paths" _ "tailscale.com/safesocket" - _ "tailscale.com/smallzstd" _ "tailscale.com/ssh/tailssh" _ "tailscale.com/syncs" _ "tailscale.com/tailcfg" diff --git a/tstest/integration/tailscaled_deps_test_freebsd.go b/tstest/integration/tailscaled_deps_test_freebsd.go index 75ef83af0..1c8e928a1 100644 --- a/tstest/integration/tailscaled_deps_test_freebsd.go +++ b/tstest/integration/tailscaled_deps_test_freebsd.go @@ -33,7 +33,6 @@ import ( _ "tailscale.com/net/tstun" _ "tailscale.com/paths" _ "tailscale.com/safesocket" - _ "tailscale.com/smallzstd" _ "tailscale.com/ssh/tailssh" _ "tailscale.com/syncs" _ "tailscale.com/tailcfg" diff --git a/tstest/integration/tailscaled_deps_test_linux.go b/tstest/integration/tailscaled_deps_test_linux.go index 75ef83af0..1c8e928a1 100644 --- a/tstest/integration/tailscaled_deps_test_linux.go +++ b/tstest/integration/tailscaled_deps_test_linux.go @@ -33,7 +33,6 @@ import ( _ "tailscale.com/net/tstun" _ "tailscale.com/paths" _ "tailscale.com/safesocket" - _ "tailscale.com/smallzstd" _ "tailscale.com/ssh/tailssh" _ "tailscale.com/syncs" _ "tailscale.com/tailcfg" diff --git a/tstest/integration/tailscaled_deps_test_openbsd.go b/tstest/integration/tailscaled_deps_test_openbsd.go index 75ef83af0..1c8e928a1 100644 --- a/tstest/integration/tailscaled_deps_test_openbsd.go +++ b/tstest/integration/tailscaled_deps_test_openbsd.go @@ -33,7 +33,6 @@ import ( _ "tailscale.com/net/tstun" _ "tailscale.com/paths" _ "tailscale.com/safesocket" - _ "tailscale.com/smallzstd" _ "tailscale.com/ssh/tailssh" _ "tailscale.com/syncs" _ "tailscale.com/tailcfg" diff --git a/tstest/integration/tailscaled_deps_test_windows.go b/tstest/integration/tailscaled_deps_test_windows.go index 2ef5a002e..08c18bb7b 100644 --- a/tstest/integration/tailscaled_deps_test_windows.go +++ b/tstest/integration/tailscaled_deps_test_windows.go @@ -41,7 +41,6 @@ import ( _ "tailscale.com/net/tstun" _ "tailscale.com/paths" _ "tailscale.com/safesocket" - _ "tailscale.com/smallzstd" _ "tailscale.com/syncs" _ "tailscale.com/tailcfg" _ "tailscale.com/tsd"