From 588b70f46869ed9818c34f82e89c3357b35d28c7 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Fri, 26 Mar 2021 22:14:08 -0700 Subject: [PATCH] net/tstun: merge in wgengine/tstun. Signed-off-by: David Anderson --- cmd/tailscaled/depaware.txt | 3 +-- cmd/tailscaled/tailscaled.go | 7 +++---- wgengine/tstun/faketun.go => net/tstun/fake.go | 0 wgengine/tstun/tun.go => net/tstun/wrap.go | 0 wgengine/tstun/tun_test.go => net/tstun/wrap_test.go | 0 wgengine/tstun/tun_windows.go => net/tstun/wrap_windows.go | 0 wgengine/magicsock/magicsock_test.go | 2 +- wgengine/netstack/netstack.go | 2 +- wgengine/pendopen.go | 2 +- wgengine/userspace.go | 2 +- wgengine/userspace_test.go | 2 +- 11 files changed, 9 insertions(+), 11 deletions(-) rename wgengine/tstun/faketun.go => net/tstun/fake.go (100%) rename wgengine/tstun/tun.go => net/tstun/wrap.go (100%) rename wgengine/tstun/tun_test.go => net/tstun/wrap_test.go (100%) rename wgengine/tstun/tun_windows.go => net/tstun/wrap_windows.go (100%) diff --git a/cmd/tailscaled/depaware.txt b/cmd/tailscaled/depaware.txt index 12aad21d2..d91a960c4 100644 --- a/cmd/tailscaled/depaware.txt +++ b/cmd/tailscaled/depaware.txt @@ -105,7 +105,7 @@ tailscale.com/cmd/tailscaled dependencies: (generated by github.com/tailscale/de tailscale.com/net/tlsdial from tailscale.com/control/controlclient+ tailscale.com/net/tsaddr from tailscale.com/ipn/ipnlocal+ 💣 tailscale.com/net/tshttpproxy from tailscale.com/control/controlclient+ - tailscale.com/net/tstun from tailscale.com/cmd/tailscaled + tailscale.com/net/tstun from tailscale.com/cmd/tailscaled+ tailscale.com/paths from tailscale.com/cmd/tailscaled+ tailscale.com/portlist from tailscale.com/ipn/ipnlocal tailscale.com/safesocket from tailscale.com/ipn/ipnserver @@ -144,7 +144,6 @@ tailscale.com/cmd/tailscaled dependencies: (generated by github.com/tailscale/de tailscale.com/wgengine/monitor from tailscale.com/wgengine+ tailscale.com/wgengine/netstack from tailscale.com/cmd/tailscaled tailscale.com/wgengine/router from tailscale.com/cmd/tailscaled+ - tailscale.com/wgengine/tstun from tailscale.com/wgengine+ tailscale.com/wgengine/wgcfg from tailscale.com/ipn/ipnlocal+ tailscale.com/wgengine/wgcfg/nmcfg from tailscale.com/ipn/ipnlocal tailscale.com/wgengine/wglog from tailscale.com/wgengine diff --git a/cmd/tailscaled/tailscaled.go b/cmd/tailscaled/tailscaled.go index 137ccb61c..e025260ad 100644 --- a/cmd/tailscaled/tailscaled.go +++ b/cmd/tailscaled/tailscaled.go @@ -32,7 +32,7 @@ import ( "tailscale.com/ipn/ipnserver" "tailscale.com/logpolicy" "tailscale.com/net/socks5" - ntun "tailscale.com/net/tstun" + "tailscale.com/net/tstun" "tailscale.com/paths" "tailscale.com/types/flagtype" "tailscale.com/types/logger" @@ -44,7 +44,6 @@ import ( "tailscale.com/wgengine/monitor" "tailscale.com/wgengine/netstack" "tailscale.com/wgengine/router" - "tailscale.com/wgengine/tstun" ) // globalStateKey is the ipn.StateKey that tailscaled loads on @@ -337,9 +336,9 @@ func tryEngine(logf logger.Logf, linkMon *monitor.Mon, name string) (e wgengine. conf.TUN = tstun.NewFakeTUN() conf.Router = router.NewFake(logf) } else { - dev, err := ntun.New(logf, name) + dev, err := tstun.New(logf, name) if err != nil { - ntun.Diagnose(logf, name) + tstun.Diagnose(logf, name) return nil, false, err } conf.TUN = dev diff --git a/wgengine/tstun/faketun.go b/net/tstun/fake.go similarity index 100% rename from wgengine/tstun/faketun.go rename to net/tstun/fake.go diff --git a/wgengine/tstun/tun.go b/net/tstun/wrap.go similarity index 100% rename from wgengine/tstun/tun.go rename to net/tstun/wrap.go diff --git a/wgengine/tstun/tun_test.go b/net/tstun/wrap_test.go similarity index 100% rename from wgengine/tstun/tun_test.go rename to net/tstun/wrap_test.go diff --git a/wgengine/tstun/tun_windows.go b/net/tstun/wrap_windows.go similarity index 100% rename from wgengine/tstun/tun_windows.go rename to net/tstun/wrap_windows.go diff --git a/wgengine/magicsock/magicsock_test.go b/wgengine/magicsock/magicsock_test.go index 01bb34e3f..1e4d00b19 100644 --- a/wgengine/magicsock/magicsock_test.go +++ b/wgengine/magicsock/magicsock_test.go @@ -37,6 +37,7 @@ import ( "tailscale.com/derp/derpmap" "tailscale.com/ipn/ipnstate" "tailscale.com/net/stun/stuntest" + "tailscale.com/net/tstun" "tailscale.com/tailcfg" "tailscale.com/tstest" "tailscale.com/tstest/natlab" @@ -47,7 +48,6 @@ import ( "tailscale.com/types/wgkey" "tailscale.com/util/cibuild" "tailscale.com/wgengine/filter" - "tailscale.com/wgengine/tstun" "tailscale.com/wgengine/wgcfg" "tailscale.com/wgengine/wgcfg/nmcfg" "tailscale.com/wgengine/wglog" diff --git a/wgengine/netstack/netstack.go b/wgengine/netstack/netstack.go index 8aba261e6..cceb10eb8 100644 --- a/wgengine/netstack/netstack.go +++ b/wgengine/netstack/netstack.go @@ -31,13 +31,13 @@ import ( "inet.af/netstack/tcpip/transport/udp" "inet.af/netstack/waiter" "tailscale.com/net/packet" + "tailscale.com/net/tstun" "tailscale.com/types/logger" "tailscale.com/types/netmap" "tailscale.com/util/dnsname" "tailscale.com/wgengine" "tailscale.com/wgengine/filter" "tailscale.com/wgengine/magicsock" - "tailscale.com/wgengine/tstun" ) const debugNetstack = false diff --git a/wgengine/pendopen.go b/wgengine/pendopen.go index c5e8f0640..f18e12e9f 100644 --- a/wgengine/pendopen.go +++ b/wgengine/pendopen.go @@ -14,9 +14,9 @@ import ( "tailscale.com/net/flowtrack" "tailscale.com/net/packet" "tailscale.com/net/tsaddr" + "tailscale.com/net/tstun" "tailscale.com/types/ipproto" "tailscale.com/wgengine/filter" - "tailscale.com/wgengine/tstun" ) const tcpTimeoutBeforeDebug = 5 * time.Second diff --git a/wgengine/userspace.go b/wgengine/userspace.go index 81edb5d37..d7ee6314d 100644 --- a/wgengine/userspace.go +++ b/wgengine/userspace.go @@ -35,6 +35,7 @@ import ( "tailscale.com/net/packet" "tailscale.com/net/tsaddr" "tailscale.com/net/tshttpproxy" + "tailscale.com/net/tstun" "tailscale.com/tailcfg" "tailscale.com/types/ipproto" "tailscale.com/types/key" @@ -46,7 +47,6 @@ import ( "tailscale.com/wgengine/magicsock" "tailscale.com/wgengine/monitor" "tailscale.com/wgengine/router" - "tailscale.com/wgengine/tstun" "tailscale.com/wgengine/wgcfg" "tailscale.com/wgengine/wglog" ) diff --git a/wgengine/userspace_test.go b/wgengine/userspace_test.go index e9b83389a..6690ece01 100644 --- a/wgengine/userspace_test.go +++ b/wgengine/userspace_test.go @@ -13,10 +13,10 @@ import ( "go4.org/mem" "inet.af/netaddr" + "tailscale.com/net/tstun" "tailscale.com/tailcfg" "tailscale.com/types/key" "tailscale.com/wgengine/router" - "tailscale.com/wgengine/tstun" "tailscale.com/wgengine/wgcfg" )