ssh

package
v1.1.8 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SSHClient

type SSHClient struct {
	User    string
	Pass    string
	Key     string // 私钥文件路径,公钥需写入服务器的authorized_keys
	Host    string
	Port    int
	Timeout int
	Session *ssh.Session
	Client  *ssh.Client
}

func (*SSHClient) CreateSession

func (obj *SSHClient) CreateSession() (*ssh.Session, error)

CreateSession 创建ssh会话

func (*SSHClient) RunOneCmd

func (obj *SSHClient) RunOneCmd(cmd string) (string, error)

RunOneCmd 执行单个命令,返回结果

func (*SSHClient) RunScriptFile

func (obj *SSHClient) RunScriptFile(file string) (string, error)

RunScriptFile 执行脚本文件

func (*SSHClient) UploadFile

func (obj *SSHClient) UploadFile(localFile string, remoteFile string) error

UploadFile 上传文件

Jump to

Keyboard shortcuts

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