Versions in this module Expand all Collapse all v1 v1.2.0 May 19, 2023 Changes in this version + var DefaultTimeout = 20 * time.Second + func AddKnownHost(host string, remote net.Addr, key ssh.PublicKey, knownFile string) (err error) + func CheckKnownHost(host string, remote net.Addr, key ssh.PublicKey, knownFile string) (found bool, err error) + func DefaultKnownHosts() (ssh.HostKeyCallback, error) + func DefaultKnownHostsPath() (string, error) + func Dial(proto string, c *Config) (*ssh.Client, error) + func GetSigner(prvFile string, passphrase string) (ssh.Signer, error) + func HasAgent() bool + func KnownHosts(file string) (ssh.HostKeyCallback, error) + type Auth []ssh.AuthMethod + func Key(prvFile string, passphrase string) (Auth, error) + func Password(pass string) Auth + func UseAgent() (Auth, error) + type Client struct + Config *Config + func New(user string, host string, auth Auth) (c *Client, err error) + func NewConn(config *Config) (c *Client, err error) + func NewUnknown(user string, addr string, auth Auth) (*Client, error) + func (c Client) Close() error + func (c Client) Command(name string, args ...string) (*Cmd, error) + func (c Client) CommandContext(ctx context.Context, name string, args ...string) (*Cmd, error) + func (c Client) Download(remotePath string, localPath string) (err error) + func (c Client) NewSftp(opts ...sftp.ClientOption) (*sftp.Client, error) + func (c Client) Run(cmd string) ([]byte, error) + func (c Client) RunContext(ctx context.Context, name string) ([]byte, error) + func (c Client) Upload(localPath string, remotePath string) (err error) + type Cmd struct + Args []string + Context context.Context + Env []string + Path string + func (c *Cmd) CombinedOutput() ([]byte, error) + func (c *Cmd) Output() ([]byte, error) + func (c *Cmd) Run() error + func (c *Cmd) Start() error + func (c *Cmd) String() string + type Config struct + Auth Auth + BannerCallback ssh.BannerCallback + Callback ssh.HostKeyCallback + Host string + KeyPath string + Passphrase string + Password string + Port uint + Proxy *Config + Timeout time.Duration + User string