Wire frame for the reverse co-driving tunnel.
A single outbound link carries many logical channels, demultiplexed by
channel_id. Four frame kinds ride the link (ported from omnigent's
ws.open / ws.frame / ws.close plus a hello handshake):
:hello-- sent once by the host after it dials out; carries its identity and capabilities.channel_idisnil.:open-- open a new channel; payload%{"path", "meta"}. The opener allocates thechannel_id; the peer spawns the channel's local handler.:data-- channel I/O; payload%{"data", "binary"}(base64 when binary).:close-- close a channel; payload%{"code", "reason"}.
Frames serialize to JSON so any byte transport (a real WebSocket, an in-memory
link) can carry them. Decoding maps the kind through an explicit whitelist --
never String.to_atom/1 on link input.
Summary
Functions
A close frame for channel_id.
A data frame carrying data for channel_id.
Decode a JSON binary from the link into a frame.
Serialize a frame to a JSON binary for the link.
A host hello frame announcing identity + capabilities.
Generate a fresh channel id (4 random bytes, lowercase hex).
An open frame for channel_id targeting path with optional meta.
Decode a data frame's payload back to its raw bytes/text.
Types
Functions
@spec close(binary(), non_neg_integer(), binary()) :: t()
A close frame for channel_id.
A data frame carrying data for channel_id.
Text data rides verbatim; pass binary: true to base64-encode arbitrary bytes.
Decode a JSON binary from the link into a frame.
Serialize a frame to a JSON binary for the link.
A host hello frame announcing identity + capabilities.
@spec new_channel_id() :: binary()
Generate a fresh channel id (4 random bytes, lowercase hex).
An open frame for channel_id targeting path with optional meta.
Decode a data frame's payload back to its raw bytes/text.