forked from TrueCloudLab/rclone
s3: suppport S3 Accelerated endpoints with --s3-use-accelerate-endpoint
Fixes #3123
This commit is contained in:
parent
d04b0b856a
commit
b68c3ce74d
1 changed files with 31 additions and 21 deletions
|
@ -732,6 +732,14 @@ If it is set then rclone will use v2 authentication.
|
||||||
Use this only if v4 signatures don't work, eg pre Jewel/v10 CEPH.`,
|
Use this only if v4 signatures don't work, eg pre Jewel/v10 CEPH.`,
|
||||||
Default: false,
|
Default: false,
|
||||||
Advanced: true,
|
Advanced: true,
|
||||||
|
}, {
|
||||||
|
Name: "use_accelerate_endpoint",
|
||||||
|
Provider: "AWS",
|
||||||
|
Help: `If true use the AWS S3 accelerated endpoint.
|
||||||
|
|
||||||
|
See: [AWS S3 Transfer acceleration](https://docs.aws.amazon.com/AmazonS3/latest/dev/transfer-acceleration-examples.html)`,
|
||||||
|
Default: false,
|
||||||
|
Advanced: true,
|
||||||
}},
|
}},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -771,6 +779,7 @@ type Options struct {
|
||||||
UploadConcurrency int `config:"upload_concurrency"`
|
UploadConcurrency int `config:"upload_concurrency"`
|
||||||
ForcePathStyle bool `config:"force_path_style"`
|
ForcePathStyle bool `config:"force_path_style"`
|
||||||
V2Auth bool `config:"v2_auth"`
|
V2Auth bool `config:"v2_auth"`
|
||||||
|
UseAccelerateEndpoint bool `config:"use_accelerate_endpoint"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fs represents a remote s3 server
|
// Fs represents a remote s3 server
|
||||||
|
@ -944,14 +953,15 @@ func s3Connection(opt *Options) (*s3.S3, *session.Session, error) {
|
||||||
if opt.Region == "" {
|
if opt.Region == "" {
|
||||||
opt.Region = "us-east-1"
|
opt.Region = "us-east-1"
|
||||||
}
|
}
|
||||||
if opt.Provider == "Alibaba" || opt.Provider == "Netease" {
|
if opt.Provider == "Alibaba" || opt.Provider == "Netease" || opt.UseAccelerateEndpoint {
|
||||||
opt.ForcePathStyle = false
|
opt.ForcePathStyle = false
|
||||||
}
|
}
|
||||||
awsConfig := aws.NewConfig().
|
awsConfig := aws.NewConfig().
|
||||||
WithMaxRetries(maxRetries).
|
WithMaxRetries(maxRetries).
|
||||||
WithCredentials(cred).
|
WithCredentials(cred).
|
||||||
WithHTTPClient(fshttp.NewClient(fs.Config)).
|
WithHTTPClient(fshttp.NewClient(fs.Config)).
|
||||||
WithS3ForcePathStyle(opt.ForcePathStyle)
|
WithS3ForcePathStyle(opt.ForcePathStyle).
|
||||||
|
WithS3UseAccelerate(opt.UseAccelerateEndpoint)
|
||||||
if opt.Region != "" {
|
if opt.Region != "" {
|
||||||
awsConfig.WithRegion(opt.Region)
|
awsConfig.WithRegion(opt.Region)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue