浏览代码

registry: remove tlsConfigForMirror()

This function was just a shallow wrapper around tlsConfig(), so remove
the abstraction.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Sebastiaan van Stijn 3 年之前
父节点
当前提交
afbeec8bda
共有 2 个文件被更改,包括 2 次插入6 次删除
  1. 1 5
      registry/service.go
  2. 1 1
      registry/service_v2.go

+ 1 - 5
registry/service.go

@@ -257,7 +257,7 @@ func (s *DefaultService) TLSConfig(hostname string) (*tls.Config, error) {
 	s.mu.Lock()
 	s.mu.Lock()
 	defer s.mu.Unlock()
 	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
 // tlsConfig constructs a client TLS configuration based on server defaults
@@ -265,10 +265,6 @@ func (s *DefaultService) tlsConfig(hostname string) (*tls.Config, error) {
 	return newTLSConfig(hostname, isSecureIndex(s.config, hostname))
 	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.
 // 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.
 // It gives preference to mirrors over the actual registry, and HTTPS over plain HTTP.
 func (s *DefaultService) LookupPullEndpoints(hostname string) (endpoints []APIEndpoint, err error) {
 func (s *DefaultService) LookupPullEndpoints(hostname string) (endpoints []APIEndpoint, err error) {

+ 1 - 1
registry/service_v2.go

@@ -18,7 +18,7 @@ func (s *DefaultService) lookupV2Endpoints(hostname string) (endpoints []APIEndp
 			if err != nil {
 			if err != nil {
 				return nil, err
 				return nil, err
 			}
 			}
-			mirrorTLSConfig, err := s.tlsConfigForMirror(mirrorURL)
+			mirrorTLSConfig, err := s.tlsConfig(mirrorURL.Host)
 			if err != nil {
 			if err != nil {
 				return nil, err
 				return nil, err
 			}
 			}