7ffb4ad81a
All images in the default registry (AKA docker.io, index.docker.io, and registry-1.docker.io) are available via the v2 protocol, so there's no reason to use the v1 protocol. Disabling it prevents useless fallbacks. Signed-off-by: Noah Treuhaft <noah.treuhaft@docker.com>
40 lines
876 B
Go
40 lines
876 B
Go
package registry
|
|
|
|
import "net/url"
|
|
|
|
func (s *DefaultService) lookupV1Endpoints(hostname string) (endpoints []APIEndpoint, err error) {
|
|
if hostname == DefaultNamespace || hostname == DefaultV2Registry.Host || hostname == IndexHostname {
|
|
return []APIEndpoint{}, nil
|
|
}
|
|
|
|
tlsConfig, err := s.tlsConfig(hostname)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
endpoints = []APIEndpoint{
|
|
{
|
|
URL: &url.URL{
|
|
Scheme: "https",
|
|
Host: hostname,
|
|
},
|
|
Version: APIVersion1,
|
|
TrimHostname: true,
|
|
TLSConfig: tlsConfig,
|
|
},
|
|
}
|
|
|
|
if tlsConfig.InsecureSkipVerify {
|
|
endpoints = append(endpoints, APIEndpoint{ // or this
|
|
URL: &url.URL{
|
|
Scheme: "http",
|
|
Host: hostname,
|
|
},
|
|
Version: APIVersion1,
|
|
TrimHostname: true,
|
|
// used to check if supposed to be secure via InsecureSkipVerify
|
|
TLSConfig: tlsConfig,
|
|
})
|
|
}
|
|
return endpoints, nil
|
|
}
|