diff --git a/src/restic/backend/s3/s3.go b/src/restic/backend/s3/s3.go index 18f84ae70..29aad24a9 100644 --- a/src/restic/backend/s3/s3.go +++ b/src/restic/backend/s3/s3.go @@ -3,9 +3,12 @@ package s3 import ( "bytes" "io" + "net" + "net/http" "path" "restic" "strings" + "time" "restic/backend" "restic/errors" @@ -36,6 +39,21 @@ func Open(cfg Config) (restic.Backend, error) { } be := &s3{client: client, bucketname: cfg.Bucket, prefix: cfg.Prefix} + + t := &http.Transport{ + Proxy: http.ProxyFromEnvironment, + DialContext: (&net.Dialer{ + Timeout: 30 * time.Second, + KeepAlive: 30 * time.Second, + }).DialContext, + MaxIdleConns: 100, + MaxIdleConnsPerHost: 30, + IdleConnTimeout: 90 * time.Second, + TLSHandshakeTimeout: 10 * time.Second, + ExpectContinueTimeout: 1 * time.Second, + } + client.SetCustomTransport(t) + be.createConnections() found, err := client.BucketExists(cfg.Bucket)