Expand description
TCP and UDP relay (docs/design/net.md): opcodes, flags, and the message builders both ends share. TCP and UDP relay wire protocol (docs/design/net.md). A raw socket relay: the client names a host and port, the server opens a socket, and the two ends shuttle payload.
Structs§
- NetOpen
- A parsed
C2S_NET_OPEN.
Constants§
- C2S_
NET_ ACK - Cumulative byte-window credit, TCP only: [0x82][stream_id:2][bytes:8]
- C2S_
NET_ CLOSE - Close or half-close: [0x83][stream_id:2][flags:1]
- C2S_
NET_ DATA - Stream payload, TCP only: [0x81][stream_id:2][data:N]
- C2S_
NET_ DGRAM - One datagram, UDP only: [0x84][stream_id:2][payload:N]
- C2S_
NET_ OPEN - Open a socket: [0x80][stream_id:2][flags:1][port:2][host_len:2][host:N] + TLS block The TLS block ([sni_len:2][sni:N][alpn_count:1] repeated{[proto_len:1][proto:N]}) is present iff
NET_OPEN_TLSis set. - FEATURE_
NET S2C_HELLOfeature bit: server supports theNET_*family (docs/design/net.md).- NET_
CLOSED_ BUDGET - Retention or stream budget exceeded.
- NET_
CLOSED_ EOF NET_CLOSED.reason: the target closed cleanly (TCP).- NET_
CLOSED_ POLICY - Closed by the server: policy reload, target revoked.
- NET_
CLOSED_ RESET - Connection reset by the target, or ICMP unreachable on a UDP flow.
- NET_
CLOSED_ SHUTDOWN - Server or blit connection going away.
- NET_
CLOSED_ TIMEOUT - Idle timeout — the normal end of a UDP flow.
- NET_
CLOSE_ WRITE NET_CLOSE.flagsbit 0: shut down the client’s write side only, leaving the stream readable.- NET_
DGRAM_ QUEUE - Per-direction datagram queue depth on a UDP flow.
- NET_
MAX_ CHUNK - Maximum
NET_DATA/NET_DGRAMpayload. - NET_
MAX_ DGRAM - Maximum UDP payload — UDP’s own limit, which fits inside
NET_MAX_CHUNK. - NET_
MAX_ HOST - Maximum
hostlength in bytes. - NET_
MAX_ SOCKETS - Maximum concurrent sockets per blit connection, streams and flows together.
- NET_
OPEN_ FLAGS_ KNOWN - Every defined
NET_OPENflag; anything else isINVALID. - NET_
OPEN_ INSECURE NET_OPEN.flagsbit 1: skip certificate and hostname verification.- NET_
OPEN_ TLS NET_OPEN.flagsbit 0: terminate TLS toward the target; relayed bytes are the plaintext stream.- NET_
OPEN_ UDP NET_OPEN.flagsbit 2: open a UDP datagram flow rather than a TCP stream.- NET_
STATUS_ BUDGET - Concurrent-socket or memory budget exhausted.
- NET_
STATUS_ INVALID - Malformed request: unknown flags, empty host, live
stream_id,INSECUREwithoutTLS, TLS block absent withTLSset,UDPcombined withTLSorINSECURE. - NET_
STATUS_ NOT_ FOUND hostdid not resolve.- NET_
STATUS_ OK NET_OPENED.status.- NET_
STATUS_ OTHER - Anything else; diagnostic in
detail. - NET_
STATUS_ PERMISSION - Target refused by policy (docs/design/net.md § Target policy).
- NET_
STATUS_ REFUSED - Connect refused, unreachable, or timed out.
- NET_
STATUS_ TLS - TLS handshake or certificate verification failed.
- NET_
STATUS_ UNKNOWN_ ID stream_idunknown or already closed.- NET_
WINDOW_ AGGREGATE - Default aggregate unacked-byte window across all of a connection’s streams, so N streams cannot each claim a full window.
- NET_
WINDOW_ BYTES - Default per-stream unacked-byte window.
- S2C_
NET_ ACK - Cumulative byte-window credit, TCP only: [0x82][stream_id:2][bytes:8]
- S2C_
NET_ CLOSED - Socket ended: [0x83][stream_id:2][reason:1][detail_len:2][detail:N] On a UDP flow
detailcarries the drop counts, both directions. - S2C_
NET_ DATA - Stream payload, TCP only: [0x81][stream_id:2][data:N]
- S2C_
NET_ DGRAM - One datagram, UDP only: [0x84][stream_id:2][payload:N]
- S2C_
NET_ OPENED - Open result, one per
NET_OPEN: [0x80][stream_id:2][status:1][alpn_len:1][alpn:N][detail_len:2][detail:N]
Functions§
- is_
c2s_ net - True for any C2S opcode in the family’s
0x80block, for dispatch. - msg_
net_ ack_ c2s - msg_
net_ ack_ s2c - msg_
net_ close - msg_
net_ closed - msg_
net_ data_ c2s - msg_
net_ data_ s2c - msg_
net_ dgram_ c2s - msg_
net_ dgram_ s2c - msg_
net_ open - msg_
net_ opened - net_
closed_ text - Human-readable form of a
NET_CLOSED.reason, for CLI diagnostics. - net_
status_ text - Human-readable form of a
NET_OPENED.status, for CLI diagnostics. - parse_
net_ ack_ c2s - parse_
net_ ack_ s2c - parse_
net_ close - Parse a
C2S_NET_CLOSE→(stream_id, flags). - parse_
net_ closed - Parse an
S2C_NET_CLOSED→(stream_id, reason, detail). - parse_
net_ data_ c2s - parse_
net_ data_ s2c - parse_
net_ dgram_ c2s - parse_
net_ dgram_ s2c - parse_
net_ open - Parse a
C2S_NET_OPEN. - parse_
net_ opened - Parse an
S2C_NET_OPENED→(stream_id, status, alpn, detail).