MCPcopy Create free account
hub / github.com/docker/cli / Endpoints

Method Endpoints

internal/registry/service_v2.go:10–37  ·  view source on GitHub ↗
(ctx context.Context, hostname string)

Source from the content-addressed store, hash-verified

8)
9
10func (s *Service) Endpoints(ctx context.Context, hostname string) ([]APIEndpoint, error) {
11 if hostname == DefaultNamespace || hostname == IndexHostname {
12 return []APIEndpoint{{
13 URL: DefaultV2Registry,
14 TLSConfig: tlsconfig.ServerDefault(),
15 }}, nil
16 }
17
18 tlsConfig, err := newTLSConfig(ctx, hostname, s.config.isSecureIndex(hostname))
19 if err != nil {
20 return nil, err
21 }
22
23 endpoints := []APIEndpoint{{
24 URL: &url.URL{Scheme: "https", Host: hostname},
25 TLSConfig: tlsConfig,
26 }}
27
28 if tlsConfig.InsecureSkipVerify {
29 endpoints = append(endpoints, APIEndpoint{
30 URL: &url.URL{Scheme: "http", Host: hostname},
31 // used to check if supposed to be secure via InsecureSkipVerify
32 TLSConfig: tlsConfig,
33 })
34 }
35
36 return endpoints, nil
37}

Callers 3

AuthMethod · 0.95
allEndpointsFunction · 0.95
getDefaultEndpointFunction · 0.95

Calls 2

newTLSConfigFunction · 0.85
isSecureIndexMethod · 0.80

Tested by

no test coverage detected