summaryrefslogtreecommitdiff
path: root/registry/registry.go
diff options
context:
space:
mode:
authorSebastiaan van Stijn <github@gone.nl>2022-02-25 23:58:25 +0100
committerSebastiaan van Stijn <github@gone.nl>2022-03-17 17:08:05 +0100
commit8b8bbbd44551b66641502e899f4401e6795afb82 (patch)
tree1fe4b78d91ba65760595524ed852c79069de89e2 /registry/registry.go
parent569dc6d692558c056071cd9052208e5a36e269ae (diff)
downloaddocker-8b8bbbd44551b66641502e899f4401e6795afb82.tar.gz
registry: un-export HTTPClient() and NewTransport()
They're only used internally. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Diffstat (limited to 'registry/registry.go')
-rw-r--r--registry/registry.go12
1 files changed, 5 insertions, 7 deletions
diff --git a/registry/registry.go b/registry/registry.go
index 42f0f4dc9f..6f866ed17a 100644
--- a/registry/registry.go
+++ b/registry/registry.go
@@ -120,9 +120,9 @@ func Headers(userAgent string, metaHeaders http.Header) []transport.RequestModif
return modifiers
}
-// HTTPClient returns an HTTP client structure which uses the given transport
+// httpClient returns an HTTP client structure which uses the given transport
// and contains the necessary headers for redirected requests
-func HTTPClient(transport http.RoundTripper) *http.Client {
+func httpClient(transport http.RoundTripper) *http.Client {
return &http.Client{
Transport: transport,
CheckRedirect: addRequiredHeadersToRedirectedRequests,
@@ -165,9 +165,9 @@ func addRequiredHeadersToRedirectedRequests(req *http.Request, via []*http.Reque
return nil
}
-// NewTransport returns a new HTTP transport. If tlsConfig is nil, it uses the
+// newTransport returns a new HTTP transport. If tlsConfig is nil, it uses the
// default TLS configuration.
-func NewTransport(tlsConfig *tls.Config) *http.Transport {
+func newTransport(tlsConfig *tls.Config) *http.Transport {
if tlsConfig == nil {
tlsConfig = tlsconfig.ServerDefault()
}
@@ -177,7 +177,7 @@ func NewTransport(tlsConfig *tls.Config) *http.Transport {
KeepAlive: 30 * time.Second,
}
- base := &http.Transport{
+ return &http.Transport{
Proxy: http.ProxyFromEnvironment,
DialContext: direct.DialContext,
TLSHandshakeTimeout: 10 * time.Second,
@@ -185,6 +185,4 @@ func NewTransport(tlsConfig *tls.Config) *http.Transport {
// TODO(dmcgowan): Call close idle connections when complete and use keep alive
DisableKeepAlives: true,
}
-
- return base
}