From c467823745bd0572b6c3898d91f6c125193a2791 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Mon, 26 Jul 2021 15:11:23 +0200 Subject: [PATCH] try revert_transport_dial branch Signed-off-by: Sebastiaan van Stijn --- vendor.conf | 2 +- .../github.com/docker/go-connections/go.mod | 2 +- .../docker/go-connections/sockets/proxy.go | 10 ++---- .../docker/go-connections/sockets/sockets.go | 36 +------------------ .../go-connections/sockets/sockets_unix.go | 9 +---- .../go-connections/sockets/sockets_windows.go | 6 +--- 6 files changed, 8 insertions(+), 57 deletions(-) diff --git a/vendor.conf b/vendor.conf index 2824c3f1120c..a3b94c37e3d1 100755 --- a/vendor.conf +++ b/vendor.conf @@ -15,7 +15,7 @@ github.com/docker/distribution 0d3efadf0154c2b8a4e7b6621fff github.com/docker/docker 25917217cab38eab40c3db0010b915258f4a8491 # master (v21.xx-dev) github.com/docker/docker-credential-helpers fc9290adbcf1594e78910e2f0334090eaee0e1ee # v0.6.4 github.com/docker/go d30aec9fd63c35133f8f79c3412ad91a3b08be06 # Contains a customized version of canonical/json and is used by Notary. The package is periodically rebased on current Go versions. -github.com/docker/go-connections go116_proxy_detect_and_revert https://github.com/thaJeztah/go-connections.git +github.com/docker/go-connections revert_transport_dial https://github.com/thaJeztah/go-connections.git github.com/docker/go-events e31b211e4f1cd09aa76fe4ac244571fab96ae47f github.com/docker/go-metrics b619b3592b65de4f087d9f16863a7e6ff905973c # v0.0.1 github.com/docker/go-units 519db1ee28dcc9fd2474ae59fca29a810482bfb1 # v0.4.0 diff --git a/vendor/github.com/docker/go-connections/go.mod b/vendor/github.com/docker/go-connections/go.mod index bb3d4d890bf5..b10c95b44463 100644 --- a/vendor/github.com/docker/go-connections/go.mod +++ b/vendor/github.com/docker/go-connections/go.mod @@ -5,5 +5,5 @@ go 1.13 require ( github.com/Microsoft/go-winio v0.4.14 github.com/pkg/errors v0.9.1 - golang.org/x/net v0.0.0-20210716203947-853a461950ff + golang.org/x/net v0.0.0-20210226172049-e18ecbb05110 ) diff --git a/vendor/github.com/docker/go-connections/sockets/proxy.go b/vendor/github.com/docker/go-connections/sockets/proxy.go index 2954bb96e74b..98e9a1dc61b5 100644 --- a/vendor/github.com/docker/go-connections/sockets/proxy.go +++ b/vendor/github.com/docker/go-connections/sockets/proxy.go @@ -20,13 +20,9 @@ func GetProxyEnv(key string) string { return proxyValue } -// DialerFromEnvironment is used to configure a net.Dialer to route -// connections through a SOCKS proxy. -// -// DEPRECATED: SOCKS proxies are now supported by configuring only -// http.Transport.Proxy, and no longer require changing http.Transport.Dial. -// Therefore, only sockets.ConfigureTransport() needs to be called, and any -// sockets.DialerFromEnvironment() calls can be dropped. +// DialerFromEnvironment takes in a "direct" *net.Dialer and returns a +// proxy.Dialer which will route the connections through the proxy using the +// given dialer. func DialerFromEnvironment(direct *net.Dialer) (proxy.Dialer, error) { allProxy := GetProxyEnv("all_proxy") if len(allProxy) == 0 { diff --git a/vendor/github.com/docker/go-connections/sockets/sockets.go b/vendor/github.com/docker/go-connections/sockets/sockets.go index bf126985f449..263db0881701 100644 --- a/vendor/github.com/docker/go-connections/sockets/sockets.go +++ b/vendor/github.com/docker/go-connections/sockets/sockets.go @@ -5,7 +5,6 @@ import ( "errors" "net" "net/http" - "net/url" "time" ) @@ -25,7 +24,6 @@ func ConfigureTransport(tr *http.Transport, proto, addr string) error { case "npipe": return configureNpipeTransport(tr, proto, addr) default: - tr.Proxy = TCPProxyFromEnvironment tr.Proxy = http.ProxyFromEnvironment dialer, err := DialerFromEnvironment(&net.Dialer{ Timeout: defaultTimeout, @@ -33,39 +31,7 @@ func ConfigureTransport(tr *http.Transport, proto, addr string) error { if err != nil { return err } - tr.Dial = dialer.Dial //nolint: staticcheck // SA1019: tr.Dial is deprecated: Use DialContext instead + tr.Dial = dialer.Dial } return nil } - -// TCPProxyFromEnvironment wraps http.ProxyFromEnvironment, to preserve the -// pre-go1.16 behavior for URLs using the 'tcp://' scheme. For other schemes, -// golang's standard behavior is preserved (and depends on the Go version used). -// -// Prior to go1.16, `https://` schemes would use HTTPS_PROXY, and any other -// scheme would use HTTP_PROXY. However, https://github.com/golang/net/commit/7b1cca2348c07eb09fef635269c8e01611260f9f -// (per a request in golang/go#40909) changed this behavior to only use -// HTTP_PROXY for `http://` schemes, no longer using a proxy for any other -// scheme. -// -// Docker uses the `tcp://` scheme as a default for API connections, to indicate -// that the API is not "purely" HTTP. Various parts in the code also *require* -// this scheme to be used. While we could change the default and allow http(s) -// schemes to be used, doing so will take time, taking into account that there -// are many installs in existence that have tcp:// configured as DOCKER_HOST. -// -// This function detects if the `tcp://` scheme is used; if it is, it creates -// a shallow copy of req, containing just the URL, and overrides the scheme with -// 'http', which should be sufficient to perform proxy detection. -// For other (non-'tcp://') schemes, http.ProxyFromEnvironment is called without -// altering the request. -func TCPProxyFromEnvironment(req *http.Request) (*url.URL, error) { - if req.URL.Scheme != "tcp" { - return http.ProxyFromEnvironment(req) - } - u := req.URL - if u.Scheme == "tcp" { - u.Scheme = "http" - } - return http.ProxyFromEnvironment(&http.Request{URL: u}) -} diff --git a/vendor/github.com/docker/go-connections/sockets/sockets_unix.go b/vendor/github.com/docker/go-connections/sockets/sockets_unix.go index 1eed6d15194d..386cf0dbbdec 100644 --- a/vendor/github.com/docker/go-connections/sockets/sockets_unix.go +++ b/vendor/github.com/docker/go-connections/sockets/sockets_unix.go @@ -3,7 +3,6 @@ package sockets import ( - "context" "fmt" "net" "net/http" @@ -19,15 +18,9 @@ func configureUnixTransport(tr *http.Transport, proto, addr string) error { } // No need for compression in local communications. tr.DisableCompression = true - tr.Dial = func(_, _ string) (net.Conn, error) { //nolint: staticcheck // SA1019: tr.Dial is deprecated: Use DialContext instead + tr.Dial = func(_, _ string) (net.Conn, error) { return net.DialTimeout(proto, addr, defaultTimeout) } - dialer := &net.Dialer{ - Timeout: defaultTimeout, - } - tr.DialContext = func(ctx context.Context, _, _ string) (net.Conn, error) { - return dialer.DialContext(ctx, proto, addr) - } return nil } diff --git a/vendor/github.com/docker/go-connections/sockets/sockets_windows.go b/vendor/github.com/docker/go-connections/sockets/sockets_windows.go index 4050008b8061..5c21644e1fe7 100644 --- a/vendor/github.com/docker/go-connections/sockets/sockets_windows.go +++ b/vendor/github.com/docker/go-connections/sockets/sockets_windows.go @@ -1,7 +1,6 @@ package sockets import ( - "context" "net" "net/http" "time" @@ -16,10 +15,7 @@ func configureUnixTransport(tr *http.Transport, proto, addr string) error { func configureNpipeTransport(tr *http.Transport, proto, addr string) error { // No need for compression in local communications. tr.DisableCompression = true - tr.DialContext = func(ctx context.Context, _, _ string) (net.Conn, error) { - return winio.DialPipeContext(ctx, addr) - } - tr.Dial = func(_, _ string) (net.Conn, error) { //nolint: staticcheck // SA1019: tr.Dial is deprecated: Use DialContext instead + tr.Dial = func(_, _ string) (net.Conn, error) { return DialPipe(addr, defaultTimeout) } return nil