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

Not using default transport when using NewInsecure #80

@RafaelPaulovic

Description

@RafaelPaulovic
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)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions