author | Alberto Bertogli
<albertito@blitiri.com.ar> 2017-07-05 20:51:40 UTC |
committer | Alberto Bertogli
<albertito@blitiri.com.ar> 2017-07-20 20:42:26 UTC |
parent | 2c5cfbc5d2a1b5137d17ee4531328a7520440aa6 |
internal/dnstox/resolver.go | +11 | -4 |
diff --git a/internal/dnstox/resolver.go b/internal/dnstox/resolver.go index 165a1be..f0e6f54 100644 --- a/internal/dnstox/resolver.go +++ b/internal/dnstox/resolver.go @@ -133,12 +133,21 @@ func NewHTTPSResolver(upstream, caFile string) *httpsResolver { } func (r *httpsResolver) Init() error { + transport := &http.Transport{ + // Take the semi-standard proxy settings from the environment. + Proxy: http.ProxyFromEnvironment, + } + r.client = &http.Client{ // Give our HTTP requests 4 second timeouts: DNS usually doesn't wait // that long anyway, but this helps with slow connections. Timeout: 4 * time.Second, + + Transport: transport, } + // If CAFile is empty, we're ok with the defaults (use the system default + // CA database). if r.CAFile == "" { return nil } @@ -148,10 +157,8 @@ func (r *httpsResolver) Init() error { return err } - r.client.Transport = &http.Transport{ - TLSClientConfig: &tls.Config{ - ClientCAs: pool, - }, + transport.TLSClientConfig = &tls.Config{ + ClientCAs: pool, } return nil