Skip to content

Commit

Permalink
registry: remove tlsConfigForMirror()
Browse files Browse the repository at this point in the history
This function was just a shallow wrapper around tlsConfig(), so remove
the abstraction.

Signed-off-by: Sebastiaan van Stijn <[email protected]>
  • Loading branch information
thaJeztah committed Oct 5, 2021
1 parent 306fa44 commit afbeec8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
6 changes: 1 addition & 5 deletions registry/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,18 +257,14 @@ func (s *DefaultService) TLSConfig(hostname string) (*tls.Config, error) {
s.mu.Lock()
defer s.mu.Unlock()

return newTLSConfig(hostname, isSecureIndex(s.config, hostname))
return s.tlsConfig(hostname)
}

// tlsConfig constructs a client TLS configuration based on server defaults
func (s *DefaultService) tlsConfig(hostname string) (*tls.Config, error) {
return newTLSConfig(hostname, isSecureIndex(s.config, hostname))
}

func (s *DefaultService) tlsConfigForMirror(mirrorURL *url.URL) (*tls.Config, error) {
return s.tlsConfig(mirrorURL.Host)
}

// 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) {
Expand Down
2 changes: 1 addition & 1 deletion registry/service_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func (s *DefaultService) lookupV2Endpoints(hostname string) (endpoints []APIEndp
if err != nil {
return nil, err
}
mirrorTLSConfig, err := s.tlsConfigForMirror(mirrorURL)
mirrorTLSConfig, err := s.tlsConfig(mirrorURL.Host)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit afbeec8

Please sign in to comment.