protocol

package
v0.0.0-...-1f0cc76 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	DumpPlain          uint8 = 0    // Plain text, no escape sequences.
	DumpVT             uint8 = 1    // VT with colors (safe for display).
	DumpHTML           uint8 = 2    // HTML (reserved).
	DumpFlagUnwrap     uint8 = 0x10 // Bit 4: join soft-wrapped lines.
	DumpFlagScrollback uint8 = 0x20 // Bit 5: include scrollback history.
	DumpFormatMask     uint8 = 0x0F // Bits 0-3: format selector.
)
View Source
const (
	// Client → Daemon
	TypeAttach  uint8 = 0x01
	TypeInput   uint8 = 0x02
	TypeResize  uint8 = 0x03
	TypeDetach  uint8 = 0x04
	TypeList    uint8 = 0x05
	TypeKill    uint8 = 0x06
	TypeSend    uint8 = 0x07
	TypeDump    uint8 = 0x08
	TypePrune   uint8 = 0x09
	TypeSendKey uint8 = 0x0A
	TypeStatus  uint8 = 0x0C

	// Daemon → Client
	TypeOK             uint8 = 0x80
	TypeError          uint8 = 0x81
	TypeOutput         uint8 = 0x82
	TypeState          uint8 = 0x83
	TypeSessions       uint8 = 0x84
	TypeExited         uint8 = 0x85
	TypeDumpResponse   uint8 = 0x86
	TypePruneResponse  uint8 = 0x87
	TypeClientsChanged uint8 = 0x88
	TypeStatusResponse uint8 = 0x89
)
View Source
const (
	ProtocolVersion uint8 = 6
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Attach

type Attach struct {
	Name            string
	Cols            uint16
	Rows            uint16
	Xpixel          uint16
	Ypixel          uint16
	Command         []string
	Env             []string
	ScrollbackLines uint32
	CWD             string
	ReadOnly        bool
}

func (*Attach) Type

func (m *Attach) Type() uint8

type ClientsChanged

type ClientsChanged struct {
	Count uint16
	Cols  uint16
	Rows  uint16
}

func (*ClientsChanged) Type

func (m *ClientsChanged) Type() uint8

type Conn

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

func NewConn

func NewConn(rw io.ReadWriter) *Conn

func (*Conn) AcceptHandshake

func (c *Conn) AcceptHandshake() (uint8, string, error)

Caller must check the version and call AcceptVersion or close.

func (*Conn) AcceptVersion

func (c *Conn) AcceptVersion(version uint8, revision string) error

func (*Conn) Handshake

func (c *Conn) Handshake(version uint8, revision string) (uint8, string, error)

func (*Conn) ReadMessage

func (c *Conn) ReadMessage() (Message, error)

func (*Conn) WriteMessage

func (c *Conn) WriteMessage(msg Message) error

Frame: [u32 length][u8 type][payload...]

type DaemonStatus

type DaemonStatus struct {
	PID          uint32
	Uptime       uint32
	SocketPath   string
	RunningCount uint32
	DeadCount    uint32
	Version      string
}

type Decoder

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

func NewDecoder

func NewDecoder(r io.Reader) *Decoder

func (*Decoder) ReadBool

func (d *Decoder) ReadBool() (bool, error)

func (*Decoder) ReadBytes

func (d *Decoder) ReadBytes() ([]byte, error)

func (*Decoder) ReadI32

func (d *Decoder) ReadI32() (int32, error)

func (*Decoder) ReadString

func (d *Decoder) ReadString() (string, error)

func (*Decoder) ReadU8

func (d *Decoder) ReadU8() (uint8, error)

func (*Decoder) ReadU16

func (d *Decoder) ReadU16() (uint16, error)

func (*Decoder) ReadU32

func (d *Decoder) ReadU32() (uint32, error)

func (*Decoder) ReadU64

func (d *Decoder) ReadU64() (uint64, error)

type Detach

type Detach struct {
	Name string // Empty = detach self, non-empty = detach named session.
}

func (*Detach) Type

func (m *Detach) Type() uint8

type Dump

type Dump struct {
	Name   string
	Format uint8
}

func (*Dump) Type

func (m *Dump) Type() uint8

type DumpResponse

type DumpResponse struct {
	Data []byte
}

func (*DumpResponse) Type

func (m *DumpResponse) Type() uint8

type Encoder

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

func NewEncoder

func NewEncoder(w io.Writer) *Encoder

func (*Encoder) WriteBool

func (e *Encoder) WriteBool(v bool) error

func (*Encoder) WriteBytes

func (e *Encoder) WriteBytes(v []byte) error

func (*Encoder) WriteI32

func (e *Encoder) WriteI32(v int32) error

func (*Encoder) WriteString

func (e *Encoder) WriteString(v string) error

func (*Encoder) WriteU8

func (e *Encoder) WriteU8(v uint8) error

func (*Encoder) WriteU16

func (e *Encoder) WriteU16(v uint16) error

func (*Encoder) WriteU32

func (e *Encoder) WriteU32(v uint32) error

func (*Encoder) WriteU64

func (e *Encoder) WriteU64(v uint64) error

type Error

type Error struct {
	Code    uint16
	Message string
}

func (*Error) Type

func (m *Error) Type() uint8

type Exited

type Exited struct {
	ExitCode int32
}

func (*Exited) Type

func (m *Exited) Type() uint8

type Input

type Input struct {
	Data []byte
}

func (*Input) Type

func (m *Input) Type() uint8

type Kill

type Kill struct {
	Name string
}

func (*Kill) Type

func (m *Kill) Type() uint8

type List

type List struct{}

func (*List) Type

func (m *List) Type() uint8

type Message

type Message interface {
	Type() uint8
	// contains filtered or unexported methods
}

type OK

type OK struct {
	SessionName string
	Cols        uint16
	Rows        uint16
	PID         uint32
	Created     bool
}

func (*OK) Type

func (m *OK) Type() uint8

type Output

type Output struct {
	Data []byte
}

func (*Output) Type

func (m *Output) Type() uint8

type Prune

type Prune struct{}

func (*Prune) Type

func (m *Prune) Type() uint8

type PruneResponse

type PruneResponse struct {
	Count uint32
}

func (*PruneResponse) Type

func (m *PruneResponse) Type() uint8

type Resize

type Resize struct {
	Cols   uint16
	Rows   uint16
	Xpixel uint16
	Ypixel uint16
}

func (*Resize) Type

func (m *Resize) Type() uint8

type Send

type Send struct {
	Name string
	Data []byte
}

func (*Send) Type

func (m *Send) Type() uint8

type SendKey

type SendKey struct {
	Name    string
	KeyCode uint32
	Mods    uint32
}

func (*SendKey) Type

func (m *SendKey) Type() uint8

type Session

type Session struct {
	Name      string
	State     string
	Cols      uint16
	Rows      uint16
	PID       uint32
	CreatedAt uint32
	CWD       string
}

type SessionStatus

type SessionStatus struct {
	Name           string
	State          string
	Cols           uint16
	Rows           uint16
	PID            uint32
	CWD            string
	ClientCount    uint32
	ClientVersions []string
}

type Sessions

type Sessions struct {
	Sessions []Session
}

func (*Sessions) Type

func (m *Sessions) Type() uint8

type State

type State struct {
	ScreenDump        []byte
	CursorRow         uint32
	CursorCol         uint32
	IsAlternateScreen bool
}

func (*State) Type

func (m *State) Type() uint8

type Status

type Status struct {
	SessionName string
}

func (*Status) Type

func (m *Status) Type() uint8

type StatusResponse

type StatusResponse struct {
	Daemon  DaemonStatus
	Session *SessionStatus
}

func (*StatusResponse) Type

func (m *StatusResponse) Type() uint8

Jump to

Keyboard shortcuts

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