signaling

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2026 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const SubprotocolICE = "a2al.ice.v1"

SubprotocolICE is negotiated on the WebSocket used for ICE trickle signaling.

Variables

This section is empty.

Functions

func AppendRoomQuery

func AppendRoomQuery(signalBase, room string) (string, error)

AppendRoomQuery adds or replaces the "room" query parameter on signalBase (absolute ws/wss URL).

func EncodeFrame

func EncodeFrame(f Frame) ([]byte, error)

EncodeFrame CBOR-encodes a frame.

func JoinURL

func JoinURL(relayBase, room string) (string, error)

JoinURL returns a full WebSocket URL including room query for a relay base.

func MustJoinURL

func MustJoinURL(relayBase, room string) string

MustJoinURL is JoinURL that panics on error (for tests with fixed inputs).

func RoomID

func RoomID(aidA, aidB string) string

RoomID is a deterministic 32-hex room name from two agent address strings (sorted).

Types

type Frame

type Frame struct {
	T string `cbor:"t"`
	U string `cbor:"u,omitempty"` // ufrag (cred)
	P string `cbor:"p,omitempty"` // pwd (cred)
	C string `cbor:"c,omitempty"` // ice candidate Marshal string
}

Frame is a CBOR envelope on the signaling WebSocket. T is "cred" | "cand" | "eoc".

func DecodeFrame

func DecodeFrame(b []byte) (Frame, error)

DecodeFrame decodes a CBOR frame.

type Relay

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

Relay is a minimal WebSocket relay: two clients joining the same ?room= are paired and their binary frames are forwarded bidirectionally. Intended for tests and small-scale deployments.

func StartRelay

func StartRelay(addr string) (*Relay, error)

StartRelay listens on addr (e.g. "127.0.0.1:0") and serves the relay.

func (*Relay) BaseURL

func (r *Relay) BaseURL() string

BaseURL returns ws://host:port (no trailing slash).

func (*Relay) Close

func (r *Relay) Close() error

Jump to

Keyboard shortcuts

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