Documentation
¶
Index ¶
- func NewClient(conn net.Conn, host string, port int, username string) (*ssh.Client, error)
- func NewClientWithKey(conn net.Conn, host string, port int, username string, ...) (*ssh.Client, error)
- func NewClientWithPassword(conn net.Conn, host string, port int, username string, password string) (*ssh.Client, error)
- func RemoveRemote(sshCli *ssh.Client, path string, useSCP bool) error
- func WriteRemote(sshCli *ssh.Client, path string, data []byte, useSCP bool) error
- func WriteRemoteString(sshCli *ssh.Client, path string, content string, useSCP bool) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewClientWithKey ¶
func NewClientWithPassword ¶
func RemoveRemote ¶
删除指定远程路径的文件。
入参:
- sshCli: SSH 客户端。
- path: 文件远程路径。
- useSCP: 是否使用 SCP 进行传输,否则使用 SFTP。
出参:
- 错误。
func WriteRemote ¶
将数据写入指定远程路径的文件。 如果目录不存在,将会递归创建目录。 如果文件不存在,将会创建该文件;如果文件已存在,将会覆盖原有内容。
入参:
- sshCli: SSH 客户端。
- path: 文件远程路径。
- data: 文件数据字节数组。
- useSCP: 是否使用 SCP 进行传输,否则使用 SFTP。
出参:
- 错误。
func WriteRemoteString ¶
与 WriteRemote 类似,但写入的是字符串内容。
入参:
- sshCli: SSH 客户端。
- path: 文件远程路径。
- data: 文件数据字节数组。
- useSCP: 是否使用 SCP 进行传输,否则使用 SFTP。
出参:
- 错误。
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.