logpolicy: use netns for dialing log.tailscale.io.

reviewable/pr425/r1
David Anderson 5 years ago
parent e9f7d01b91
commit a6bd3a7e53

@ -29,6 +29,7 @@ import (
"tailscale.com/atomicfile" "tailscale.com/atomicfile"
"tailscale.com/logtail" "tailscale.com/logtail"
"tailscale.com/logtail/filch" "tailscale.com/logtail/filch"
"tailscale.com/net/netns"
"tailscale.com/net/tlsdial" "tailscale.com/net/tlsdial"
"tailscale.com/version" "tailscale.com/version"
) )
@ -249,11 +250,10 @@ func newLogtailTransport(host string) *http.Transport {
// Log whenever we dial: // Log whenever we dial:
tr.DialContext = func(ctx context.Context, netw, addr string) (net.Conn, error) { tr.DialContext = func(ctx context.Context, netw, addr string) (net.Conn, error) {
nd := &net.Dialer{ nd := netns.Dialer()
Timeout: 30 * time.Second, nd.Timeout = 30 * time.Second
KeepAlive: 30 * time.Second, nd.KeepAlive = 30 * time.Second
DualStack: true, nd.DualStack = true
}
t0 := time.Now() t0 := time.Now()
c, err := nd.DialContext(ctx, netw, addr) c, err := nd.DialContext(ctx, netw, addr)
d := time.Since(t0).Round(time.Millisecond) d := time.Since(t0).Round(time.Millisecond)

Loading…
Cancel
Save