mirror of
https://github.com/minio/minio.git
synced 2025-11-20 01:50:24 -05:00
Use custom transport for remote targets (#12080)
This commit is contained in:
committed by
GitHub
parent
7a0a5bdc0d
commit
c9bf6007b4
29
cmd/utils.go
29
cmd/utils.go
@@ -26,6 +26,7 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
@@ -637,6 +638,34 @@ func newGatewayHTTPTransport(timeout time.Duration) *http.Transport {
|
||||
return tr
|
||||
}
|
||||
|
||||
// NewRemoteTargetHTTPTransport returns a new http configuration
|
||||
// used while communicating with the remote replication targets.
|
||||
func NewRemoteTargetHTTPTransport() *http.Transport {
|
||||
// For more details about various values used here refer
|
||||
// https://golang.org/pkg/net/http/#Transport documentation
|
||||
tr := &http.Transport{
|
||||
Proxy: http.ProxyFromEnvironment,
|
||||
DialContext: (&net.Dialer{
|
||||
Timeout: 15 * time.Second,
|
||||
KeepAlive: 30 * time.Second,
|
||||
}).DialContext,
|
||||
MaxIdleConnsPerHost: 1024,
|
||||
WriteBufferSize: 16 << 10, // 16KiB moving up from 4KiB default
|
||||
ReadBufferSize: 16 << 10, // 16KiB moving up from 4KiB default
|
||||
IdleConnTimeout: 15 * time.Second,
|
||||
TLSHandshakeTimeout: 5 * time.Second,
|
||||
ExpectContinueTimeout: 5 * time.Second,
|
||||
TLSClientConfig: &tls.Config{
|
||||
RootCAs: globalRootCAs,
|
||||
},
|
||||
// Go net/http automatically unzip if content-type is
|
||||
// gzip disable this feature, as we are always interested
|
||||
// in raw stream.
|
||||
DisableCompression: true,
|
||||
}
|
||||
return tr
|
||||
}
|
||||
|
||||
// Load the json (typically from disk file).
|
||||
func jsonLoad(r io.ReadSeeker, data interface{}) error {
|
||||
if _, err := r.Seek(0, io.SeekStart); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user