ssh

package
v0.0.0-...-dd1dd92 Latest Latest
Warning

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

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

Documentation

Index

Constants

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

Variables

View Source
var BufPool = sync.Pool{
	New: func() interface{} {
		return new(bytes.Buffer)
	},
}

Functions

func NewSSHClient

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

Types

type AuthModel

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

type Resize

type Resize struct {
	Columns int
	Rows    int
}

type SSHClientConfig

type SSHClientConfig struct {
	AuthModel  AuthModel
	HostAddr   string
	User       string
	Password   string
	PrivateKey string
	Timeout    time.Duration
}

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