From 85de5804557dc8d2e7a9a83adbb44ca498e74b45 Mon Sep 17 00:00:00 2001 From: Maisem Ali Date: Wed, 19 Apr 2023 15:20:43 -0700 Subject: [PATCH] net/tsdial: do not use proxies when dialing out to PeerAPI Found this when adding a test that does a ping over PeerAPI. Our integration tests set up a trafficTrap to ensure that tailscaled does not call out to the internet, and it does so via a HTTP_PROXY. When adding a test for pings over PeerAPI, it triggered the trap and investigation lead to the realization that we were not removing the Proxy when trying to dial out to the PeerAPI. Updates tailscale/corp#8020 Signed-off-by: Maisem Ali --- net/tsdial/tsdial.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/tsdial/tsdial.go b/net/tsdial/tsdial.go index 225033271..3c3db009c 100644 --- a/net/tsdial/tsdial.go +++ b/net/tsdial/tsdial.go @@ -367,6 +367,8 @@ func (d *Dialer) PeerAPIHTTPClient() *http.Client { t := http.DefaultTransport.(*http.Transport).Clone() t.Dial = nil t.DialContext = d.dialPeerAPI + // Do not use the environment proxy for PeerAPI. + t.Proxy = nil d.peerClient = &http.Client{Transport: t} }) return d.peerClient