Documentation
¶
Index ¶
Constants ¶
const ( // Unknown message type, maybe sent by a bug UnknownInput = '0' // User input typically from a keyboard Input = '1' // Ping to the server Ping = '2' // Notify that the browser size has been changed ResizeTerminal = '3' // Change encoding SetEncoding = '4' )
const ( // Unknown message type, maybe set by a bug UnknownOutput = '0' // Normal output to the terminal Output = '1' // Pong to the browser Pong = '2' // Set window title of the terminal SetWindowTitle = '3' // Set terminal preference SetPreferences = '4' // Make terminal to reconnect SetReconnect = '5' // Set the input buffer size SetBufferSize = '6' )
Variables ¶
var ( // ErrSlaveClosed indicates the function has exited by the slave ErrSlaveClosed = errors.New("slave closed") // ErrSlaveClosed is returned when the slave connection is closed. ErrMasterClosed = errors.New("master closed") )
var Protocols = []string{"webtty"}
Functions ¶
Types ¶
type KttydSlave ¶
type Master ¶
type Master io.ReadWriter
type Option ¶
Option is an option for WebTTY.
func WithFixedColumns ¶
WithFixedColumns sets a fixed width to TTY master.
func WithFixedRows ¶
WithFixedRows sets a fixed height to TTY master.
func WithMasterPreferences ¶
WithMasterPreferences sets an optional configuration of master.
func WithPermitWrite ¶
func WithPermitWrite() Option
WithPermitWrite sets a WebTTY to accept input from slaves.
func WithReconnect ¶
WithReconnect enables reconnection on the master side.
func WithWindowTitle ¶
WithWindowTitle sets the default window title of the session
type WebTTY ¶
type WebTTY struct {
// contains filtered or unexported fields
}
func NewWebTTY ¶
New creates a new instance of WebTTY. masterConn is a connection to the PTY master, typically it's a websocket connection to a client. slave is a PTY slave such as a local command with a PTY.
func (*WebTTY) Run ¶
Run starts the main process of the WebTTY. This method blocks until the context is canceled. Note that the master and slave are left intact even after the context is canceled. Closing them is caller's responsibility. If the connection to one end gets closed, returns ErrSlaveClosed or ErrMasterClosed.