sshexec

package
v0.0.0-...-329f2e7 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2019 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Copy

func Copy(dst io.Writer, src io.Reader) (written int64, err error)

func GetAuthKeys

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

func GetAuthPassword

func GetAuthPassword(password string) []ssh.AuthMethod

func PublicKeyFile

func PublicKeyFile(file string) ssh.AuthMethod

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
	ErrorInfo      string
}

type HostSession

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

func (*HostSession) Exec

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

func (*HostSession) GenerateConfig

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

func (*HostSession) Transfer

func (exec *HostSession) Transfer(id int, localFilePath string, remoteFilePath string, config ssh.ClientConfig) *ExecResult

type SSHExecAgent

type SSHExecAgent struct {
	Worker  int
	TimeOut time.Duration
}

func (*SSHExecAgent) SftpHostByKey

func (s *SSHExecAgent) SftpHostByKey(hosts []string, user string, localFilePath string, remoteFilePath string) ([]ExecResult, error)

这里的host要带端口信息

func (*SSHExecAgent) SshHostByKey

func (s *SSHExecAgent) SshHostByKey(hosts []string, user string, cmd string) ([]ExecResult, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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