Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add goofys as user agent for s3 request #698

Merged
merged 2 commits into from
Nov 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions internal/backend_s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ func (s *S3Backend) newS3() {
s.setV2Signer(&s.S3.Handlers)
}
s.S3.Handlers.Sign.PushBack(addAcceptEncoding)
s.S3.Handlers.Build.PushFrontNamed(request.NamedHandler{
Name: "UserAgentHandler",
Fn: request.MakeAddToUserAgentHandler("goofys", VersionNumber+"-"+VersionHash),
})
}

func (s *S3Backend) detectBucketLocationByHEAD() (err error, isAws bool) {
Expand Down
3 changes: 2 additions & 1 deletion internal/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ COPYRIGHT:
`
}

var VersionNumber string
var VersionHash string

func NewApp() (app *cli.App) {
Expand All @@ -86,7 +87,7 @@ func NewApp() (app *cli.App) {

app = &cli.App{
Name: "goofys",
Version: "0.24.0-" + VersionHash,
Version: VersionNumber + "-" + VersionHash,
Usage: "Mount an S3 bucket locally",
HideHelp: true,
Writer: os.Stderr,
Expand Down
1 change: 1 addition & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ func massageArg0() {
var Version = "use `make build' to fill version hash correctly"

func main() {
VersionNumber = "0.24.0"
VersionHash = Version

massagePath()
Expand Down