Documentation
¶
Index ¶
- func ExecuteSSHCommandInteractive(remote *structs.L2DeviceRemoteInfo, command string, timeout time.Duration) (string, error)
- func ExecuteSSHCommands(remote *structs.L2DeviceRemoteInfo, options []interface{}) (*clitask.Table, error)
- func ExecuteSSHCommandsInteractive(remote *structs.L2DeviceRemoteInfo, commands []string, timeout time.Duration, ...) (string, string, error)
- type SSHClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExecuteSSHCommandInteractive ¶
func ExecuteSSHCommandInteractive(remote *structs.L2DeviceRemoteInfo, command string, timeout time.Duration) (string, error)
ExecuteSSHCommandInteractive 交互式执行SSH命令 登录后等待提示符,发送命令,基于提示符判断命令完成
func ExecuteSSHCommands ¶
func ExecuteSSHCommands(remote *structs.L2DeviceRemoteInfo, options []interface{}) (*clitask.Table, error)
func ExecuteSSHCommandsInteractive ¶
func ExecuteSSHCommandsInteractive(remote *structs.L2DeviceRemoteInfo, commands []string, timeout time.Duration, isValidOutput func(string, string) bool) (string, string, error)
ExecuteSSHCommandsInteractive 在一个SSH会话中执行多个命令 依次尝试执行命令列表,返回第一个成功的命令输出 这样可以复用SSH连接,避免重复认证
Types ¶
type SSHClient ¶
type SSHClient struct {
// contains filtered or unexported fields
}
func NewSSHClient ¶
func NewSSHClient(remote *structs.L2DeviceRemoteInfo) (*SSHClient, error)
Click to show internal directories.
Click to hide internal directories.