From 54a76e8c4562f6b73c0b684c629b1f5786a8ff6f Mon Sep 17 00:00:00 2001 From: Nicola Murino Date: Sat, 5 Aug 2023 11:58:01 +0200 Subject: [PATCH] s3: remove usage of the now deprecated EndpointResolver Signed-off-by: Nicola Murino --- go.mod | 6 +++--- go.sum | 7 ++++--- internal/vfs/s3fs.go | 16 ++++------------ 3 files changed, 11 insertions(+), 18 deletions(-) diff --git a/go.mod b/go.mod index ec954fa5..ad5a57f7 100644 --- a/go.mod +++ b/go.mod @@ -68,9 +68,9 @@ require ( go.etcd.io/bbolt v1.3.7 go.uber.org/automaxprocs v1.5.3 gocloud.dev v0.33.0 - golang.org/x/crypto v0.11.0 - golang.org/x/net v0.13.0 - golang.org/x/oauth2 v0.10.0 + golang.org/x/crypto v0.12.0 + golang.org/x/net v0.14.0 + golang.org/x/oauth2 v0.11.0 golang.org/x/sys v0.11.0 golang.org/x/term v0.11.0 golang.org/x/time v0.3.0 diff --git a/go.sum b/go.sum index 3f4819e3..b4fc23e0 100644 --- a/go.sum +++ b/go.sum @@ -567,8 +567,9 @@ golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.13.0 h1:Nvo8UFsZ8X3BhAC9699Z1j7XQ3rsZnUUm7jfBEk1ueY= golang.org/x/net v0.13.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= +golang.org/x/net v0.14.0 h1:BONx9s002vGdD9umnlX1Po8vOZmrgH34qlHcD1MfK14= +golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -578,8 +579,8 @@ golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.10.0 h1:zHCpF2Khkwy4mMB4bv0U37YtJdTGW8jI0glAApi0Kh8= -golang.org/x/oauth2 v0.10.0/go.mod h1:kTpgurOux7LqtuxjuyZa4Gj2gdezIt/jQtGnNFfypQI= +golang.org/x/oauth2 v0.11.0 h1:vPL4xzxBM4niKCW6g9whtaWVXTJf1U5e4aZxxFx/gbU= +golang.org/x/oauth2 v0.11.0/go.mod h1:LdF7O/8bLR/qWK9DrpXmbHLTouvRHK0SgJl0GmDBchk= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= diff --git a/internal/vfs/s3fs.go b/internal/vfs/s3fs.go index fc86b389..1a53ce80 100644 --- a/internal/vfs/s3fs.go +++ b/internal/vfs/s3fs.go @@ -115,18 +115,6 @@ func NewS3Fs(connectionID, localTempDir, mountPath string, s3Config S3FsConfig) awsConfig.Credentials = aws.NewCredentialsCache( credentials.NewStaticCredentialsProvider(fs.config.AccessKey, fs.config.AccessSecret.GetPayload(), "")) } - if fs.config.Endpoint != "" { - endpointResolver := aws.EndpointResolverWithOptionsFunc(func(service, region string, options ...any) (aws.Endpoint, error) { - return aws.Endpoint{ - URL: fs.config.Endpoint, - HostnameImmutable: fs.config.ForcePathStyle, - PartitionID: "aws", - SigningRegion: fs.config.Region, - Source: aws.EndpointSourceCustom, - }, nil - }) - awsConfig.EndpointResolverWithOptions = endpointResolver - } fs.setConfigDefaults() @@ -136,7 +124,11 @@ func NewS3Fs(connectionID, localTempDir, mountPath string, s3Config S3FsConfig) awsConfig.Credentials = creds } fs.svc = s3.NewFromConfig(awsConfig, func(o *s3.Options) { + o.AppID = fmt.Sprintf("SFTPGo-%s", version.Get().CommitHash) o.UsePathStyle = fs.config.ForcePathStyle + if fs.config.Endpoint != "" { + o.BaseEndpoint = aws.String(fs.config.Endpoint) + } }) return fs, nil }