From a3149830f2a6b2f7b67b492b9e064f2bea42c8a8 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Sat, 11 Jan 2025 10:57:08 -0800 Subject: [PATCH] lanscaping: remove sockstats -rwxr-xr-x@ 1 bradfitz staff 10243186 Jan 11 10:57 /Users/bradfitz/bin/tailscaled.min -rwxr-xr-x@ 1 bradfitz staff 10682520 Jan 11 10:57 /Users/bradfitz/bin/tailscaled.minlinux Change-Id: I08e82ee3b95e4b0f6cd68e0f96c79421486bad4b Signed-off-by: Brad Fitzpatrick --- cmd/tailscale/depaware-minlinux.txt | 2 +- cmd/tailscaled/depaware-minlinux.txt | 1 - control/controlclient/auto.go | 5 ----- control/controlhttp/client.go | 3 --- derp/derphttp/derphttp_client.go | 3 --- net/netcheck/netcheck.go | 3 --- wgengine/magicsock/magicsock.go | 6 ------ wgengine/userspace.go | 4 ---- 8 files changed, 1 insertion(+), 26 deletions(-) diff --git a/cmd/tailscale/depaware-minlinux.txt b/cmd/tailscale/depaware-minlinux.txt index cdc0731e4..cdb59ae84 100644 --- a/cmd/tailscale/depaware-minlinux.txt +++ b/cmd/tailscale/depaware-minlinux.txt @@ -72,7 +72,7 @@ tailscale.com/cmd/tailscale dependencies: (generated by github.com/tailscale/dep tailscale.com/net/netutil from tailscale.com/client/tailscale+ tailscale.com/net/packet from tailscale.com/wgengine/capture tailscale.com/net/portmapper from tailscale.com/cmd/tailscale/cli - tailscale.com/net/sockstats from tailscale.com/control/controlhttp+ + tailscale.com/net/sockstats from tailscale.com/net/portmapper tailscale.com/net/stun from tailscale.com/net/netcheck tailscale.com/net/tlsdial from tailscale.com/cmd/tailscale/cli+ tailscale.com/net/tsaddr from tailscale.com/client/web+ diff --git a/cmd/tailscaled/depaware-minlinux.txt b/cmd/tailscaled/depaware-minlinux.txt index 8ba08b11b..058a92f18 100644 --- a/cmd/tailscaled/depaware-minlinux.txt +++ b/cmd/tailscaled/depaware-minlinux.txt @@ -69,7 +69,6 @@ tailscale.com/cmd/tailscaled dependencies: (generated by github.com/tailscale/de tailscale.com/net/netutil from tailscale.com/control/controlclient+ tailscale.com/net/packet from tailscale.com/net/packet/checksum+ tailscale.com/net/packet/checksum from tailscale.com/net/tstun - tailscale.com/net/sockstats from tailscale.com/control/controlclient+ tailscale.com/net/stun from tailscale.com/net/netcheck+ L tailscale.com/net/tcpinfo from tailscale.com/derp tailscale.com/net/tlsdial from tailscale.com/control/controlclient+ diff --git a/control/controlclient/auto.go b/control/controlclient/auto.go index 9a2d9b446..b5d99aef8 100644 --- a/control/controlclient/auto.go +++ b/control/controlclient/auto.go @@ -13,7 +13,6 @@ import ( "time" "tailscale.com/logtail/backoff" - "tailscale.com/net/sockstats" "tailscale.com/tailcfg" "tailscale.com/tstime" "tailscale.com/types/key" @@ -188,10 +187,8 @@ func NewNoStart(opts Options) (_ *Auto, err error) { observer: opts.Observer, } c.authCtx, c.authCancel = context.WithCancel(context.Background()) - c.authCtx = sockstats.WithSockStats(c.authCtx, sockstats.LabelControlClientAuto, opts.Logf) c.mapCtx, c.mapCancel = context.WithCancel(context.Background()) - c.mapCtx = sockstats.WithSockStats(c.mapCtx, sockstats.LabelControlClientAuto, opts.Logf) c.unregisterHealthWatch = opts.HealthTracker.RegisterWatcher(direct.ReportHealthChange) return c, nil @@ -258,7 +255,6 @@ func (c *Auto) cancelAuthCtxLocked() { } if !c.closed { c.authCtx, c.authCancel = context.WithCancel(context.Background()) - c.authCtx = sockstats.WithSockStats(c.authCtx, sockstats.LabelControlClientAuto, c.logf) } } @@ -269,7 +265,6 @@ func (c *Auto) cancelMapCtxLocked() { } if !c.closed { c.mapCtx, c.mapCancel = context.WithCancel(context.Background()) - c.mapCtx = sockstats.WithSockStats(c.mapCtx, sockstats.LabelControlClientAuto, c.logf) } } diff --git a/control/controlhttp/client.go b/control/controlhttp/client.go index 4dcc06ff3..9f7ce1644 100644 --- a/control/controlhttp/client.go +++ b/control/controlhttp/client.go @@ -42,7 +42,6 @@ import ( "tailscale.com/envknob" "tailscale.com/health" "tailscale.com/net/netutil" - "tailscale.com/net/sockstats" "tailscale.com/net/tlsdial" "tailscale.com/syncs" "tailscale.com/tailcfg" @@ -296,8 +295,6 @@ func (a *Dialer) dialHost(ctx context.Context, optAddr netip.Addr) (*ClientConn, ctx, cancel := context.WithCancel(ctx) defer cancel() - ctx = sockstats.WithSockStats(ctx, sockstats.LabelControlClientDialer, a.logf) - // u80 and u443 are the URLs we'll try to hit over HTTP or HTTPS, // respectively, in order to do the HTTP upgrade to a net.Conn over which // we'll speak Noise. diff --git a/derp/derphttp/derphttp_client.go b/derp/derphttp/derphttp_client.go index c20627b9e..ef023071c 100644 --- a/derp/derphttp/derphttp_client.go +++ b/derp/derphttp/derphttp_client.go @@ -34,7 +34,6 @@ import ( "tailscale.com/health" "tailscale.com/net/netmon" "tailscale.com/net/netns" - "tailscale.com/net/sockstats" "tailscale.com/net/tlsdial" "tailscale.com/syncs" "tailscale.com/tailcfg" @@ -710,8 +709,6 @@ func (c *Client) dialNode(ctx context.Context, n *tailcfg.DERPNode) (net.Conn, e ctx, cancel := context.WithTimeout(ctx, dialNodeTimeout) defer cancel() - ctx = sockstats.WithSockStats(ctx, sockstats.LabelDERPHTTPClient, c.logf) - nwait := 0 startDial := func(dstPrimary, proto string) { nwait++ diff --git a/net/netcheck/netcheck.go b/net/netcheck/netcheck.go index 8c328075e..7067c9ad3 100644 --- a/net/netcheck/netcheck.go +++ b/net/netcheck/netcheck.go @@ -24,7 +24,6 @@ import ( "tailscale.com/net/neterror" "tailscale.com/net/netmon" "tailscale.com/net/netns" - "tailscale.com/net/sockstats" "tailscale.com/net/stun" "tailscale.com/syncs" "tailscale.com/tailcfg" @@ -764,8 +763,6 @@ func (c *Client) GetReport(ctx context.Context, dm *tailcfg.DERPMap, opts *GetRe ctx, cancel := context.WithTimeout(ctx, ReportTimeout) defer cancel() - ctx = sockstats.WithSockStats(ctx, sockstats.LabelNetcheckClient, c.logf) - if dm == nil { return nil, errors.New("netcheck: GetReport: DERP map is nil") } diff --git a/wgengine/magicsock/magicsock.go b/wgengine/magicsock/magicsock.go index 96c8c036c..4ece00b66 100644 --- a/wgengine/magicsock/magicsock.go +++ b/wgengine/magicsock/magicsock.go @@ -38,7 +38,6 @@ import ( "tailscale.com/net/netmon" "tailscale.com/net/netns" "tailscale.com/net/packet" - "tailscale.com/net/sockstats" "tailscale.com/net/stun" "tailscale.com/net/tstun" "tailscale.com/syncs" @@ -2504,11 +2503,6 @@ func (c *Conn) ReSTUN(why string) { // The network must be "udp4" or "udp6". func (c *Conn) listenPacket(network string, port uint16) (nettype.PacketConn, error) { ctx := context.Background() // unused without DNS name to resolve - if network == "udp4" { - ctx = sockstats.WithSockStats(ctx, sockstats.LabelMagicsockConnUDP4, c.logf) - } else { - ctx = sockstats.WithSockStats(ctx, sockstats.LabelMagicsockConnUDP6, c.logf) - } addr := net.JoinHostPort("", fmt.Sprint(port)) if c.testOnlyPacketListener != nil { return nettype.MakePacketListenerWithNetIP(c.testOnlyPacketListener).ListenPacket(ctx, network, addr) diff --git a/wgengine/userspace.go b/wgengine/userspace.go index 3698f7ee3..384eaeacf 100644 --- a/wgengine/userspace.go +++ b/wgengine/userspace.go @@ -26,7 +26,6 @@ import ( "tailscale.com/net/ipset" "tailscale.com/net/netmon" "tailscale.com/net/packet" - "tailscale.com/net/sockstats" "tailscale.com/net/tsaddr" "tailscale.com/net/tsdial" "tailscale.com/net/tstun" @@ -327,9 +326,6 @@ func NewUserspaceEngine(logf logger.Logf, conf Config) (_ Engine, reterr error) conf.Dialer.SetTUNName(tunName) conf.Dialer.SetNetMon(e.netMon) - // TODO: there's probably a better place for this - sockstats.SetNetMon(e.netMon) - logf("link state: %+v", e.netMon.InterfaceState()) unregisterMonWatch := e.netMon.RegisterChangeCallback(func(delta *netmon.ChangeDelta) {