(repoName reference.Named, insecure bool)
| 44 | } |
| 45 | |
| 46 | func getDefaultEndpoint(repoName reference.Named, insecure bool) (registry.APIEndpoint, error) { |
| 47 | registryService, err := registry.NewService(registry.ServiceOptions{}) |
| 48 | if err != nil { |
| 49 | return registry.APIEndpoint{}, err |
| 50 | } |
| 51 | endpoints, err := registryService.Endpoints(context.TODO(), reference.Domain(repoName)) |
| 52 | if err != nil { |
| 53 | return registry.APIEndpoint{}, err |
| 54 | } |
| 55 | // Default to the highest priority endpoint to return |
| 56 | endpoint := endpoints[0] |
| 57 | if insecure { |
| 58 | for _, ep := range endpoints { |
| 59 | if ep.URL.Scheme == "http" { |
| 60 | endpoint = ep |
| 61 | } |
| 62 | } |
| 63 | } |
| 64 | return endpoint, nil |
| 65 | } |
| 66 | |
| 67 | // getHTTPTransport builds a transport for use in communicating with a registry |
| 68 | func getHTTPTransport(authConfig registrytypes.AuthConfig, endpoint registry.APIEndpoint, repoName, userAgent string, actions []string) (http.RoundTripper, error) { |
no test coverage detected
searching dependent graphs…