Skip to content

Commit

Permalink
clairctl: use a better user-agent
Browse files Browse the repository at this point in the history
Signed-off-by: Hank Donnay <hdonnay@redhat.com>
  • Loading branch information
hdonnay committed Jan 10, 2023
1 parent 25ac033 commit a367a7a
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions cmd/clairctl/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,12 @@ import (
"github.com/quay/zlog"
"github.com/tomnomnom/linkheader"

"github.com/quay/clair/v4/cmd"
"github.com/quay/clair/v4/httptransport"
"github.com/quay/clair/v4/internal/codec"
"github.com/quay/clair/v4/internal/httputil"
)

const (
userAgent = `clairctl/1`
)

var (
rtMu sync.Mutex
rtMap = map[string]http.RoundTripper{}
Expand All @@ -50,7 +47,7 @@ func rt(ctx context.Context, ref string) (http.RoundTripper, error) {
return nil, err
}
rt := http.DefaultTransport
rt = transport.NewUserAgent(rt, userAgent)
rt = transport.NewUserAgent(rt, `clairctl/`+cmd.Version)
rt = transport.NewRetry(rt)
rt, err = transport.NewWithContext(ctx, repo.Registry, auth, rt, []string{repo.Scope(transport.PullScope)})
if err != nil {
Expand Down

0 comments on commit a367a7a

Please sign in to comment.