ssh

package
v2.2.27 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2024 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MsgData   = '1'
	MsgResize = '2'
)

Variables

This section is empty.

Functions

func NewSSHClient

func NewSSHClient(conf *ClientConfig) (*ssh.Client, error)

Types

type AuthMethod

type AuthMethod int8
const (
	PASSWORD AuthMethod = iota + 1
	PUBLICKEY
)

type ClientConfig

type ClientConfig struct {
	AuthMethod AuthMethod
	HostAddr   string
	User       string
	Password   string
	KeyPath    string
	Timeout    time.Duration
}

func ClientConfigPassword

func ClientConfigPassword(hostAddr, user, Password string) *ClientConfig

func ClientConfigPublicKey

func ClientConfigPublicKey(hostAddr, user, keyPath string) *ClientConfig

type Resize

type Resize struct {
	Columns int
	Rows    int
}

type Turn

type Turn struct {
	StdinPipe io.WriteCloser
	Session   *ssh.Session
	WsConn    *websocket.Conn
}

func NewTurn

func NewTurn(wsConn *websocket.Conn, sshClient *ssh.Client) (*Turn, error)

func (*Turn) Close

func (t *Turn) Close() error

func (*Turn) LoopRead

func (t *Turn) LoopRead(logBuff *bytes.Buffer, context context.Context) error

func (*Turn) Read

func (t *Turn) Read(p []byte) (n int, err error)

func (*Turn) SessionWait

func (t *Turn) SessionWait() error

func (*Turn) Write

func (t *Turn) Write(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

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