sshkit

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildClientByProperty

func BuildClientByProperty(property *SSHProperty) (*ssh.Client, error)

func BuildClientConfig

func BuildClientConfig(user string, password string, privateKeys []string) (*ssh.ClientConfig, error)

func PtyClient

func PtyClient(client *ssh.Client, term string, h, w int, modes ssh.TerminalModes) error

func PtySession

func PtySession(session *ssh.Session, term string, h, w int, modes ssh.TerminalModes) error

func Run

func Run(client *ssh.Client, cmd string) (string, error)

func RunBatch

func RunBatch(client *ssh.Client, cmds []string) (*shellkit.ResultTotal, error)

func SimplePty

func SimplePty(client *ssh.Client) error

func SimplePtyByProperty

func SimplePtyByProperty(property *SSHProperty) error

func SimplePtyFlat

func SimplePtyFlat(addr string, user string, pwd string, prik string) error

func SimplePtySession

func SimplePtySession(session *ssh.Session) error

func TunnelServe

func TunnelServe(lAddress string, mediumProperty *SSHProperty, dAddress string) error

Types

type SSHProperty

type SSHProperty struct {
	Id         string `yaml:"id"`
	Addr       string `yaml:"addr"`
	User       string `yaml:"user"`
	Password   string `yaml:"password"`
	PublicKey  string `yaml:"publicKey"`
	PrivateKey string `yaml:"privateKey"`
}

func NewSSHConfigDefaultId

func NewSSHConfigDefaultId(addr string) *SSHProperty

func NewSSHConfigSpecifyId

func NewSSHConfigSpecifyId(id string, addr string) *SSHProperty

func (SSHProperty) GenSSHClientConfig

func (p SSHProperty) GenSSHClientConfig() (*ssh.ClientConfig, error)

func (SSHProperty) GetPrivateKey

func (p SSHProperty) GetPrivateKey() (string, error)

type SSHPropertyPool

type SSHPropertyPool struct {
	SSHParams []*SSHProperty
}

func GetSingleton

func GetSingleton() *SSHPropertyPool

func (*SSHPropertyPool) Get

func (pool *SSHPropertyPool) Get(id string) (*SSHProperty, error)

func (*SSHPropertyPool) Put

func (pool *SSHPropertyPool) Put(config *SSHProperty)

func (*SSHPropertyPool) PutMulti

func (pool *SSHPropertyPool) PutMulti(configs []*SSHProperty)

func (*SSHPropertyPool) PutNew

func (pool *SSHPropertyPool) PutNew(id string, addr string) *SSHProperty

Jump to

Keyboard shortcuts

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