From 894773012427edd14502bbf166f10d70488117d6 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Fri, 18 Mar 2022 13:52:20 +0100 Subject: [PATCH] registry: un-export AuthTransport() It's only used internally for v1 search Signed-off-by: Sebastiaan van Stijn --- registry/registry_test.go | 2 +- registry/session.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/registry/registry_test.go b/registry/registry_test.go index e0f29404e6..7c3a4e16c3 100644 --- a/registry/registry_test.go +++ b/registry/registry_test.go @@ -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 { diff --git a/registry/session.go b/registry/session.go index bf222e43e8..f1204215b8 100644 --- a/registry/session.go +++ b/registry/session.go @@ -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. // @@ -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 } @@ -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 {