registry/service_v1.go
39f2f15a
 package registry
 
7ffb4ad8
 import "net/url"
39f2f15a
 
636c276f
 func (s *DefaultService) lookupV1Endpoints(hostname string) (endpoints []APIEndpoint, err error) {
7ffb4ad8
 	if hostname == DefaultNamespace || hostname == DefaultV2Registry.Host || hostname == IndexHostname {
 		return []APIEndpoint{}, nil
39f2f15a
 	}
 
7ffb4ad8
 	tlsConfig, err := s.tlsConfig(hostname)
39f2f15a
 	if err != nil {
 		return nil, err
 	}
 
 	endpoints = []APIEndpoint{
 		{
79db131a
 			URL: &url.URL{
 				Scheme: "https",
 				Host:   hostname,
 			},
39f2f15a
 			Version:      APIVersion1,
 			TrimHostname: true,
 			TLSConfig:    tlsConfig,
 		},
 	}
 
 	if tlsConfig.InsecureSkipVerify {
 		endpoints = append(endpoints, APIEndpoint{ // or this
79db131a
 			URL: &url.URL{
 				Scheme: "http",
 				Host:   hostname,
 			},
39f2f15a
 			Version:      APIVersion1,
 			TrimHostname: true,
 			// used to check if supposed to be secure via InsecureSkipVerify
 			TLSConfig: tlsConfig,
 		})
 	}
 	return endpoints, nil
 }