ssh

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	SSH  *ssh.Client
	SFTP *sftp.Client
}

Client 连接实例

func NewClientByPassword

func NewClientByPassword(host, user, pwd string) (Client, error)

NewClientByPassword 使用用户名+密码的方式创建实例

func NewClientByPublicKey

func NewClientByPublicKey(host, user, privateKey, keyPwd string) (Client, error)

NewClientByPublicKey 使用公钥的方式创建实例

func (*Client) Close

func (c *Client) Close()

Close 关闭连接

func (*Client) Run

func (c *Client) Run(command string) (string, error)

Run 执行单条命令

func (*Client) RunShell

func (c *Client) RunShell(commands []string, callback func(int, string)) error

RunShell 在同一个context中执行多条命令

func (*Client) Upload added in v1.1.0

func (c *Client) Upload(localFilePath, remoteFilePath string, cover bool) error

Upload 上传文件

Jump to

Keyboard shortcuts

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