Versions in this module Expand all Collapse all v1 v1.9.0 Nov 27, 2021 v1.8.0 Nov 27, 2021 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, addr string, auth Auth, uint port) (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 + Addr string + Auth Auth + Callback ssh.HostKeyCallback + Port uint + Timeout time.Duration + User string