diff --git a/sockets/sockets.go b/sockets/sockets.go index bbf5aeb4..ded8eff1 100644 --- a/sockets/sockets.go +++ b/sockets/sockets.go @@ -28,7 +28,7 @@ func ConfigureTransport(tr *http.Transport, proto, addr string) error { if err != nil { return err } - tr.DialContext = dialer.DialContext + tr.Dial = dialer.Dial } return nil } diff --git a/sockets/sockets_unix.go b/sockets/sockets_unix.go index e3f78941..e82fd9b9 100644 --- a/sockets/sockets_unix.go +++ b/sockets/sockets_unix.go @@ -21,11 +21,8 @@ func configureUnixTransport(tr *http.Transport, proto, addr string) error { } // No need for compression in local communications. tr.DisableCompression = true - dialer := &net.Dialer{ - Timeout: defaultTimeout, - } - tr.DialContext = func(ctx context.Context, _, _ string) (net.Conn, error) { - return dialer.DialContext(ctx, proto, addr) + tr.Dial = func(_, _ string) (net.Conn, error) { + return net.DialTimeout(proto, addr, defaultTimeout) } return nil } diff --git a/sockets/sockets_windows.go b/sockets/sockets_windows.go index f6462eda..5c21644e 100644 --- a/sockets/sockets_windows.go +++ b/sockets/sockets_windows.go @@ -15,15 +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 - dialer := &net.Dialer{ - Timeout: defaultTimeout, - } - tr.DialContext = func(ctx context.Context, _, _ string) (net.Conn, error) { - // DialPipeContext() has been added to winio: - // https://github.com/Microsoft/go-winio/commit/5fdbdcc2ae1c7e1073157fa7cb34a15eab472e1d - // However, a new version of winio with this commit has not been released yet. - // Continue to use DialPipe() until DialPipeContext() becomes available. - //return winio.DialPipeContext(ctx, addr) + tr.Dial = func(_, _ string) (net.Conn, error) { return DialPipe(addr, defaultTimeout) } return nil