Documentation ¶
Index ¶
- func WaitSSHReady(ssh Interface, tryTimes int, hosts ...string) error
- type Client
- type Exec
- type Interface
- type SSH
- func (s *SSH) Cmd(host, cmd string) ([]byte, error)
- func (s *SSH) CmdAsync(host string, cmds ...string) error
- func (s *SSH) CmdToString(host, cmd, spilt string) (string, error)
- func (s *SSH) Connect(host string) (*ssh.Client, *ssh.Session, error)
- func (s *SSH) Copy(host, localPath, remotePath string) error
- func (s *SSH) Ping(host string) error
- func (s *SSH) RemoteSha256Sum(host, remoteFilePath string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Exec ¶
type Exec struct {
// contains filtered or unexported fields
}
func NewExecCmdFromIPs ¶
func NewExecCmdFromIPs(vm *v1.VirtualMachine, ips []string) (*Exec, error)
type Interface ¶
type Interface interface { // Copy is copy local files to remote host // scp -r /tmp root@192.168.0.2:/root/tmp => Copy("192.168.0.2","tmp","/root/tmp") // need check md5sum Copy(host, srcFilePath, dstFilePath string) error // CmdAsync is exec command on remote host, and asynchronous return logs CmdAsync(host string, cmd ...string) error // Cmd is exec command on remote host, and return combined standard output and standard error Cmd(host, cmd string) ([]byte, error) //CmdToString is exec command on remote host, and return spilt standard output and standard error CmdToString(host, cmd, spilt string) (string, error) Ping(host string) error }
type SSH ¶
type SSH struct { User string Password string PkFile string PkData string PkPassword string Timeout *time.Duration LocalAddress *[]net.Addr // contains filtered or unexported fields }
func (*SSH) CmdToString ¶
CmdToString is in host exec cmd and replace to spilt str
func (*SSH) RemoteSha256Sum ¶
Click to show internal directories.
Click to hide internal directories.