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