From 03682cb27185076028a95b7c3454a2d2e589b107 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Fri, 29 May 2020 00:06:08 +0000 Subject: [PATCH] control/controlclient: use netns package to dial connections. Signed-off-by: David Anderson --- control/controlclient/direct.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/control/controlclient/direct.go b/control/controlclient/direct.go index 626afab87..d6342b5e5 100644 --- a/control/controlclient/direct.go +++ b/control/controlclient/direct.go @@ -28,6 +28,7 @@ import ( "golang.org/x/crypto/nacl/box" "golang.org/x/oauth2" "tailscale.com/log/logheap" + "tailscale.com/net/netns" "tailscale.com/net/tlsdial" "tailscale.com/tailcfg" "tailscale.com/types/logger" @@ -134,7 +135,9 @@ func NewDirect(opts Options) (*Direct, error) { httpc := opts.HTTPTestClient if httpc == nil { + dialer := netns.Dialer() tr := http.DefaultTransport.(*http.Transport).Clone() + tr.DialContext = dialer.DialContext tr.ForceAttemptHTTP2 = true tr.TLSClientConfig = tlsdial.Config(serverURL.Host, tr.TLSClientConfig) httpc = &http.Client{Transport: tr}