Skip to content

Commit

Permalink
registry: un-export AuthTransport()
Browse files Browse the repository at this point in the history
It's only used internally for v1 search

Signed-off-by: Sebastiaan van Stijn <[email protected]>
  • Loading branch information
thaJeztah committed Mar 18, 2022
1 parent 2f466a9 commit 8947730
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion registry/registry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func spawnTestRegistrySession(t *testing.T) *session {
}
userAgent := "docker test client"
var tr http.RoundTripper = debugTransport{newTransport(nil), t.Log}
tr = transport.NewTransport(AuthTransport(tr, authConfig, false), Headers(userAgent, nil)...)
tr = transport.NewTransport(newAuthTransport(tr, authConfig, false), Headers(userAgent, nil)...)
client := httpClient(tr)

if err := authorizeClient(client, authConfig, endpoint); err != nil {
Expand Down
6 changes: 3 additions & 3 deletions registry/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ type authTransport struct {
modReq map[*http.Request]*http.Request // original -> modified
}

// AuthTransport handles the auth layer when communicating with a v1 registry (private or official)
// newAuthTransport handles the auth layer when communicating with a v1 registry (private or official)
//
// For private v1 registries, set alwaysSetBasicAuth to true.
//
Expand All @@ -52,7 +52,7 @@ type authTransport struct {
// If the server sends a token without the client having requested it, it is ignored.
//
// This RoundTripper also has a CancelRequest method important for correct timeout handling.
func AuthTransport(base http.RoundTripper, authConfig *types.AuthConfig, alwaysSetBasicAuth bool) http.RoundTripper {
func newAuthTransport(base http.RoundTripper, authConfig *types.AuthConfig, alwaysSetBasicAuth bool) *authTransport {
if base == nil {
base = http.DefaultTransport
}
Expand Down Expand Up @@ -165,7 +165,7 @@ func authorizeClient(client *http.Client, authConfig *types.AuthConfig, endpoint

// Annotate the transport unconditionally so that v2 can
// properly fallback on v1 when an image is not found.
client.Transport = AuthTransport(client.Transport, authConfig, alwaysSetBasicAuth)
client.Transport = newAuthTransport(client.Transport, authConfig, alwaysSetBasicAuth)

jar, err := cookiejar.New(nil)
if err != nil {
Expand Down

0 comments on commit 8947730

Please sign in to comment.