Expand description
Authenticated WebSocket binary-datagram relay (RFC 6455). Local TCP; not a public URL.
Structs§
- Read
Cursor - Partial-read assembly. Oversize / 8-byte / fragmented poisons the cursor.
A short
outafter a complete frame is Capacity and does not drop it. - Write
Cursor - Sealed pending write. WouldBlock retains exact wire bytes;
offadvances only onOk(n > 0). A different payload while pending is Conflict.
Enums§
Constants§
- ENVELOPE_
HDR - ENVELOPE_
VERSION - ENV_
ADDR - ENV_
CHILD - ENV_
SECRET - MAX_
FRAME - MAX_
PAYLOAD - OP_
BINARY - RFC 6455 binary opcode. FIN is set at encode.
- OP_
CLOSE - RFC 6455 close opcode. FIN is set at encode.
- WIRE_
CAP - Sealed WS frame capacity (
WS_HDR_MAX + MAX_FRAME). - WS_
HDR_ MAX - 2-byte base + 2-byte ext-len + 4-byte mask.
Functions§
- accept_
key - RFC 6455 Sec-WebSocket-Accept: base64(SHA-1(key + GUID)).
- check_
circuit_ gen - Bound circuit/generation. Wrong circuit is unauthorized; older/other gen is stale.
- client_
handshake - Drives the client-side WSS handshake on
streamwithkey_b64. - close_
and_ shutdown - Send opcode-8 Close with envelope
(circuit, gen)then TCP half-close. - decode_
envelope - Decodes a frame envelope; fails closed on bad version/obsolete format/truncation.
- dial
- TCP-connects to
addrthen performs client handshake + auth exchange undersecret. - encode_
envelope - Encodes a versioned frame envelope
(type, circuit, gen, len, payload)intoout; fails closed on capacity. - expect_
auth - Reads and verifies the peer’s auth frame; fails closed on mismatch.
- fresh_
client_ mask - Fill a 4-byte client mask from OS entropy. Fail closed on entropy failure.
- hmac_
auth - HMAC-SHA256 over
(circuit, gen)undersecret— per-circuit auth token. - io_
from_ qdnf - Wrap a QDNF outcome as
io::Errorso existingsend_datagramcallers keepio::Result. Bearer paths downcast viamap_io. - local_
authenticated_ wss_ executed - Set after a successful local two-process WSS exchange.
- loopback_
pair - Pair of already-upgraded WebSocket ends (same process).
- map_io
- Map
std::io::Erroronto a QDNF outcome. Recovers a wrappedQdnfError. - recv_
checked - Receive one WS frame, decode the envelope, and refuse wrong circuit / stale gen.
- recv_
datagram - Receives a datagram frame; returns
(circuit, gen, payload). - seal_
close - Seal an application Close envelope as RFC 6455 opcode 8. Same pending close resumes. A pending datagram is Conflict and is not aborted or resealed.
- seal_
datagram - Seal an application envelope as a WS binary frame. Fresh mask only when idle.
- send_
auth - Sends the HMAC auth frame for
(circuit, gen). - send_
datagram - Sends a datagram frame on the circuit.
- serve_
pair - Local two-client hub: first two accepted sockets exchange datagrams after HMAC.
- server_
handshake - Drives the server-side handshake — reads the request, responds with the computed accept key.