Versions in this module Expand all Collapse all v1 v1.0.1 Apr 8, 2024 Changes in this version + func BackupFile(s Interface, file string) (string, error) + func DiskAvail(s Interface, path string) (int, error) + func FormatFileSize(s int64) (size string) + func GetNetworkInterface(s Interface, ip string) string + func MakePrivateKeySigner(privateKey []byte, passPhrase []byte) (ssh.Signer, error) + func MakePrivateKeySignerFromFile(key string) (ssh.Signer, error) + func MemoryCapacity(s Interface) (uint64, error) + func NewSftpClient(user, password, host string, port int, timeoutSec time.Duration) (*sftp.Client, error) + func NumCPU(s Interface) (int, error) + func ParsePublicKeyFromFile(keyFile string) (*rsa.PublicKey, error) + func RestoreFile(s Interface, file string) error + func Timestamp(s Interface) (int, error) + func UploadLocalFileBySftp(objClient *sftp.Client, srcFilePath, remotePath string) error + type Config struct + DialTimeOut time.Duration + Host string + PassPhrase []byte + Password string + Port int + PrivateKey []byte + Proxy *ProxyConfig + ReadTimeOut time.Duration + Retry int + Sudo bool + User string + type Interface interface + CombinedOutput func(cmd string) ([]byte, error) + CopyFile func(src, dst string) error + Exec func(cmd string) (stdout string, stderr string, exit int, err error) + Execf func(format string, a ...interface{}) (stdout string, stderr string, exit int, err error) + Exist func(filename string) (bool, error) + LookPath func(file string) (string, error) + Ping func() error + ReadFile func(filename string) ([]byte, error) + WriteFile func(src io.Reader, dst string) error + type ProxyConfig struct + Address string + Auth *proxy.Auth + Type string + type SSH struct + func New(c *Config) (*SSH, error) + func (s *SSH) CombinedOutput(cmd string) ([]byte, error) + func (s *SSH) CopyDir(src, dst string) error + func (s *SSH) CopyFile(src, dst string) error + func (s *SSH) Exec(cmd string) (stdout string, stderr string, exit int, err error) + func (s *SSH) Execf(format string, a ...interface{}) (stdout string, stderr string, exit int, err error) + func (s *SSH) Exist(filename string) (bool, error) + func (s *SSH) LookPath(file string) (string, error) + func (s *SSH) Ping() error + func (s *SSH) ReadFile(filename string) ([]byte, error) + func (s *SSH) WriteFile(src io.Reader, dst string) error