Documentation
¶
Index ¶
- func RemoveRemote(sshCli *ssh.Client, path string, useSCP bool) error
- func RunCommand(sshCli *ssh.Client, command string) (string, string, 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 RemoveRemote ¶
删除指定远程路径的文件。
入参:
- sshCli: SSH 客户端。
- path: 文件远程路径。
- useSCP: 是否使用 SCP 进行传输,否则使用 SFTP。
出参:
- 错误。
func RunCommand ¶ added in v0.4.15
执行远程脚本命令,并返回执行后标准输出和标准错误。
入参:
- sshCli: SSH 客户端。
- command: 待执行的脚本命令。
出参:
- stdout:标准输出。
- stderr:标准错误。
- err: 错误。
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.