1
0
spegling av https://github.com/therootcompany/golib.git synced 2025-07-06 20:06:33 +00:00
golib/https/https.go
2021-03-10 16:58:54 -07:00

23 rader
403 B
Go

package https
import (
"net"
"net/http"
"time"
)
// NewHTTPClient creates a new http client with reasonable and safe defaults
func NewHTTPClient() *http.Client {
transport := &http.Transport{
Dial: (&net.Dialer{
Timeout: 10 * time.Second,
}).Dial,
TLSHandshakeTimeout: 5 * time.Second,
}
client := &http.Client{
Timeout: time.Second * 5,
Transport: transport,
}
return client
}