net/netns: move SOCKS dialing to netns for now

This lets control & logs also use SOCKS dials.

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick
2020-06-01 10:50:37 -07:00
committed by Brad Fitzpatrick
parent cf0d19f0ab
commit 24009241bf
5 changed files with 57 additions and 34 deletions

View File

@@ -250,9 +250,10 @@ func newLogtailTransport(host string) *http.Transport {
// Log whenever we dial:
tr.DialContext = func(ctx context.Context, netw, addr string) (net.Conn, error) {
nd := netns.Dialer()
nd.Timeout = 30 * time.Second
nd.KeepAlive = 30 * time.Second
nd := netns.FromDialer(&net.Dialer{
Timeout: 30 * time.Second,
KeepAlive: 30 * time.Second,
})
t0 := time.Now()
c, err := nd.DialContext(ctx, netw, addr)
d := time.Since(t0).Round(time.Millisecond)