Skip to content

Commit

Permalink
specify go1.12 way too
Browse files Browse the repository at this point in the history
  • Loading branch information
tmm1 committed Oct 21, 2019
1 parent 1acb9fb commit 43c5794
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,22 @@ import (
)

// Setup an HTTP client with a custom transport
transport := http.DefaultTransport.(*http.Transport).Clone()
transport := &http.Transport{
Proxy: ProxyFromEnvironment,
DialContext: (&net.Dialer{
Timeout: 30 * time.Second,
KeepAlive: 30 * time.Second,
DualStack: true,
}).DialContext,
ForceAttemptHTTP2: true,
MaxIdleConns: 100,
IdleConnTimeout: 90 * time.Second,
TLSHandshakeTimeout: 10 * time.Second,
ExpectContinueTimeout: 1 * time.Second,
}
// or, starting with go1.13 simply use:
// transport := http.DefaultTransport.(*http.Transport).Clone()

transport.TLSClientConfig = &tls.Config{RootCAs: certPool}
client := &http.Client{Transport: transport}

Expand Down

0 comments on commit 43c5794

Please sign in to comment.