tty

package
v0.0.0-...-18ff31d Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MsgIDWrite   = "Write"
	MsgIDWinSize = "WinSize"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type MsgTTYWinSize

type MsgTTYWinSize struct {
	Cols int
	Rows int
}

type MsgTTYWrite

type MsgTTYWrite struct {
	Data []byte
	Size int
}

type MsgWrapper

type MsgWrapper struct {
	Type string
	Data []byte
}

Message used to encapsulate the rest of the bessages bellow

type OnMsgWinSize

type OnMsgWinSize func(cols, rows int)

type OnMsgWrite

type OnMsgWrite func(data []byte)

type PTYHandler

type PTYHandler interface {
	Write(data []byte) (int, error)
	Refresh()
}

type TTYProtocolWSLocked

type TTYProtocolWSLocked struct {
	// contains filtered or unexported fields
}

func NewTTYProtocolWSLocked

func NewTTYProtocolWSLocked(ws *websocket.Conn) *TTYProtocolWSLocked

func (*TTYProtocolWSLocked) ReadAndHandle

func (handler *TTYProtocolWSLocked) ReadAndHandle(onWrite OnMsgWrite, onWinSize OnMsgWinSize) (err error)

func (*TTYProtocolWSLocked) SetWinSize

func (handler *TTYProtocolWSLocked) SetWinSize(cols, rows int) (err error)

func (*TTYProtocolWSLocked) Write

func (handler *TTYProtocolWSLocked) Write(buff []byte) (n int, err error)

Function to send data from one the sender to the server and the other way around.

type TTYShareSession

type TTYShareSession struct {
	// contains filtered or unexported fields
}

func NewTTYShareSession

func NewTTYShareSession(ptyHandler PTYHandler) *TTYShareSession

func (*TTYShareSession) HandleWSConnection

func (session *TTYShareSession) HandleWSConnection(wsConn *websocket.Conn)

Will run on the TTYReceiver connection go routine (e.g.: on the websockets connection routine) When HandleWSConnection will exit, the connection to the TTYReceiver will be closed

func (*TTYShareSession) WindowSize

func (session *TTYShareSession) WindowSize(cols, rows int) error

func (*TTYShareSession) Write

func (session *TTYShareSession) Write(data []byte) (int, error)

Jump to

Keyboard shortcuts

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