@fkn/lib/wire
Type Aliases
Section titled “Type Aliases”ConnectFailure
Section titled “ConnectFailure”type ConnectFailure = keyof typeof CONNECT_ERRNOS;TcpSocketOption
Section titled “TcpSocketOption”type TcpSocketOption = | { type: typeof TCP_OPTION_NODELAY; value: boolean;} | { type: typeof TCP_OPTION_TTL; value: number;} | { enabled: boolean; initialDelaySeconds: number; type: typeof TCP_OPTION_KEEPALIVE;} | { type: typeof TCP_OPTION_SEND_BUFFER_SIZE; value: number;} | { type: typeof TCP_OPTION_RECV_BUFFER_SIZE; value: number;};UdpPortAckMessage
Section titled “UdpPortAckMessage”type UdpPortAckMessage = object;Properties
Section titled “Properties”consumedBytes
Section titled “consumedBytes”consumedBytes: number;type: typeof UDP_PORT_ACK_TYPE;UdpSocketOption
Section titled “UdpSocketOption”type UdpSocketOption = | { type: typeof UDP_OPTION_BROADCAST; value: boolean;} | { type: typeof UDP_OPTION_TTL; value: number;} | { type: typeof UDP_OPTION_MULTICAST_TTL_V4; value: number;} | { type: typeof UDP_OPTION_MULTICAST_LOOP_V4; value: boolean;} | { type: typeof UDP_OPTION_MULTICAST_LOOP_V6; value: boolean;} | { group: Uint8Array; interface: Uint8Array; type: typeof UDP_OPTION_ADD_MEMBERSHIP_V4;} | { group: Uint8Array; interface: Uint8Array; type: typeof UDP_OPTION_DROP_MEMBERSHIP_V4;} | { group: Uint8Array; ifIndex: number; type: typeof UDP_OPTION_ADD_MEMBERSHIP_V6;} | { group: Uint8Array; ifIndex: number; type: typeof UDP_OPTION_DROP_MEMBERSHIP_V6;} | { type: typeof UDP_OPTION_SEND_BUFFER_SIZE; value: number;} | { type: typeof UDP_OPTION_RECV_BUFFER_SIZE; value: number;};Variables
Section titled “Variables”SITE_RESET_MESSAGE
Section titled “SITE_RESET_MESSAGE”const SITE_RESET_MESSAGE: "read ECONNRESET" = 'read ECONNRESET';What a socket fails with when its site resets the connection: Node’s own error for it on Linux (Node 26.12.1 against a site that resets, measured 2026-11-11). The data plane fails the socket’s stream with it, and since an error crossing realms keeps only its name and message, the library gives back the rest by the message.
TCP_OPTION_KEEPALIVE
Section titled “TCP_OPTION_KEEPALIVE”const TCP_OPTION_KEEPALIVE: 2;TCP_OPTION_NODELAY
Section titled “TCP_OPTION_NODELAY”const TCP_OPTION_NODELAY: 0;Socket option codes as they appear on the WebVPN wire, and the option shapes built from them. Also the ack a UDP data-port consumer posts back to the broker that produces the port’s batches.
Owned by the library so both sides share one source: the packet codecs in
src/api/webvpn/packets/ import from this file, and the library needs nothing from the app.
The VALUES are protocol: the u8 discriminant of a tagged union inside a TcpSetOption or UdpSetOption client packet (metadata-stream tag 8). A relay built against these numbers deploys independently of any browser holding this file, so renumbering one is a wire break. Booleans go on the wire as u8, 0 for false and anything else true.
TCP_OPTION_RECV_BUFFER_SIZE
Section titled “TCP_OPTION_RECV_BUFFER_SIZE”const TCP_OPTION_RECV_BUFFER_SIZE: 4;TCP_OPTION_SEND_BUFFER_SIZE
Section titled “TCP_OPTION_SEND_BUFFER_SIZE”const TCP_OPTION_SEND_BUFFER_SIZE: 3;TCP_OPTION_TTL
Section titled “TCP_OPTION_TTL”const TCP_OPTION_TTL: 1;UDP_OPTION_ADD_MEMBERSHIP_V4
Section titled “UDP_OPTION_ADD_MEMBERSHIP_V4”const UDP_OPTION_ADD_MEMBERSHIP_V4: 5;UDP_OPTION_ADD_MEMBERSHIP_V6
Section titled “UDP_OPTION_ADD_MEMBERSHIP_V6”const UDP_OPTION_ADD_MEMBERSHIP_V6: 7;UDP_OPTION_BROADCAST
Section titled “UDP_OPTION_BROADCAST”const UDP_OPTION_BROADCAST: 0;UDP_OPTION_DROP_MEMBERSHIP_V4
Section titled “UDP_OPTION_DROP_MEMBERSHIP_V4”const UDP_OPTION_DROP_MEMBERSHIP_V4: 6;UDP_OPTION_DROP_MEMBERSHIP_V6
Section titled “UDP_OPTION_DROP_MEMBERSHIP_V6”const UDP_OPTION_DROP_MEMBERSHIP_V6: 8;UDP_OPTION_MULTICAST_LOOP_V4
Section titled “UDP_OPTION_MULTICAST_LOOP_V4”const UDP_OPTION_MULTICAST_LOOP_V4: 3;UDP_OPTION_MULTICAST_LOOP_V6
Section titled “UDP_OPTION_MULTICAST_LOOP_V6”const UDP_OPTION_MULTICAST_LOOP_V6: 4;UDP_OPTION_MULTICAST_TTL_V4
Section titled “UDP_OPTION_MULTICAST_TTL_V4”const UDP_OPTION_MULTICAST_TTL_V4: 2;UDP_OPTION_RECV_BUFFER_SIZE
Section titled “UDP_OPTION_RECV_BUFFER_SIZE”const UDP_OPTION_RECV_BUFFER_SIZE: 10;UDP_OPTION_SEND_BUFFER_SIZE
Section titled “UDP_OPTION_SEND_BUFFER_SIZE”const UDP_OPTION_SEND_BUFFER_SIZE: 9;UDP_OPTION_TTL
Section titled “UDP_OPTION_TTL”const UDP_OPTION_TTL: 1;UDP_PORT_ACK_INTERVAL_BYTES
Section titled “UDP_PORT_ACK_INTERVAL_BYTES”const UDP_PORT_ACK_INTERVAL_BYTES: number;UDP_PORT_ACK_TYPE
Section titled “UDP_PORT_ACK_TYPE”const UDP_PORT_ACK_TYPE: "webvpn-udp-port-ack" = 'webvpn-udp-port-ack';Functions
Section titled “Functions”connectError()
Section titled “connectError()”function connectError( code, address, port): Error & object;What a socket fails with when its connect to address does, as Node 26.12.1 gives it on Linux (measured 2026-11-15):
refused, timed out, and no route to the host or its network. The data plane throws it, and the library gives back the
fields from the message, through fromDataPlane.
Parameters
Section titled “Parameters”"ECONNREFUSED" | "ETIMEDOUT" | "EHOSTUNREACH" | "ENETUNREACH"
address
Section titled “address”string
number
Returns
Section titled “Returns”Error & object
fromDataPlane()
Section titled “fromDataPlane()”function fromDataPlane<T>(error): Error | T;The Node error a data plane error’s message names, whole again after crossing realms, or the error itself.
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”T
Returns
Section titled “Returns”Error | T
lookupError()
Section titled “lookupError()”function lookupError(hostname): Error & object;What a socket to hostname fails with when the name has no address, as Node 26.12.1 gives it on Linux.
Parameters
Section titled “Parameters”hostname
Section titled “hostname”string
Returns
Section titled “Returns”Error & object
siteResetError()
Section titled “siteResetError()”function siteResetError(): Error & object;Returns
Section titled “Returns”Error & object