How to connect remote ssh server with socks proxy?
<pre><code>package main

import (
    &quot;errors&quot;
    &quot;fmt&quot;
    &quot;net&quot;

    &quot;golang.org/x/crypto/ssh&quot;
)

var (
    socks    string = &quot;127.0.0.1:8000&quot;
    server   string = &quot;192.168.1.1:2222&quot;
    cmd      string = &quot;&quot;
    login    string = &quot;root&quot;
    password string = &quot;&quot;
)

func main() {
    c, err := netConn(socks)
    if err != nil {
        fmt.Println(err)
    }
    conf := &amp;ssh.ClientConfig{
        User: login,
        Auth: []ssh.AuthMethod{
            ssh.Password(password),
        },
    }
    client, err := Dialer(conf, c, server)
    if err != nil {
        fmt.Println(err)
    }
    session, err := client.NewSession()
    defer session.Close()
    if err != nil {
        fmt.Println(err)
    }
    session.Run(cmd)
}

func netConn(addr string) (net.Conn, error) {
    conn, err := net.Dial(&quot;tcp&quot;, addr)
    if err != nil {
        return nil, errors.New(fmt.Sprintf(&quot;Unable to connect to %v&quot;, err))
    }
    return conn, nil
}

func Dialer(conf *ssh.ClientConfig, c net.Conn, host string) (*ssh.Client, error) {
    conn, chans, reqs, err := ssh.NewClientConn(c, host, conf)
    if err != nil {
        return nil, err
    }
    return ssh.NewClient(conn, chans, reqs), nil
}
</code></pre>
<p>Client panic</p>
<blockquote>
<p>ssh: handshake failed: EOF</p>
<p>panic: runtime error: invalid memory address or nil pointer dereference</p>
<p>[signal 0xb code=0x1 addr=0x0 pc=0x80f3e2d]</p>
<p>goroutine 1 [running]:</p>
<p>panic(0x8201b60, 0x18522030)</p>
<p>/usr/lib/go/src/runtime/panic.go:464 +0x326</p>
<p>golang.org/x/crypto/ssh.(*Client).NewSession(0x0, 0x1, 0x0, 0x0)</p>
<p>/home/user/go/src/golang.org/x/crypto/ssh/client.go:129 +0xcd</p>
<p>main.main()</p>
<p>/home/user/go/src/ss/i.go:34 +0x276</p>
</blockquote>
<p>And socks server in log</p>
<blockquote>
<p>[ERR] socks: Unsupported SOCKS version: [83]</p>
</blockquote>
<p>How i can make it posible? Thanks.</p>