mirror of
https://github.com/tailscale/tailscale.git
synced 2025-01-08 09:07:44 +00:00
logpolicy: use netns for dialing log.tailscale.io.
This commit is contained in:
parent
e9f7d01b91
commit
a6bd3a7e53
@ -29,6 +29,7 @@
|
|||||||
"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…
x
Reference in New Issue
Block a user