|
|
@ -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, |
|
|
|
TLSHandshakeTimeout: 10 * time.Second, |
|
|
|
IdleConnTimeout: 90 * time.Second, |
|
|
|
DisableKeepAlives: false, |
|
|
|
TLSHandshakeTimeout: 10 * time.Second, |
|
|
|
MaxIdleConnsPerHost: 1, |
|
|
|
ExpectContinueTimeout: 1 * time.Second, |
|
|
|
|
|
|
|
MaxIdleConnsPerHost: runtime.GOMAXPROCS(0) + 1, |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
return transport |
|
|
|
return transport |
|
|
|
} |
|
|
|
} |
|
|
|