You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
350 B
18 lines
350 B
package client
|
|
|
|
import (
|
|
"net"
|
|
"time"
|
|
)
|
|
|
|
type HttpClientOpt = func(clientCfg *HTTPClient)
|
|
|
|
func AddDialContext(httpClient *HTTPClient) {
|
|
dialContext := (&net.Dialer{
|
|
Timeout: 10 * time.Second,
|
|
KeepAlive: 10 * time.Second,
|
|
}).DialContext
|
|
|
|
httpClient.Transport.DialContext = dialContext
|
|
httpClient.Client.Transport = httpClient.Transport
|
|
}
|