Skip to content
This repository has been archived by the owner on Mar 16, 2024. It is now read-only.

Not using default transport when using NewInsecure #80

Open
RafaelPaulovic opened this issue Nov 19, 2020 · 0 comments
Open

Not using default transport when using NewInsecure #80

RafaelPaulovic opened this issue Nov 19, 2020 · 0 comments

Comments

@RafaelPaulovic
Copy link

func NewInsecure(registryUrl, username, password string) (*Registry, error) {
	transport := &http.Transport{
		TLSClientConfig: &tls.Config{
			InsecureSkipVerify: true,
		},
	}

	return newFromTransport(registryUrl, username, password, transport, Quiet)
}

Better would be to set some configurations. The way it is at the moment if there is any proxy env. set for example, the proxy will simply be ignored by the registry client.

func NewInsecure(registryUrl, username, password string) (*Registry, error) {
	transport := &http.Transport{
		Proxy: http.ProxyFromEnvironment,
		DialContext: (&net.Dialer{
			Timeout:   30 * time.Second,
			KeepAlive: 30 * time.Second,
		}).DialContext,
		ForceAttemptHTTP2:     true,
		MaxIdleConns:          100,
		IdleConnTimeout:       90 * time.Second,
		TLSHandshakeTimeout:   10 * time.Second,
		ExpectContinueTimeout: 1 * time.Second,
		TLSClientConfig: &tls.Config{
			InsecureSkipVerify: true,
		},
	}

	return newFromTransport(registryUrl, username, password, transport, Quiet)
}
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant