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/logtail"
"tailscale.com/logtail/filch"
"tailscale.com/net/netns"
"tailscale.com/net/tlsdial"
"tailscale.com/version"
)
@ -249,11 +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 := &net.Dialer{
Timeout: 30 * time.Second,
KeepAlive: 30 * time.Second,
DualStack: true,
}
nd := netns.Dialer()
nd.Timeout = 30 * time.Second
nd.KeepAlive = 30 * time.Second
nd.DualStack = true
t0 := time.Now()
c, err := nd.DialContext(ctx, netw, addr)
d := time.Since(t0).Round(time.Millisecond)

Loading…
Cancel
Save