sshc

package
v0.0.0-...-c6ccdbd Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmptyClient = errors.New("no client connect")
)

ErrEmptyClient ...

View Source
var (
	ErrEmptyCredential = errors.New("no password nor private key provided")
)

ErrEmptyCredential ...

Functions

This section is empty.

Types

type Cmd

type Cmd struct {
	Command     string
	Out, Errout io.Writer
}

type Credential

type Credential struct {
	Username, Pwd string
	PEMPrivateKey []byte
	PrivateKeyPwd []byte
	// contains filtered or unexported fields
}

Credential use pwd or private key

func NewCredentialWithKeyData

func NewCredentialWithKeyData(user string, data []byte, pwd string) (*Credential, error)

NewCredentialWithKeyData ...

func NewCredentialWithKeyfile

func NewCredentialWithKeyfile(user, filename, pwd string) (*Credential, error)

NewCredentialWithKeyfile ...

func NewCredentialWithPwd

func NewCredentialWithPwd(user, pwd string) (*Credential, error)

NewCredentialWithPwd ...

type Target

type Target struct {
	Addr string // IP or hostname
	Port int
	Credential
	// contains filtered or unexported fields
}

Target reprenet a ssh server

func NewTarget

func NewTarget(addr string, port int, c Credential) *Target

NewTarget ...

func (*Target) Close

func (t *Target) Close() error

Close connection

func (*Target) Connect

func (t *Target) Connect() error

Connect to target, should call Close afterwards

func (*Target) Run

func (t *Target) Run(c Cmd) error

Run each clientConn can support multiple interactive sessions.

Jump to

Keyboard shortcuts

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