diff --git a/src/platform/httpclient.go b/src/platform/httpclient.go index 7280f5a3..6f089f89 100644 --- a/src/platform/httpclient.go +++ b/src/platform/httpclient.go @@ -3,6 +3,8 @@ package platform import ( "net" "net/http" + "net/url" + "os" "time" ) @@ -12,9 +14,17 @@ type httpClient interface { Do(req *http.Request) (*http.Response, error) } +func Proxy(_ *http.Request) (*url.URL, error) { + proxyURL := os.Getenv("HTTPS_PROXY") + if len(proxyURL) == 0 { + return nil, nil + } + return url.Parse(proxyURL) +} + var ( defaultTransport http.RoundTripper = &http.Transport{ - Proxy: http.ProxyFromEnvironment, + Proxy: Proxy, Dial: (&net.Dialer{ Timeout: 10 * time.Second, }).Dial,