mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2024-11-22 03:36:39 +00:00
[chore] move dialer inside new (#715)
* move dialer inside new, use default resolver * instantiate resolver
This commit is contained in:
parent
b326bf45a9
commit
ab03318b7a
|
@ -37,13 +37,6 @@
|
|||
// ErrBodyTooLarge is returned when a received response body is above predefined limit (default 40MB).
|
||||
var ErrBodyTooLarge = errors.New("body size too large")
|
||||
|
||||
// dialer is the base net.Dialer used by all package-created http.Transports.
|
||||
var dialer = &net.Dialer{
|
||||
Timeout: 30 * time.Second,
|
||||
KeepAlive: 30 * time.Second,
|
||||
Resolver: &net.Resolver{Dial: nil},
|
||||
}
|
||||
|
||||
// Config provides configuration details for setting up a new
|
||||
// instance of httpclient.Client{}. Within are a subset of the
|
||||
// configuration values passed to initialized http.Transport{}
|
||||
|
@ -95,8 +88,11 @@ type Client struct {
|
|||
func New(cfg Config) *Client {
|
||||
var c Client
|
||||
|
||||
// Copy global
|
||||
d := dialer
|
||||
d := &net.Dialer{
|
||||
Timeout: 30 * time.Second,
|
||||
KeepAlive: 30 * time.Second,
|
||||
Resolver: &net.Resolver{},
|
||||
}
|
||||
|
||||
if cfg.MaxOpenConns <= 0 {
|
||||
// By default base this value on GOMAXPROCS.
|
||||
|
|
Loading…
Reference in a new issue