mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-12-27 11:27:56 +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
|
||
|
}
|