wire

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CodeUnsupportedVersion = "UNSUPPORTED_VERSION"
	CodeDecodeError        = "DECODE_ERROR"
	CodeNoHandler          = "NO_HANDLER"
	CodeFrameTooLarge      = "FRAME_TOO_LARGE"
)

Error codes in TypeError frames.

View Source
const (
	ReasonShutdown = "SHUTDOWN"
	ReasonPeerLost = "PEER_LOST"
)

Reason codes in TypeDisconnect frames.

View Source
const (
	TypeIdent       byte = 0x01 // trusted-mode only: initiator declares its NodeID
	TypeDisconnect  byte = 0x03 // payload is Disconnect
	TypeError       byte = 0x04 // payload is WireError
	TypeApplication byte = 0x10 // payload is Envelope
)

Variables

This section is empty.

Functions

func Encode

func Encode(f Frame) []byte

Encode returns [1-byte type][payload]. Length-prefix framing is the transport's responsibility.

Types

type Disconnect

type Disconnect struct {
	ReasonCode    string
	ReasonMessage string
}

Disconnect is the TypeDisconnect payload.

type Envelope

type Envelope struct {
	Protocol string
	Type     string
	Payload  []byte
}

Envelope multiplexes application messages over a single connection.

type Frame

type Frame struct {
	Type    byte
	Payload []byte
}

Frame is a decoded wire frame.

func Decode

func Decode(data []byte) (Frame, error)

type WireError

type WireError struct {
	ErrorCode    string
	ErrorMessage string
}

WireError is the TypeError payload.

Jump to

Keyboard shortcuts

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