mirror of
https://github.com/minio/minio.git
synced 2025-11-09 21:49:46 -05:00
Convert gateways into respective packages (#5200)
- Make azure gateway a package - Make b2 gateway a package - Make gcs gateway a package - Make s3 gateway a package - Make sia gateway a package
This commit is contained in:
committed by
Dee Koder
parent
52e382b697
commit
eb2894233c
32
cmd/utils.go
32
cmd/utils.go
@@ -18,12 +18,14 @@ package cmd
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"crypto/tls"
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"encoding/xml"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
@@ -212,13 +214,13 @@ func UTCNow() time.Time {
|
||||
return time.Now().UTC()
|
||||
}
|
||||
|
||||
// genETag - generate UUID based ETag
|
||||
func genETag() string {
|
||||
return toS3ETag(getMD5Hash([]byte(mustGetUUID())))
|
||||
// GenETag - generate UUID based ETag
|
||||
func GenETag() string {
|
||||
return ToS3ETag(getMD5Hash([]byte(mustGetUUID())))
|
||||
}
|
||||
|
||||
// toS3ETag - return checksum to ETag
|
||||
func toS3ETag(etag string) string {
|
||||
// ToS3ETag - return checksum to ETag
|
||||
func ToS3ETag(etag string) string {
|
||||
etag = canonicalizeETag(etag)
|
||||
|
||||
if !strings.HasSuffix(etag, "-1") {
|
||||
@@ -229,3 +231,23 @@ func toS3ETag(etag string) string {
|
||||
|
||||
return etag
|
||||
}
|
||||
|
||||
// NewCustomHTTPTransport returns a new http configuration
|
||||
// used while communicating with the cloud backends.
|
||||
// This sets the value for MaxIdleConns from 2 (go default) to
|
||||
// 100.
|
||||
func NewCustomHTTPTransport() http.RoundTripper {
|
||||
return &http.Transport{
|
||||
Proxy: http.ProxyFromEnvironment,
|
||||
DialContext: (&net.Dialer{
|
||||
Timeout: 30 * time.Second,
|
||||
KeepAlive: 30 * time.Second,
|
||||
}).DialContext,
|
||||
MaxIdleConns: 100,
|
||||
IdleConnTimeout: 90 * time.Second,
|
||||
TLSHandshakeTimeout: 10 * time.Second,
|
||||
ExpectContinueTimeout: 1 * time.Second,
|
||||
TLSClientConfig: &tls.Config{RootCAs: globalRootCAs},
|
||||
DisableCompression: true,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user