Skip to content

Commit

Permalink
Clone the DefaultTransport directly from stdlib
Browse files Browse the repository at this point in the history
  • Loading branch information
maddie committed Dec 7, 2020
1 parent fd8af15 commit 5cf383b
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions speedtest/speedtest.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,19 +151,8 @@ func SpeedTest(c *cli.Context) error {
network = "ip"
}

transport := &http.Transport{
Proxy: http.ProxyFromEnvironment,
DialContext: (&net.Dialer{
Timeout: 30 * time.Second,
KeepAlive: 30 * time.Second,
}).DialContext,
ForceAttemptHTTP2: true,
MaxIdleConns: 100,
IdleConnTimeout: 90 * time.Second,
TLSHandshakeTimeout: 10 * time.Second,
ExpectContinueTimeout: 1 * time.Second,
TLSClientConfig: &tls.Config{InsecureSkipVerify: c.Bool(defs.OptionSkipCertVerify)},
}
transport := http.DefaultTransport.(*http.Transport).Clone()
transport.TLSClientConfig = &tls.Config{InsecureSkipVerify: c.Bool(defs.OptionSkipCertVerify)}

// bind to source IP address if given, or if ipv4/ipv6 is forced
if src := c.String(defs.OptionSource); src != "" || (forceIPv4 || forceIPv6) {
Expand Down

0 comments on commit 5cf383b

Please sign in to comment.