package ssh import ( "net" "golang.org/x/crypto/ssh" ) type Client struct { netConn net.Conn client *ssh.Client } type ClientConfig struct { ssh.ClientConfig } func NewClient(conn net.Conn, config *ClientConfig) (*Client, error) { sshConn, channels, requests, err := ssh.NewClientConn(conn, conn.RemoteAddr().String(), &config.ClientConfig) if err != nil { return nil, err } return &Client{ netConn: conn, client: ssh.NewClient(sshConn, channels, requests), }, nil }