proto

package
v1.0.40 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MsgNewSession   byte = 0x01
	MsgAttach       byte = 0x02
	MsgDetach       byte = 0x03
	MsgInput        byte = 0x04
	MsgResize       byte = 0x05
	MsgNewWindow    byte = 0x06
	MsgCloseWindow  byte = 0x09
	MsgSelectWin    byte = 0x0A
	MsgList         byte = 0x0B
	MsgKillSession  byte = 0x0C
	MsgPaste        byte = 0x13
	MsgHUD          byte = 0x14
	MsgAdminPanel   byte = 0x15 // client → server: open/close admin panel
	MsgAdminAction  byte = 0x16 // client → server: toggle/kick action
	MsgEnableSSH    byte = 0x17 // client → server: start SSH listener (payload: addr)
	MsgEnableWeb    byte = 0x18 // client → server: start web listener (payload: addr)
	MsgScrollMode   byte = 0x19 // client → server: enter/exit scroll mode (payload: [0/1])
	MsgScrollAction byte = 0x1A // client → server: scroll action (payload: [action])
	MsgSendInput    byte = 0x1B // client → server: inject input (payload: "session\x00text")
	MsgReadScreen   byte = 0x1C // client → server: read screen (payload: session name)
)

Message types: client → server

View Source
const (
	MsgOutput      byte = 0x80
	MsgSessionList byte = 0x81
	MsgError       byte = 0x82
	MsgDetached    byte = 0x83
	MsgSessionDead byte = 0x84
	MsgAdminState  byte = 0x85 // server → client: admin panel state
	MsgScreenData  byte = 0x86 // server → client: plain text screen content
)

Message types: server → client

View Source
const (
	WindowNext byte = 0xFF
	WindowPrev byte = 0xFE
)

Window select special values

Variables

This section is empty.

Functions

func Decode

func Decode(r io.Reader) (byte, []byte, error)

Decode reads one message. Returns type and payload.

func DecodeResize

func DecodeResize(b []byte) (cols, rows uint16, err error)

DecodeResize decodes cols and rows from 4 bytes.

func Encode

func Encode(w io.Writer, typ byte, payload []byte) error

Encode writes a message: [type][2-byte big-endian length][payload]. Each call makes exactly one Write call containing the complete message. Bridge adapters (sshBridge, wsBridge) depend on this invariant.

func EncodeResize

func EncodeResize(cols, rows uint16) []byte

EncodeResize encodes cols and rows as 4 bytes.

func MarshalMsg

func MarshalMsg(typ byte, payload []byte) ([]byte, error)

MarshalMsg returns a raw proto message as bytes without writing to a stream. Used by bridge adapters that need to buffer messages before delivery.

Types

This section is empty.

Jump to

Keyboard shortcuts

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