From 07e0806248a22ab0d41dee65abfe99640f723acb Mon Sep 17 00:00:00 2001 From: Josh Hill Date: Wed, 30 May 2018 10:36:36 +0100 Subject: [PATCH] Revert "Establish socks proxy if BOSH_ALL_PROXY set" This reverts commit b01c84c5489774f2f7f294a1bae3e2a2a1d717dd. We tried to revert both commits (b01c84c and d106c15) in the previous commit, but only reverted d106c15. [#157779432] --- ssh/connection.go | 29 +---------------------------- 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/ssh/connection.go b/ssh/connection.go index 3c1fbde5f..4e8268fe8 100644 --- a/ssh/connection.go +++ b/ssh/connection.go @@ -8,12 +8,6 @@ import ( "strings" - "log" - "net" - "os" - - boshhttp "github.com/cloudfoundry/bosh-utils/httpclient" - "github.com/cloudfoundry/socks5-proxy" "github.com/pkg/errors" "golang.org/x/crypto/ssh" ) @@ -105,29 +99,8 @@ func (w *sessionClosingOnErrorWriter) Write(data []byte) (int, error) { return n, err } -func (c Connection) getConnection() (*ssh.Client, error) { - dialFunc := net.Dial - - if os.Getenv("BOSH_ALL_PROXY") != "" { - socksProxy := proxy.NewSocks5Proxy(proxy.NewHostKey(), log.New(os.Stdout, "sock5-proxy", log.LstdFlags)) - dialFunc = boshhttp.SOCKS5DialFuncFromEnvironment(net.Dial, socksProxy) - } - - conn, err := dialFunc("tcp", c.host) - if err != nil { - return nil, err - } - - client, chans, reqs, err := ssh.NewClientConn(conn, c.host, c.sshConfig) - if err != nil { - return nil, err - } - - return ssh.NewClient(client, chans, reqs), nil -} - func (c Connection) runInSession(cmd string, stdout, stderr io.Writer, stdin io.Reader) (int, error) { - connection, err := c.getConnection() + connection, err := ssh.Dial("tcp", c.host, c.sshConfig) if err != nil { return -1, errors.Wrap(err, "ssh.Dial failed") }