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

Function newTLSConfig

internal/registry/registry.go:35–49  ·  view source on GitHub ↗

newTLSConfig constructs a client TLS configuration based on server defaults

(ctx context.Context, hostname string, isSecure bool)

Source from the content-addressed store, hash-verified

33
34// newTLSConfig constructs a client TLS configuration based on server defaults
35func newTLSConfig(ctx context.Context, hostname string, isSecure bool) (*tls.Config, error) {
36 // PreferredServerCipherSuites should have no effect
37 tlsConfig := tlsconfig.ServerDefault()
38 tlsConfig.InsecureSkipVerify = !isSecure
39
40 if isSecure {
41 hostDir := hostCertsDir(hostname)
42 log.G(ctx).Debugf("hostDir: %s", hostDir)
43 if err := loadTLSConfig(ctx, hostDir, tlsConfig); err != nil {
44 return nil, err
45 }
46 }
47
48 return tlsConfig, nil
49}
50
51func hasFile(files []os.DirEntry, name string) bool {
52 for _, f := range files {

Callers 1

EndpointsMethod · 0.85

Calls 2

hostCertsDirFunction · 0.85
loadTLSConfigFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…