Documentation
¶
Index ¶
- func Connect(hostname string, user string, port int, authConfig AuthConfig) error
- func CopyFile(client *ssh.Client, localPath string, remotePath string) error
- func ExecuteCommand(client *ssh.Client, command string) (string, error)
- func NewSSHClient(hostname string, user string, port int, authConfig AuthConfig) (*ssh.Client, error)
- type AuthConfig
- type Client
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Connect ¶
func Connect(hostname string, user string, port int, authConfig AuthConfig) error
Connect 连接到服务器并执行命令(交互式,全部通过 expect 实现)
func ExecuteCommand ¶
ExecuteCommand 在远程服务器执行命令
func NewSSHClient ¶
func NewSSHClient(hostname string, user string, port int, authConfig AuthConfig) (*ssh.Client, error)
NewSSHClient 创建SSH客户端(用于程序化操作,非交互式登录)
Types ¶
type AuthConfig ¶
AuthConfig 认证配置(从config包导入的类型)
Click to show internal directories.
Click to hide internal directories.