Versions in this module Expand all Collapse all v0 v0.7.9 Feb 21, 2024 v0.7.8 Feb 21, 2024 v0.7.7 Nov 29, 2023 v0.7.6 Apr 14, 2023 v0.7.5 Mar 10, 2023 Changes in this version + const ArchAmd64 + const ArchArm + const ArchI386 + const ArchUnknown + const CmiTimeLayout + const DefaultPtyCols + const DefaultPtyRows + const GOOSDarwin + const GOOSFreeBSD + const GOOSLinux + const GOOSUnknown + const GOOSWindows + const KeepAliveMessage + const KillSignal + const LinuxShellExt + const ShellTmpPath + const WindowsShellExt + var DefaultRWTimeoutSec = utils.GetEnvInt("ENV_SSH_RW_TIMEOUT", defaultRWTimeout) + var DefaultTimeoutSec = utils.GetEnvInt("ENV_SSH_DIAL_TIMEOUT", defaultTimeout) + var SSHDialTimeout = time.Duration(DefaultTimeoutSec) * time.Second + var SSHRWTimeout = time.Duration(DefaultRWTimeoutSec) * time.Second + func AuthWithAgent() (ssh.AuthMethod, error) + func AuthWithPrivateKeyBytes(key []byte, password string) (ssh.AuthMethod, error) + func Dial(network, addr string, config *ssh.ClientConfig) (net.Conn, *ssh.Client, error) + func GetAllStats(client *Client, stats *Stats, wg *sync.WaitGroup) error + func RegisterSessionGauge(g Gauge) + type CPUInfo struct + Guest float32 + Idle float32 + Iowait float32 + Irq float32 + Nice float32 + SoftIrq float32 + Steal float32 + System float32 + Usage float32 + User float32 + type Client struct + Conf *ClientConfig + Info *MachineInfo + func New(config *ClientConfig) (client *Client, err error) + func (c *Client) Chmod(path string) error + func (c *Client) Close() error + func (c *Client) CollectTargetMachineInfo() error + func (c *Client) GetFile(path string) (*sftp.File, error) + func (c *Client) GetPwd() (string, error) + func (c *Client) GetRWFile(path string) (*sftp.File, error) + func (c *Client) GetSSHClient() *ssh.Client + func (c *Client) GetSftpClient() *sftp.Client + func (c *Client) GetTargetMachineOs() string + func (c *Client) IsDir(path string) bool + func (c *Client) MkdirAll(dirPath string) error + func (c *Client) NewPty() (*Session, error) + func (c *Client) NewSession() (*Session, error) + func (c *Client) NewSessionWithPty(cols, rows int) (*Session, error) + func (c *Client) NewSftpClient() error + func (c *Client) Notify(ch chan *Client) + func (c *Client) PathExists(path string) bool + func (c *Client) Ping() error + func (c *Client) ReadDir(path string) ([]os.FileInfo, error) + func (c *Client) ReadLink(path string) (string, error) + func (c *Client) RealPath(path string) (string, error) + func (c *Client) Remove(path string) error + func (c *Client) RemoveDir(remoteDir string) error + func (c *Client) SendRequest(name string, wantReply bool, payload []byte) (bool, []byte, error) + func (c *Client) Stat(path string) (os.FileInfo, error) + func (c *Client) UploadFile(local, fPath string, fName string) error + func (c *Client) UploadFileRaw(context string, fPath string) error + func (c *Client) UploadHttpFile(fileH *multipart.FileHeader, remote string) error + type ClientConfig struct + Host string + ID int + KeyBytes []byte + Passphrase string + Password string + Port int + User string + func (h *ClientConfig) Serialize() int64 + type FSInfo struct + Free uint64 + MountPoint string + Used uint64 + type Gauge interface + Dec func() + Inc func() + Set func(float64) + type MachineInfo struct + Arch string + Cmd string + Goos string + type NetIntfInfo struct + IPv4 string + IPv6 string + Rx uint64 + Tx uint64 + type Session struct + Client *Client + func (s *Session) Close() error + func (s *Session) Kill() error + func (s *Session) Output(cmd string) ([]byte, error) + func (s *Session) OutputContext(ctx context.Context, cmd string) ([]byte, error) + func (s *Session) Run(cmd string) error + func (s *Session) RunScript(shell string, sudo bool) ([]byte, error) + func (s *Session) SetStderr(stderr io.Writer) + func (s *Session) SetStdout(stdout io.Writer) + func (s *Session) Shell() error + func (s *Session) Start(cmd string) error + func (s *Session) Sudo(cmd, passwd string) ([]byte, error) + func (s *Session) SudoContext(ctx context.Context, cmd, passwd string) ([]byte, error) + func (s *Session) Wait() error + func (s *Session) WindowChange(h, w int) error + func (s *Session) Write(b []byte) (int, error) + type Stats struct + CPU CPUInfo + FSInfos []FSInfo + Hostname string + Load1 string + Load10 string + Load5 string + MemBuffers uint64 + MemCached uint64 + MemFree uint64 + MemTotal uint64 + MemUsage float32 + NetIntf map[string]NetIntfInfo + PreCPU *cpuRaw + RunningProcs string + StartUpTime string + SwapFree uint64 + SwapTotal uint64 + SwapUsage float32 + TotalProcs string + Uptime time.Duration + func NewStatus() *Stats