Skip to content

Commit

Permalink
Add lookup type override (#347)
Browse files Browse the repository at this point in the history
Instead of always auto-detecting, allow setting explicitly with `--lookup=host` or `--lookup=path`.

Fixes #346
  • Loading branch information
klauspost authored Nov 19, 2024
1 parent 82bbf69 commit 44b87b6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
9 changes: 7 additions & 2 deletions cli/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,17 @@ func getClient(ctx *cli.Context, host string) (*minio.Client, error) {
default:
fatal(probe.NewError(errors.New("unknown signature method. S3V2 and S3V4 is available")), strings.ToUpper(ctx.String("signature")))
}

lookup := minio.BucketLookupAuto
if ctx.String("lookup") == "host" {
lookup = minio.BucketLookupDNS
} else if ctx.String("lookup") == "path" {
lookup = minio.BucketLookupPath
}
cl, err := minio.New(host, &minio.Options{
Creds: creds,
Secure: ctx.Bool("tls"),
Region: ctx.String("region"),
BucketLookup: minio.BucketLookupAuto,
BucketLookup: lookup,
CustomMD5: md5simd.NewServer().NewHash,
Transport: clientTransport(ctx),
})
Expand Down
4 changes: 4 additions & 0 deletions cli/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,10 @@ var ioFlags = []cli.Flag{
Value: 0,
Usage: "Rate limit each instance to this number of requests per second (0 to disable)",
},
cli.StringFlag{
Name: "lookup",
Usage: "Force requests to be 'host' for host-style or 'path' for path-style lookup. Default will attempt autodetect based on remote host name.",
},
}

func getCommon(ctx *cli.Context, src func() generator.Source) bench.Common {
Expand Down

0 comments on commit 44b87b6

Please sign in to comment.