MCPcopy
hub / github.com/containerd/containerd / tlsServer

Function tlsServer

core/remotes/docker/resolver_test.go:1038–1061  ·  view source on GitHub ↗
(h http.Handler)

Source from the content-addressed store, hash-verified

1036}
1037
1038func tlsServer(h http.Handler) (string, ResolverOptions, func()) {
1039 s := httptest.NewUnstartedServer(h)
1040 s.StartTLS()
1041
1042 capool := x509.NewCertPool()
1043 cert, _ := x509.ParseCertificate(s.TLS.Certificates[0].Certificate[0])
1044 capool.AddCert(cert)
1045
1046 client := &http.Client{
1047 Transport: &http.Transport{
1048 TLSClientConfig: &tls.Config{
1049 RootCAs: capool,
1050 },
1051 },
1052 }
1053
1054 options := ResolverOptions{
1055 Hosts: ConfigureDefaultRegistries(WithClient(client)),
1056 // Set deprecated field for tests to use for configuration
1057 Client: client,
1058 }
1059 base := s.URL[8:] // strip "https://"
1060 return base, options, s.Close
1061}
1062
1063type logHandler struct {
1064 t *testing.T

Callers 5

TestBasicResolverFunction · 0.85
TestResolveProxyFunction · 0.85
withTokenServerFunction · 0.85
withBasicAuthServerFunction · 0.85
BasicTestFuncMethod · 0.85

Calls 2

WithClientFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…