2018-02-05 16:05:59 -05:00
|
|
|
package registry // import "github.com/docker/docker/registry"
|
2015-09-16 13:42:17 -04:00
|
|
|
|
2016-11-05 18:53:11 -04:00
|
|
|
import "net/url"
|
2015-09-16 13:42:17 -04:00
|
|
|
|
2016-05-21 10:00:28 -04:00
|
|
|
func (s *DefaultService) lookupV1Endpoints(hostname string) (endpoints []APIEndpoint, err error) {
|
2016-11-05 18:53:11 -04:00
|
|
|
if hostname == DefaultNamespace || hostname == DefaultV2Registry.Host || hostname == IndexHostname {
|
|
|
|
return []APIEndpoint{}, nil
|
2015-09-16 13:42:17 -04:00
|
|
|
}
|
|
|
|
|
2016-11-05 18:53:11 -04:00
|
|
|
tlsConfig, err := s.tlsConfig(hostname)
|
2015-09-16 13:42:17 -04:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
endpoints = []APIEndpoint{
|
|
|
|
{
|
2016-02-17 19:53:25 -05:00
|
|
|
URL: &url.URL{
|
|
|
|
Scheme: "https",
|
|
|
|
Host: hostname,
|
|
|
|
},
|
2015-09-16 13:42:17 -04:00
|
|
|
Version: APIVersion1,
|
|
|
|
TrimHostname: true,
|
|
|
|
TLSConfig: tlsConfig,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
if tlsConfig.InsecureSkipVerify {
|
|
|
|
endpoints = append(endpoints, APIEndpoint{ // or this
|
2016-02-17 19:53:25 -05:00
|
|
|
URL: &url.URL{
|
|
|
|
Scheme: "http",
|
|
|
|
Host: hostname,
|
|
|
|
},
|
2015-09-16 13:42:17 -04:00
|
|
|
Version: APIVersion1,
|
|
|
|
TrimHostname: true,
|
|
|
|
// used to check if supposed to be secure via InsecureSkipVerify
|
|
|
|
TLSConfig: tlsConfig,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
return endpoints, nil
|
|
|
|
}
|