sshtool

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 1, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

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)

func (*SSHClient) Close

func (s *SSHClient) Close()

func (*SSHClient) ExecuteCommand

func (s *SSHClient) ExecuteCommand(command string) (string, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL