webproto

package
v0.18.2 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2026 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Keep browser DERP/WebSocket packets close to real WireGuard packet
	// sizing. Public DERP accepts larger theoretical packets, but browser
	// WebSocket connections have been observed to close on near-64KiB frames.
	MaxRelayPayloadBytes = 16 << 10

	// WebRTC direct payloads can be larger than relay payloads. Keeping this
	// below common SCTP message-size limits reduces WASM/JS crossings without
	// relying on jumbo DataChannel messages.
	MaxPayloadBytes = 128 << 10
)

Variables

View Source
var (
	ErrInvalidFrame    = errors.New("invalid web relay frame")
	ErrPayloadTooLarge = errors.New("web relay frame payload too large")
)

Functions

func IsWebFrame

func IsWebFrame(raw []byte) bool

func Marshal

func Marshal(kind FrameKind, seq uint64, payload []byte) ([]byte, error)

Types

type Abort

type Abort struct {
	Reason string `json:"reason,omitempty"`
}

type Ack

type Ack struct {
	BytesReceived int64 `json:"bytes_received"`
}

type DirectFailed

type DirectFailed struct {
	Reason string `json:"reason,omitempty"`
}

type DirectReady

type DirectReady struct {
	BytesReceived int64  `json:"bytes_received"`
	NextSeq       uint64 `json:"next_seq"`
}

type Frame

type Frame struct {
	Kind    FrameKind
	Seq     uint64
	Payload []byte
}

func Parse

func Parse(raw []byte) (Frame, error)

type FrameKind

type FrameKind uint8
const (
	FrameClaim FrameKind = iota + 1
	FrameDecision
	FrameMeta
	FrameData
	FrameDone
	FrameAck
	FrameAbort
	FrameWebRTCOffer
	FrameWebRTCAnswer
	FrameWebRTCIceCandidate
	FrameWebRTCIceComplete
	FrameDirectReady
	FramePathSwitch
	FrameDirectFailed
)

type Meta

type Meta struct {
	Name string `json:"name"`
	Size int64  `json:"size"`
}

type PathSwitch

type PathSwitch struct {
	Path          string `json:"path"`
	BytesReceived int64  `json:"bytes_received"`
	NextSeq       uint64 `json:"next_seq"`
}

type WebRTCSignal

type WebRTCSignal struct {
	Lane             int    `json:"lane,omitempty"`
	Kind             string `json:"kind"`
	Type             string `json:"type"`
	SDP              string `json:"sdp,omitempty"`
	Candidate        string `json:"candidate,omitempty"`
	SDPMid           string `json:"sdpMid,omitempty"`
	SDPMLineIndex    int    `json:"sdpMLineIndex,omitempty"`
	UsernameFragment string `json:"usernameFragment,omitempty"`
}

Jump to

Keyboard shortcuts

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