|
|
|
@ -3,7 +3,6 @@ package cleanhttp
|
|
|
|
|
import ( |
|
|
|
|
"net" |
|
|
|
|
"net/http" |
|
|
|
|
"runtime" |
|
|
|
|
"time" |
|
|
|
|
) |
|
|
|
|
|
|
|
|
@ -23,15 +22,13 @@ func DefaultTransport() *http.Transport {
|
|
|
|
|
func DefaultPooledTransport() *http.Transport { |
|
|
|
|
transport := &http.Transport{ |
|
|
|
|
Proxy: http.ProxyFromEnvironment, |
|
|
|
|
DialContext: (&net.Dialer{ |
|
|
|
|
Dial: (&net.Dialer{ |
|
|
|
|
Timeout: 30 * time.Second, |
|
|
|
|
KeepAlive: 30 * time.Second, |
|
|
|
|
}).DialContext, |
|
|
|
|
MaxIdleConns: 100, |
|
|
|
|
IdleConnTimeout: 90 * time.Second, |
|
|
|
|
TLSHandshakeTimeout: 10 * time.Second, |
|
|
|
|
ExpectContinueTimeout: 1 * time.Second, |
|
|
|
|
MaxIdleConnsPerHost: runtime.GOMAXPROCS(0) + 1, |
|
|
|
|
}).Dial, |
|
|
|
|
TLSHandshakeTimeout: 10 * time.Second, |
|
|
|
|
DisableKeepAlives: false, |
|
|
|
|
MaxIdleConnsPerHost: 1, |
|
|
|
|
} |
|
|
|
|
return transport |
|
|
|
|
} |
|
|
|
|