Skip to content

Commit 5cf383b

Browse files
committed
Clone the DefaultTransport directly from stdlib
1 parent fd8af15 commit 5cf383b

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

speedtest/speedtest.go

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -151,19 +151,8 @@ func SpeedTest(c *cli.Context) error {
151151
network = "ip"
152152
}
153153

154-
transport := &http.Transport{
155-
Proxy: http.ProxyFromEnvironment,
156-
DialContext: (&net.Dialer{
157-
Timeout: 30 * time.Second,
158-
KeepAlive: 30 * time.Second,
159-
}).DialContext,
160-
ForceAttemptHTTP2: true,
161-
MaxIdleConns: 100,
162-
IdleConnTimeout: 90 * time.Second,
163-
TLSHandshakeTimeout: 10 * time.Second,
164-
ExpectContinueTimeout: 1 * time.Second,
165-
TLSClientConfig: &tls.Config{InsecureSkipVerify: c.Bool(defs.OptionSkipCertVerify)},
166-
}
154+
transport := http.DefaultTransport.(*http.Transport).Clone()
155+
transport.TLSClientConfig = &tls.Config{InsecureSkipVerify: c.Bool(defs.OptionSkipCertVerify)}
167156

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

0 commit comments

Comments
 (0)