mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-12-19 21:47:50 +08:00
19 lines
350 B
Go
19 lines
350 B
Go
|
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
|
||
|
}
|