command

package
v0.0.0-...-2cebd77 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAuthKeys

func GetAuthKeys(keys []string) []ssh.AuthMethod

秘钥配置

func GetAuthPassword

func GetAuthPassword(password string) []ssh.AuthMethod

密码配置

func PublicKeyFile

func PublicKeyFile(file string) ssh.AuthMethod

加载秘钥

func Run

func Run(info *utils.WebHookInfo, hook *conf.HookConfig, key string, to int)

Types

type ExecResult

type ExecResult struct {
	Id             int
	Host           string
	Command        string
	LocalFilePath  string
	RemoteFilePath string
	Result         string
	StartTime      time.Time
	EndTime        time.Time
	Error          error
}

result of the command execution

func CommandBySSH

func CommandBySSH(host conf.HostConfig, to int, wg *sync.WaitGroup) (*ExecResult, error)

func CommandLocal

func CommandLocal(cmd string, to int, wg *sync.WaitGroup) (ExecResult, error)

func LocalExec

func LocalExec(cmd string) ExecResult

运行本地shell脚本

type HostSession

type HostSession struct {
	Username string
	Password string
	Hostname string
	Signers  []ssh.Signer
	Port     int
	Auths    []ssh.AuthMethod
}

ssh session

func (*HostSession) Exec

func (exec *HostSession) Exec(command string, config ssh.ClientConfig) *ExecResult

运行远端主机脚本,并返回结果

func (*HostSession) GenerateConfig

func (exec *HostSession) GenerateConfig() ssh.ClientConfig

生成ssh配置

Jump to

Keyboard shortcuts

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