sss
Source files: 43 · checked against Etemenanki 3723395 · katana v6.1.0
Etemenanki/protocols/src/sss/mod.rsEtemenanki/protocols/src/sss/protocol.rsEtemenanki/protocols/src/sss/varint.rsEtemenanki/protocols/src/sss/users.rsEtemenanki/protocols/src/sss/server.rsEtemenanki/protocols/src/sss/core.rsEtemenanki/protocols/src/sss/codec.rsEtemenanki/protocols/src/sss/client.rsEtemenanki/protocols/src/core/mod.rsEtemenanki/supervisor/src/serve.rsEtemenanki/supervisor/src/build/inbound.rsEtemenanki/supervisor/src/build/outbound.rsEtemenanki/supervisor/src/build/users.rsEtemenanki/supervisor/src/build/validate.rsEtemenanki/supervisor/src/entity/usage.rsEtemenanki/supervisor/src/topology/inbound/mod.rsEtemenanki/supervisor/src/topology/outbound/mod.rsEtemenanki/supervisor/src/topology/spec_plan/mod.rsEtemenanki/supervisor/src/topology/spec_plan/inbound.rsEtemenanki/supervisor/src/topology/spec_plan/outbound.rsEtemenanki/app/src/config.rsEtemenanki/app/src/lower.rsEtemenanki/app/src/subscribe.rsEtemenanki/subscribe/src/lib.rsEtemenanki/subscribe/src/proxy_servers.rsEtemenanki/protocols/tests/unit/sss/protocol.rsEtemenanki/protocols/tests/unit/sss/varint.rsEtemenanki/protocols/tests/unit/sss/server.rsEtemenanki/protocols/tests/unit/sss/core.rsEtemenanki/protocols/tests/unit/sss/codec.rsEtemenanki/supervisor/tests/sss.rsEtemenanki/supervisor/tests/unit/serve.rsEtemenanki/app/tests/integration/e2e_sss.rskatana/src/api/mod.rskatana/src/api/helium.rskatana/src/api/newv2board.rskatana/src/lower/inbound.rskatana/src/manager/node.rskatana/tests/unit/api/helium.rskatana/tests/unit/api/newv2board.rskatana/tests/unit/lower/inbound.rskatana/tests/unit/manager/node.rskatana/tests/unit/e2e.rs
sss is the project’s own stream proxy protocol: one request header that names a user, a command and a target, then the flow’s bytes verbatim, with no response header and no cryptography of its own. What sets it apart is the transform layer between the sss framing and the transport, a per-direction chain of reversible codecs that both ends configure identically; sss transforms covers that layer and TransformStream, the adapter every sss endpoint reads and writes through. The specification is the sss whitepaper; the code cites its sections (§II-D, §V, §VIII) in comments.
This page covers the rest of protocols/src/sss/: the wire primitives, the server’s pre-authentication gate accept, the sans-I/O server core SssCore, the client codecs SssStream and SssDatagram and the dialer SssConnector, and then how the supervisor serves an sss inbound and builds an sss outbound, and how etemenanki-app, subscribe files and katana lower their settings into a spec.
Responsibilities
Section titled “Responsibilities”| The module does | It leaves to others |
|---|---|
| Parse and write the request header and the UDP datagram record, checking every byte as it arrives. | The transforms and the call/flush discipline: protocols/src/sss/transform/. |
Gate a server stream before authentication: the header time T_h, the budget B_pre, and a refusal that drains or falls back without revealing why. |
Accepting sockets, the transport handshakes and the handshake and connection permits: the supervisor’s listener and supervisor/src/serve.rs. |
| Authenticate the 16-byte UUID by exact match and attach the user to the flow. | Routing, dialing and accounting: the per-connection runtime, the AppConnector and the session. |
| Relay a TCP flow verbatim, and a UDP stream as one record per datagram, each with its own peer. | Confidentiality: the transports underneath, TLS above all. |
| Encode the header and the records on the client side, and wrap the dialed transport in the client’s chains. | Config parsing: the front ends lower their config into an InboundProtocolSpec::Sss or OutboundProtocolSpec::Sss. |
Transforms are sss’s alone: no other protocol is configured with a chain, and there is no generic transform layer under protocols/src/transports/. sss is always compiled; there is no cargo feature for it or for zstd.
Module layout
Section titled “Module layout”| File | Contents |
|---|---|
protocols/src/sss/mod.rs |
Re-exports ClientSettings, SssConnector, SssStream, SssDatagram, SssCore, Command, Accepted, Reject, RejectReason, Rejection, ServerSettings, accept, Validator. |
protocols/src/sss/protocol.rs |
Constants, Command, Request, Packet; parse_request, parse_address, parse_packet; put_request, put_address, write_address, packet_header, put_packet. |
protocols/src/sss/varint.rs |
The three-byte LEB128 varint: encode, put, read, and the incremental Reader. |
protocols/src/sss/users.rs |
Validator<T> and SssUser<T>: the user table keyed by the UUID’s 16 bytes. |
protocols/src/sss/server.rs |
ServerSettings, Reject, RejectReason, accept, Accepted, Rejection and its drain and fallback relay. |
protocols/src/sss/core.rs |
SssCore<T>, the server as a ProxyCoreDecode, and Outcome, the connect result it logs. |
protocols/src/sss/codec.rs |
SssStream and SssDatagram, the client as ProxyCoreEncode and ProxyCoreEncodeDatagram codecs. |
protocols/src/sss/client.rs |
ClientSettings and SssConnector<C>, the Connector that dials through C and wraps the stream. |
protocols/src/sss/transform/ |
The transform layer; see sss transforms. |
Wire format
Section titled “Wire format”Request header
Section titled “Request header”uuid[16] | cmd[1] | atyp[1] | addr | port[2]| Field | Values |
|---|---|
uuid |
The user’s UUID, all 16 bytes significant |
cmd |
0x01 TCP (CMD_TCP), 0x02 UDP (CMD_UDP) |
atyp |
0x01 IPv4, 4 bytes; 0x03 domain, len[1] | name[len]; 0x04 IPv6, 16 bytes |
port |
Big-endian |
A domain is 1 to 255 bytes, every one printable ASCII 0x21..=0x7e, and is carried unresolved. The longest header, with a 255-byte domain, is HEADER_MAX = 16 + 1 + ADDRESS_MAX (259) = 276 bytes. For UDP the header’s destination is the first datagram’s.
parse_request and parse_address work on a growing slice: Ok(None) while incomplete, Ok(Some((value, length))) once complete, and an error at the first byte that proves the header wrong. An unknown cmd fails as soon as it arrives (sss: unknown command), an unknown atyp likewise (sss: unknown address type), a zero domain length as soon as the length byte is in (sss: empty domain), and a domain byte outside the range before the rest of the name has arrived (sss: domain byte outside 0x21..=0x7e). write_address refuses a Remote::Domain the wire cannot carry (is_valid_domain) instead of truncating it.
Datagram record
Section titled “Datagram record”atyp[1] | addr | port[2] | len (varint) | data[len]After a UDP header, both directions carry these records back to back. From the client a record’s address is where the datagram goes; from the server it is where the datagram came from, always an IP address. len is at most the datagram limit U (udp_max_datagram, at most MAX_DATAGRAM = 65535); parse_packet passes U as the varint’s cap, so a record announcing more is refused on the length byte that exceeds it, before its data. PACKET_HEADER_MAX = 259 + 3 bounds a record’s header.
Varints
Section titled “Varints”varint.rs implements the whitepaper’s varint: unsigned LEB128, low seven bits first, at most MAX_LEN = 3 bytes, so values below LIMIT = 2^21. A varint longer than one byte must not end in 0x00 (sss: varint not minimally encoded), and a fourth byte is refused (sss: varint longer than three bytes). Every varint field has a cap below 2^21, and Reader::push checks the value against the cap after each byte (sss: varint exceeds its field's cap), so a length is refused before the bytes it describes. Reader keeps its place between calls for decoders that are fed in pieces (zstd, pad).
Key types
Section titled “Key types”Wire primitives
Section titled “Wire primitives”pub enum Command { Tcp, Udp } // network() → DialNetwork
pub struct Request { pub uuid: [u8; 16], pub command: Command, pub destination: Destination, // the first datagram's, for UDP}
pub struct Packet { pub peer: Destination, // network = Udp pub data: Range<usize>, // within the parsed slice pub consumed: usize, // the whole record}
pub fn parse_request(data: &[u8]) -> Result<Option<(Request, usize)>, ProtocolError>;pub fn parse_packet(data: &[u8], limit: u16) -> Result<Option<Packet>, ProtocolError>;pub fn packet_header(peer: &Destination, len: usize) -> Result<([u8; PACKET_HEADER_MAX], usize), ProtocolError>;packet_header writes a record header into a stack array, so the core and the datagram codec stage a header without allocating.
Validator
Section titled “Validator”pub struct Validator<T> { users: HashMap<[u8; 16], SssUser<T>> }pub struct SssUser<T> { pub name: CompactString, pub data: Arc<T> }
impl<T> Validator<T> { pub fn add(&mut self, id: Uuid, name: impl Into<CompactString>, data: Arc<T>); pub fn get(&self, id: &[u8; 16]) -> Option<&SssUser<T>>;}A lookup is an exact match on all 16 bytes in a hash map, so it costs the same for any number of users. Unlike VLESS’s processed UUID, no byte is ignored. The UUID is a bearer credential; Validator’s Debug prints names only.
Server settings and the gate
Section titled “Server settings and the gate”pub struct ServerSettings { pub up: Chain, // client to server: decoded here pub down: Chain, // server to client: encoded here pub max_datagram: u16, // U, default 65535 pub header_timeout: Duration, // T_h, default DEFAULT_HEADER_TIMEOUT = 10 s pub reject: Reject, // default Drain pub flush_delay: Duration, // t_c, default zero}
pub enum Reject { Drain, Fallback(SocketAddr) }
pub async fn accept<S, T>(stream: S, settings: &ServerSettings, users: &Validator<T>) -> Accepted<S>;
pub enum Accepted<S> { Admitted { stream: TransformStream<S>, command: Command }, Rejected(Rejection<S>),}Rejection<S> keeps the stream, a RejectReason, the deadline and the Reject; reason() returns the reason, falls_back() says whether run() will relay to a fallback, and run() drains or falls back.
SssCore
Section titled “SssCore”pub struct SssCore<T> { /* validator, sniff, source, max_datagram, timing, prefix, state, user, recorded */ }
impl<T> SssCore<T> { pub const TCP_BUF_SIZE: usize = 16 * 1024; pub const UDP_BUF_SIZE: usize = 66 * 1024; // a whole record of U = 65535 pub fn new(validator: Arc<Validator<T>>, max_datagram: u16, sniff: bool, source: Option<IpAddr>) -> Self; pub fn is_established(&self) -> bool;}
impl<T: Send + Sync + 'static> ProxyCoreDecode for SssCore<T> { type Key = FlowKey; type Target = Flow<T>; type Error = io::Error; type TransportAddr = (); const STAGING_RESERVE: usize = PACKET_HEADER_MAX; // one record header beyond its data const MAX_DATAGRAM: usize = 65535;}The core runs over the decoded side of a TransformStream, so it sees sss bytes only. sss streams carry no frames of their own, which is why TCP and UDP get different buffer sizes: a TCP runtime needs no more than any stream protocol, while a UDP runtime must hold one whole record.
Client codecs and connector
Section titled “Client codecs and connector”pub struct SssStream { header: io::Result<Vec<u8>> }impl SssStream { pub fn new(uuid: &[u8; 16], dest: &Destination) -> Self; }
pub struct SssDatagram { header: io::Result<Vec<u8>>, max_datagram: u16 }impl SssDatagram { pub fn new(uuid: &[u8; 16], dest: &Destination, max_datagram: u16) -> Self; }
pub struct ClientSettings { pub up: Chain, pub down: Chain, pub max_datagram: u16, pub flush_delay: Duration }pub struct SssConnector<C> { inner: C, settings: ClientSettings }impl<C: Connector<Destination, Datagram = NoDatagram>> Connector<Destination> for SssConnector<C> { type Stream = TransformStream<C::Stream>; /* … */}Both codecs implement ProxyCoreEncodeHandshake with STAGING_RESERVE = HEADER_MAX. The header is encoded in new; a destination the wire cannot carry is kept as an error and fails the flow in start.
Data flow
Section titled “Data flow”flowchart TB L["listener and transport handshake"] --> SV["serve_sss"] SV --> A["sss::accept: TransformStream with up decoder, down encoder, budget"] A -->|"header complete, known UUID"| AD["Accepted::Admitted"] A -->|"anything else"| RJ["Accepted::Rejected"] AD -->|"cmd 0x01"| T["drive SssCore, TCP_BUF_SIZE"] AD -->|"cmd 0x02"| U["drive SssCore, UDP_BUF_SIZE"] RJ -->|"Reject::Drain"| D["read and discard until EOF or T_h"] RJ -->|"Reject::Fallback"| F["connect, replay the raw record, relay"] F -->|"unreachable before T_h"| D
The server’s gate
Section titled “The server’s gate”accept runs before any runtime or core exists. It implements whitepaper §V and §VI: a stream either delivers a complete header naming a known user within both limits, or it is refused, and the server’s behaviour must not depend on which check failed or how many bytes came first.
- The deadline is
T_hfrom the call. Aheader_timeouttoo long to represent is treated as a year. - The budget is
settings.up.prefix_budget(),B_pre = X_C(276): the most raw transport bytes a valid header can take through theupchain (see Bounds). - The stream is wrapped as
TransformStream::new(stream, down.encoder(), up.decoder())with the flush delay andwith_budget(budget). WithReject::Fallback, it is alsorecording(), so the raw bytes read under the budget are kept. peek_header(parse_request)runs undertimeout_at(deadline). It decodes transport reads untilparse_requestfinds a complete header, and leaves the decoded bytes unread.- A header whose UUID is in
userscallsauthenticated(), which lifts the budget and drops the record, and returnsAdmitted. The core then reads the same header again from the stream.
Everything else becomes a Rejection with a RejectReason, classified in this order:
| Outcome of the peek | RejectReason |
Display |
|---|---|---|
Complete header, UUID not in users |
UnknownUser |
unknown uuid |
parse_request returned an error |
Header |
malformed header |
UnexpectedEof from the transport |
Truncated |
transport ended before the header |
Any other error with pre_auth_read() >= budget |
Budget |
no header within the budget |
| Any other error | Decode |
decode error |
| The deadline passed | Timeout |
no header within the header time |
RejectReason is a category safe to log, never a byte of what the peer sent.
Rejection::run then:
- Drains (
Reject::Drain): reads into a thread-local 4 KiB scratch and discards until the peer closes or the deadline passes, and returns. Nothing is ever written, and the close is orderly, not a reset. The deadline is the sameT_hdeadline the header had, so a refused stream lasts no longer than one still waiting for its header. - Falls back (
Reject::Fallback(addr)): takes the record, unwraps the raw transport, and connects toaddrwithTcpStream::connectunder the same deadline. If the connect fails or times out, it drains instead (logged atdebugassss: fallback <addr> unreachable, draining: …orsss: fallback <addr> timed out, draining). Otherwise it writes the record and relays both ways withBidirectionalConnection<_, _, 8192>, ending when both directions are done or whenRELAY_IDLE_TIMEOUT(300 s) passes without a byte moving (sss: fallback idle).
The record holds the bytes the transport delivered, before the up decoders: on a ws or grpc inbound that is the message payloads, not the HTTP request that opened them.
Server state machine
Section titled “Server state machine”SssCore is a sans-I/O ProxyCoreDecode over the decoded stream. Its states:
| State | Entered when | Transport bytes |
|---|---|---|
Handshake |
The core is built | parse_request; an unknown UUID is PermissionDenied (sss: unknown user). The core is built from the same table the gate checked, so behind the gate this does not happen. |
Sniff(Flow) |
A TCP header to an address worth_sniffing, with sniffing on |
Pushed into SniffPrefix until it returns a verdict other than More |
Tcp(Passthrough) |
A TCP header without sniffing, or the sniff window ends | Passthrough::on_transport: forwarded verbatim |
Udp |
A UDP header | Every complete record becomes Effect::SendTo to its own peer, with the data’s range in place |
Done |
The stream is over | Discarded |
On the header, the core resolves the user, records the user’s name for its log lines, and builds the Flow with a NetworkUser whose authorization is UsernamePassword { username: <name>, password: "" } and whose payload is the user’s data. Then:
- TCP opens
FlowKey::Directtoward the header’s destination withEffect::Openand entersPhase::Relay; bytes sniffed so far go out withEffect::ForwardHeld. The client’s payload follows the header with no reply; a refused connect ends the relay (on_outbound_gone) and the stream closes without a byte written. - UDP opens the datagram flow at once, toward the header’s destination, so the access policy sees a UDP stream when it is accepted, as it sees a TCP one. Every record is then sent to its own peer.
Other events:
| Event | Tcp |
Udp |
|---|---|---|
Outbound { data } |
Passthrough::on_outbound: verbatim to the client |
Ignored |
Datagram { from, data } |
Ignored | Data above U is dropped (logged at debug); otherwise packet_header(from) and the data are staged; a full staging area is an error |
TransportEof |
Half-close toward the target | The association is over: Close, ShutdownTransport, Finish |
OutboundEof |
Half-close toward the client | Ignored |
ConnectFailed, OutboundError |
on_outbound_gone |
ShutdownTransport and Finish |
SendFailed { to } |
Logged at debug; the stream goes on |
|
Deadline |
Shared Timing: an expired handshake is client did not complete its request in time, an expired sniff window opens the flow, an idle relay finishes |
Same |
TransportEof in Handshake or Done finishes; in Sniff it opens the flow with what was sniffed and then half-closes it.
The first Connected or ConnectFailed is recorded once as an Outcome, from Outcome::of(&io::Error) (ConnectionRefused or ConnectionReset → refused, TimedOut → timeout, PermissionDenied → policy rejection, NotFound → resolution failure, anything else → unreachable). The log line names the user, never the UUID.
Client side
Section titled “Client side”SssConnector::connect dials through its inner connector and wraps the stream in TransformStream::new(stream, up.encoder(), down.decoder()) with the client’s flush delay. The client runtime writes and flushes the request header before the flow counts as connected, so the header is one flushed call of its own, which is what the server’s budget assumes. Payload follows at once; there is no reply to wait for.
SssStream::startstages the header and returnsHandshake::Done.sealcopies plaintext verbatim;opentakes whatever arrived.replyis an error (sss: the server sends no reply), because the runtime never asks for one afterDone.SssDatagram::seal_towrites one record per datagram, addressed toto. A datagram aboveUis dropped and reported as sent, as a link drops a packet above its MTU. When the staging area has no room for the whole record it answersNoneand the runtime retries later.SssDatagram::open_fromparses one record and returns its data range and peer. A record whose address is a domain fails the stream (sss: a datagram from the server names a domain, not its source address).
Supervisor wiring
Section titled “Supervisor wiring”Spec and validation
Section titled “Spec and validation”InboundProtocolSpec::Sss { transport, settings: SssServerSettings } and OutboundProtocolSpec::Sss { upstream, id, settings: SssClientSettings } (supervisor/src/topology/spec_plan/) carry the protocol crate’s own settings types, re-exported from spec_plan with SssChain, SssChainError and SssReject. A chain in a spec is already parsed and bounded.
validate.rs checks:
| Check | Error |
|---|---|
An sss inbound has a user set (needs_users) |
the protocol has no open mode and needs a user set |
U at least 1 (sss_limits, inbound and outbound) |
sss udp_max_datagram must be at least 1 |
t_c at most MAX_FLUSH_DELAY (inbound and outbound) |
sss flush_delay must be at most 10ms |
T_h above zero (inbound) |
sss header_timeout must be above zero |
| No REALITY shape under anything but VLESS (the generic transport rule) | reality is for vless only |
build/users.rs gives sss the CredentialKind::Uuid, so two users with one UUID are refused like VLESS and VMess users. build/inbound.rs builds UserTable::Sss(Validator<Principal>), and the live inbound holds it as StreamProtocol::Sss { users: ArcSwap<Validator<Principal>>, settings: Arc<ServerSettings> }, so a user-set change swaps the table without touching settings.
serve_sss
Section titled “serve_sss”serve_connection boxes serve_sss: its runtime sits over a TransformStream as well as the transport, and every other protocol’s connection future would otherwise grow to its size.
serve_sss is a plain function that returns gate.then(…), not an async fn. The gate (sss::accept) and what follows it are two states of one future, so what the gate holds, and the arguments only the second state uses, are not stored beside the runtime. an_sss_connections_future_holds_one_runtime_and_little_besides in supervisor/tests/unit/serve.rs pins this: the whole future is at most the UDP runtime’s size plus 1 KiB.
After the gate:
- Admitted:
drive::<{ SssCore::<Principal>::TCP_BUF_SIZE }, …>for a TCP stream, orUDP_BUF_SIZEfor a UDP one, building the core from the user table loaded at accept,max_datagram, sniffing and the client’s address.drivereleases the handshake permit once the core is established, as for every stream protocol. - Rejected: logged at
debugas<tag>: sss stream from <source> refused: <reason>, thenrejection.run(). A drained stream keeps its handshake permit, as a stream still waiting for its header would. A fallback releases it: the stream is past the handshake, like REALITY’s camouflage. TheAppConnectorlives as long as the drain or fallback, because it holds the connection’s session and dropping it would end the connection early.
A refusal is never reported to the ban guard: what the server does must not depend on which check failed, and an IP ban would make it depend.
Accounting
Section titled “Accounting”drive counts the session’s wire from the runtime’s own transport counts, and the sss runtime’s transport is the decoded side of the TransformStream. So an sss session is charged sss bytes after the chains are undone, as whitepaper §VIII asks, while other stream protocols are charged their protocol stream after the transport (supervisor/src/entity/usage.rs). the_user_is_charged_sss_bytes_not_what_the_transforms_send in supervisor/tests/sss.rs pins it.
Outbound
Section titled “Outbound”pub struct SssOutbound { pub tcp: ProxyClient<SSS_TCP_BUF, SssStream, NoUdp, SssConnector<TransportConnector>>, pub udp: ProxyClient<SSS_UDP_BUF, NoUdp, SssDatagram, SssConnector<TransportConnector>>,}build/outbound.rs wraps the upstream’s TransportConnector in one SssConnector per kind and builds SssStream::new(&uuid, &flow.destination) or SssDatagram::new(&uuid, &flow.destination, max_datagram) per flow. Each TCP flow and each UDP flow is one sss stream. The two kinds get runtimes sized like the server’s.
Front ends
Section titled “Front ends”| Front end | Where | What it does |
|---|---|---|
| etemenanki-app inbound | app/src/config.rs → SssInboundSettings, SssTransformCfg, SssChainCfg; app/src/lower.rs → lower_inbound, lower_sss_inbound, lower_sss_chains, lower_sss_reject |
Users through InlineUsers (UUID and email). Each direction is an untagged SssChainCfg: One(String), one expression, or List(Vec<String>), expressions run in order, an empty list by default; lower_sss_chains hands either to SssChain::parse and prefixes its error with transform.up or transform.down. Durations go through parse_duration ("10s", "5ms", digits only). reject is read as a raw toml::Value and checked by lower_sss_reject: "drain", or a table holding exactly fallback = "ip:port"; any other key is refused by name |
| etemenanki-app outbound | SssOutboundSettings; lower_outbound, lower_sss_chains, lower_sss_limits |
id, chains, udp_max_datagram (default 65535) and flush_delay (default zero) |
| Subscribe files | subscribe/src/proxy_servers.rs → Sss, SssTransform; app/src/subscribe.rs |
A node carries id, transform, udp_max_datagram and stream, but no flush_delay; it becomes an [[outbound]] with protocol = "sss". SssTransform holds each direction as a Vec<String> of expressions, so a subscribe file writes a list even for one expression; the strings are stored as written and parsed when the outbound is built. subscribe::VERSION is the revision a client announces as etemenanki-subscribe/<VERSION>; sss nodes are for revision 1.1 and later. |
| katana | src/api/mod.rs → NodeType::Sss, Node; src/api/helium.rs → node_info; src/api/newv2board.rs → Client::new; src/lower/inbound.rs → lower_sss; src/manager/node.rs → disruptive_part |
Only a helium panel describes an sss node: protocol sss with its port, transport and security, and of sss’s own settings only transform (up and down) and udp_max_datagram. helium’s answer is helium-node-api’s node config, which goes to lowering as it is, and it carries no flush delay, header time or fallback, so lower_sss gives the node the defaults of SssServerSettings: T_h of 10 s, t_c of zero and draining, and U of 65535 when the panel leaves udp_max_datagram out. lower_sss parses the chains with SssChain::parse, refusing one it cannot parse with sss transform.up: … or sss transform.down: …, and leaves U to the supervisor’s checks. The chains are part of what disruptive_part compares, so a change to them closes every session of the node: a client holding the old chains decodes nothing the new ones send. A newV2board node configured with node_type = "sss" is refused when its client is built, so --test, a start and a reload all refuse it with newV2board: no UniProxy panel describes an sss node; sss is Helium's own protocol, served with panel_type = "Helium". |
Every front end writes the chains in the whitepaper’s notation and both directions from the client’s view, so one pair of chains serves a server, its clients, a subscribe file and a panel. A front end that holds a list (a subscribe file, a helium panel) can carry any chain the app’s single expression can, one expression per item or all of it in one item.
Invariants
Section titled “Invariants”- No byte of a refused stream reaches the core or a connector, and the server writes nothing to it. A drain and a stream still waiting for its header look the same from outside.
- A server reads at most
B_preraw transport bytes before authentication, and for at mostT_h. - The header is parsed twice, once by the gate and once by the core, from the same decoded bytes; the gate leaves them unread.
- A UUID lookup is an exact 16-byte match; the UUID is never logged or printed by
Debug. - Every length on the wire is checked against its cap before the bytes it covers are read.
- The client sends the header as one flushed call, before any payload.
- A record the server sends names an IP address; a client refuses one that names a domain.
- Usage counts the decoded side of the transform stream.
Failure paths and cancellation
Section titled “Failure paths and cancellation”| Situation | Result |
|---|---|
| Header fails before authentication | Refused with its RejectReason, then drained or handed to the fallback |
Fallback unreachable before T_h |
Drained |
| Decode error after admission | The TransformStream read fails, and every later read fails too; the runtime ends the connection (sss connection from … ended: …) |
| Transport ends inside a record or group | A truncation error, not a clean EOF |
| TCP connect fails | The relay ends; nothing is written to the client |
| UDP outbound gone or connect failed | ShutdownTransport and Finish |
A datagram above U from the target |
Dropped |
A record above U from the client |
The varint cap fails the stream |
| Connection dropped by the supervisor | The future is dropped in whichever state it is; a drain or fallback holds nothing beyond its sockets, the scratch is thread-local |
Limits
Section titled “Limits”| Limit | Value | Where |
|---|---|---|
| Request header | 276 bytes decoded | HEADER_MAX |
Header time T_h |
header_timeout, default 10 s, above zero |
DEFAULT_HEADER_TIMEOUT, validate.rs |
Pre-authentication budget B_pre |
X_C(276) of the up chain, at most 1 MiB |
Chain::prefix_budget, MAX_PREFIX |
Datagram limit U |
1 to 65535, default 65535 | MAX_DATAGRAM, sss_limits |
Flush delay t_c |
0 to 10 ms | MAX_FLUSH_DELAY |
| Runtime buffer | 16 KiB TCP, 66 KiB UDP | SssCore::TCP_BUF_SIZE, UDP_BUF_SIZE |
| Drain scratch | 4 KiB per thread | server.rs → SCRATCH |
| Fallback relay | 8 KiB buffers, 300 s idle | relay, RELAY_IDLE_TIMEOUT |
| Test file | Pins |
|---|---|
protocols/tests/unit/sss/protocol.rs, varint.rs |
Header and record parsing byte by byte, early errors, varint minimality and caps |
protocols/tests/unit/sss/server.rs |
a_known_user_is_admitted_with_the_header_left_for_the_core, every_pre_auth_failure_is_classified, an_incomplete_header_times_out_at_t_h, a_drained_stream_writes_nothing_and_closes_when_the_peer_does, a_drained_stream_closes_at_t_h_like_a_waiting_one, a_fallback_gets_every_raw_byte_and_the_relay, an_unreachable_fallback_drains_instead |
protocols/tests/unit/sss/core.rs |
TCP open and relay, an_unknown_uuid_is_permission_denied, UDP routing per record, replies_carry_their_source_and_respect_u, a_record_above_u_fails_the_stream, a_refused_connect_ends_the_stream_without_a_reply, outcome classification, sniffing |
protocols/tests/unit/sss/codec.rs |
The header then plaintext, a_domain_the_wire_cannot_carry_fails_the_flow_at_its_start, records both ways, a_reply_naming_a_domain_is_refused |
supervisor/tests/sss.rs |
An sss outbound to an sss inbound over TCP and UDP, the_user_is_charged_sss_bytes_not_what_the_transforms_send, mismatched_chains_carry_nothing, a_probe_gets_silence_until_it_closes, a_probe_is_handed_to_the_fallback, validation_refuses_bad_limits |
supervisor/tests/unit/serve.rs |
an_sss_connections_future_holds_one_runtime_and_little_besides |
app/tests/integration/e2e_sss.rs |
Two etemenanki-app processes over plain TCP, WebSocket and TLS, TCP and UDP round trips; sss_with_maps_blocks_bwt_and_shape_carries_tcp_and_udp, whose up is one expression of byte codecs, a block and zstd, and whose down is a list with bwt, cycle, baseN, lift2 and shape; and a_probe_reaches_the_fallback_and_nothing_else |
katana tests/unit/api/helium.rs, tests/unit/api/newv2board.rs, tests/unit/lower/inbound.rs, tests/unit/manager/node.rs, tests/unit/e2e.rs |
Reading a helium sss node (every_protocol_helium_writes_is_read), refusing a UniProxy one (an_sss_node_is_refused), lowering it (an_sss_node_lowers_its_chains_and_limits, an_sss_node_defaults_to_identity_and_draining, an_sss_node_refuses_a_chain_it_cannot_parse, sss_users_are_their_uuid), a change to its chains dropping every connection (only_a_disruptive_change_drops_every_connection), and serving it end to end against a fake helium panel (an_sss_node_relays_through_its_chains_and_meters) |