diff options
author | Sebastiaan van Stijn <thaJeztah@users.noreply.github.com> | 2022-03-18 19:35:02 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-18 19:35:02 +0100 |
commit | d5d5f258dfc95c46ed1e62953a754b7cf3edecd3 (patch) | |
tree | 8f10fb283883e0daf670658c3d6d29ce04b84ee2 /registry/service.go | |
parent | b7a72435a6ec7d7c8306ee356529a505548e8488 (diff) | |
parent | 5e9829b75d4d57a49d1cbe17ccc6bf73b4a18fed (diff) | |
download | docker-d5d5f258dfc95c46ed1e62953a754b7cf3edecd3.tar.gz |
Merge pull request #43394 from thaJeztah/cleanup_registry_step2
registry: remove more dead code
Diffstat (limited to 'registry/service.go')
-rw-r--r-- | registry/service.go | 35 |
1 files changed, 9 insertions, 26 deletions
diff --git a/registry/service.go b/registry/service.go index 4b38349de6..25b116a279 100644 --- a/registry/service.go +++ b/registry/service.go @@ -24,7 +24,6 @@ type Service interface { ResolveRepository(name reference.Named) (*RepositoryInfo, error) Search(ctx context.Context, term string, limit int, authConfig *types.AuthConfig, userAgent string, headers map[string][]string) (*registry.SearchResults, error) ServiceConfig() *registry.ServiceConfig - TLSConfig(hostname string) (*tls.Config, error) LoadAllowNondistributableArtifacts([]string) error LoadMirrors([]string) error LoadInsecureRegistries([]string) error @@ -171,23 +170,16 @@ func (s *defaultService) Search(ctx context.Context, term string, limit int, aut modifiers := Headers(userAgent, nil) v2Client, err := v2AuthHTTPClient(endpoint.URL, endpoint.client.Transport, modifiers, creds, scopes) if err != nil { - if fErr, ok := err.(fallbackError); ok { - logrus.WithError(fErr.err).Error("cannot use identity token for search, v2 auth not supported") - } else { - return nil, err - } - } else { - // Copy non transport http client features - v2Client.Timeout = endpoint.client.Timeout - v2Client.CheckRedirect = endpoint.client.CheckRedirect - v2Client.Jar = endpoint.client.Jar - - logrus.Debugf("using v2 client for search to %s", endpoint.URL) - client = v2Client + return nil, err } - } - - if client == nil { + // Copy non transport http client features + v2Client.Timeout = endpoint.client.Timeout + v2Client.CheckRedirect = endpoint.client.CheckRedirect + v2Client.Jar = endpoint.client.Jar + + logrus.Debugf("using v2 client for search to %s", endpoint.URL) + client = v2Client + } else { client = endpoint.client if err := authorizeClient(client, authConfig, endpoint); err != nil { return nil, err @@ -216,15 +208,6 @@ type APIEndpoint struct { TLSConfig *tls.Config } -// TLSConfig constructs a client TLS configuration based on server defaults -func (s *defaultService) TLSConfig(hostname string) (*tls.Config, error) { - s.mu.RLock() - secure := s.config.isSecureIndex(hostname) - s.mu.RUnlock() - - return newTLSConfig(hostname, secure) -} - // LookupPullEndpoints creates a list of v2 endpoints to try to pull from, in order of preference. // It gives preference to mirrors over the actual registry, and HTTPS over plain HTTP. func (s *defaultService) LookupPullEndpoints(hostname string) (endpoints []APIEndpoint, err error) { |