Versions in this module Expand all Collapse all v0 v0.1.2 Feb 10, 2023 v0.1.0 Feb 10, 2023 Changes in this version + const DefaultTimeout + var Default = DefaultConfig + var DefaultConfig = &Config + func AuthWithAgent() (ssh.AuthMethod, error) + func AuthWithKeyboardPassword(password string) (ssh.AuthMethod, error) + func AuthWithPassword(password string) (ssh.AuthMethod, error) + func AuthWithPrivateKey(keyfile string, passphrase string) (ssh.AuthMethod, error) + func AuthWithPrivateKeyString(key string, password string) (ssh.AuthMethod, error) + func AuthWithPrivateKeyTerminal(keyfile string) (ssh.AuthMethod, error) + func AuthWithPrivateKeys(keyFiles []string, passphrase string) (ssh.AuthMethod, error) + func FileExist(file string) bool + func HasAgent() bool + func KeyFile() string + func Md5File(filename string) (string, error) + func MkdirAll(path string) error + type Client struct + SFTPClient *sftp.Client + SSHClient *ssh.Client + SSHSession *ssh.Session + func Connect(cnf *Config) (client *Client, err error) + func New(cnf *Config) (client *Client, err error) + func NewClient(host, port, user, password string) (client *Client, err error) + func NewDSN() (client *Client) + func NewWithAgent(Host, Port, User string) (client *Client, err error) + func NewWithPrivateKey(host, port, user, passphrase string, keyFiles []string) (client *Client, err error) + func (c *Client) Close() + func (c *Client) Download(remote string, local string) (err error) + func (c *Client) Exec(cmd string) error + func (c *Client) Exec1(cmd string) error + func (c *Client) ExecSu(cmd, passwd string) ([]byte, error) + func (c *Client) FileExist(filepath string) (bool, error) + func (c *Client) IsDir(path string) bool + func (c *Client) IsExist(path string) bool + func (c *Client) IsFile(path string) bool + func (c *Client) IsNotExist(path string) bool + func (c *Client) Md5File(path string) string + func (c *Client) Mkdir(path string, fi os.FileInfo) error + func (c *Client) MkdirAll(dirpath string) error + func (c *Client) Output(cmd string) ([]byte, error) + func (c *Client) ReadAll(filepath string) ([]byte, error) + func (c *Client) Remove(path string) error + func (c *Client) RemoveAll(remoteDir string) error + func (c *Client) RemoveDir(remoteDir string) error + func (c *Client) RemoveDirectory(path string) error + func (c *Client) RemoveFile(remoteFile string) error + func (c *Client) Run(cmd string) + func (c *Client) RunScript(scriptPath string) ([]byte, error) + func (c *Client) Size(path string) int64 + func (c *Client) Upload(local string, remote string) (err error) + func (c *Client) UploadDir(localDir string, remoteDir string) (err error) + func (c *Client) UploadFile(localFile, remote string) error + type Config struct + DisableAgentForwarding bool + HandshakeTimeout time.Duration + Host string + KeepAliveInterval time.Duration + KeyFiles []string + Passphrase string + Password string + Port int + StickySession bool + Timeout time.Duration + User string + func WithHost(host string) *Config + func WithKey(keyfile, passphrase string) *Config + func WithPassword(password string) *Config + func WithUser(user string) *Config + func (c *Config) SetKeys(keyfiles []string) *Config + func (c *Config) WithHost(host string) *Config + func (c *Config) WithKey(keyfile, passphrase string) *Config + func (c *Config) WithPassword(password string) *Config + func (c *Config) WithUser(user string) *Config + func (cnf *Config) Connect() (client *Client, err error)