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

Method isSecureIndex

internal/registry/config.go:172–180  ·  view source on GitHub ↗

isSecureIndex returns false if the provided indexName is part of the list of insecure registries Insecure registries accept HTTP and/or accept HTTPS with certificates from unknown CAs. The list of insecure registries can contain an element with CIDR notation to specify a whole subnet. If the subnet

(indexName string)

Source from the content-addressed store, hash-verified

170// in a subnet. If the resolving is not successful, isSecureIndex will only try to match hostname to any element
171// of insecureRegistries.
172func (config *serviceConfig) isSecureIndex(indexName string) bool {
173 // Check for configured index, first. This is needed in case isSecureIndex
174 // is called from anything besides newIndexInfo, in order to honor per-index configurations.
175 if index, ok := config.indexConfigs[indexName]; ok {
176 return index.Secure
177 }
178
179 return !isCIDRMatch(config.insecureRegistryCIDRs, indexName)
180}
181
182// for mocking in unit tests.
183var lookupIP = net.LookupIP

Callers 1

EndpointsMethod · 0.80

Calls 1

isCIDRMatchFunction · 0.85

Tested by

no test coverage detected