mirror of
https://github.com/Luzifer/yaml-vault.git
synced 2024-12-21 12:31:16 +00:00
29 lines
630 B
Go
29 lines
630 B
Go
|
package cleanhttp
|
||
|
|
||
|
import (
|
||
|
"net"
|
||
|
"net/http"
|
||
|
"time"
|
||
|
)
|
||
|
|
||
|
// DefaultTransport returns a new http.Transport with the same default values
|
||
|
// as http.DefaultTransport
|
||
|
func DefaultTransport() *http.Transport {
|
||
|
return &http.Transport{
|
||
|
Proxy: http.ProxyFromEnvironment,
|
||
|
Dial: (&net.Dialer{
|
||
|
Timeout: 30 * time.Second,
|
||
|
KeepAlive: 30 * time.Second,
|
||
|
}).Dial,
|
||
|
TLSHandshakeTimeout: 10 * time.Second,
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// DefaultClient returns a new http.Client with the same default values as
|
||
|
// http.Client, but with a non-shared Transport
|
||
|
func DefaultClient() *http.Client {
|
||
|
return &http.Client{
|
||
|
Transport: DefaultTransport(),
|
||
|
}
|
||
|
}
|