github.com/duglin/docker@v1.13.1/registry/service_v1.go (about)

     1  package registry
     2  
     3  import "net/url"
     4  
     5  func (s *DefaultService) lookupV1Endpoints(hostname string) (endpoints []APIEndpoint, err error) {
     6  	if hostname == DefaultNamespace || hostname == DefaultV2Registry.Host || hostname == IndexHostname {
     7  		return []APIEndpoint{}, nil
     8  	}
     9  
    10  	tlsConfig, err := s.tlsConfig(hostname)
    11  	if err != nil {
    12  		return nil, err
    13  	}
    14  
    15  	endpoints = []APIEndpoint{
    16  		{
    17  			URL: &url.URL{
    18  				Scheme: "https",
    19  				Host:   hostname,
    20  			},
    21  			Version:      APIVersion1,
    22  			TrimHostname: true,
    23  			TLSConfig:    tlsConfig,
    24  		},
    25  	}
    26  
    27  	if tlsConfig.InsecureSkipVerify {
    28  		endpoints = append(endpoints, APIEndpoint{ // or this
    29  			URL: &url.URL{
    30  				Scheme: "http",
    31  				Host:   hostname,
    32  			},
    33  			Version:      APIVersion1,
    34  			TrimHostname: true,
    35  			// used to check if supposed to be secure via InsecureSkipVerify
    36  			TLSConfig: tlsConfig,
    37  		})
    38  	}
    39  	return endpoints, nil
    40  }