sshutils

package
v0.0.0-...-c4045bc Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SSH

type SSH struct {
	User               string
	Password           string
	PrivateKeyFileName string
	PrivateKeyPassword string
	AuthMethod         string
	Timeout            *time.Duration
}

func (*SSH) ExecCommand

func (ss *SSH) ExecCommand(host string, cmd string) (resp []byte, err error)

func (*SSH) GetAuthMethod

func (ss *SSH) GetAuthMethod() (auth []ssh.AuthMethod)

func (*SSH) GetSSHClientConfig

func (ss *SSH) GetSSHClientConfig(user string) *ssh.ClientConfig

任何一个ssh连接都必须有一个该连接相关的配置,*ssh.ClientConfig,

1.config: config是客户端和服务端必须共同的一些配置, 2.user: 连接所使用的用户名 3.Auth: 4.HostKeyCallback: 5.BannerCallback: 6.HostKeyAlgorithms: 7.Timeout:

func (*SSH) GetSSHSession

func (ss *SSH) GetSSHSession() *ssh.Session

func (*SSH) NewSSHClient

func (ss *SSH) NewSSHClient(user string, host string) *ssh.Client

func (*SSH) NewSSHSession

func (ss *SSH) NewSSHSession() *ssh.Session

type SSHClient

type SSHClient *ssh.Client

type SSHClientConfig

type SSHClientConfig *ssh.ClientConfig

type SSHSession

type SSHSession struct {
	User    string
	Host    string
	Auth    string
	Session *ssh.Session
}

func (*SSHSession) Close

func (ss *SSHSession) Close(cmd string)

func (*SSHSession) CombinedOutput

func (ss *SSHSession) CombinedOutput(cmd string)

func (*SSHSession) Output

func (ss *SSHSession) Output(cmd string)

func (*SSHSession) Run

func (ss *SSHSession) Run(cmd string)

func (*SSHSession) SetEnv

func (ss *SSHSession) SetEnv(cmd string)

func (*SSHSession) Start

func (ss *SSHSession) Start(cmd string)

Jump to

Keyboard shortcuts

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