sss
sss is a small stream proxy protocol of the Etemenanki project. A client opens one transport stream per proxied connection and sends one request header: the user’s UUID, a command and a target address. After that, payload flows verbatim in both directions; the server sends no response header. Between the sss bytes and the transport sits what makes sss different: a transform chain for each direction, a composition of reversible codecs (RFC 4648 text encoding, byte stuffing, zstd compression, record framing, HTTP chunking, padding, byte substitutions, block permutations and word mixes, the Burrows-Wheeler transform, constant-weight shaping) that both ends configure identically.
etemenanki-app speaks sss as a server (protocol = "sss" in an [[inbound]], since etemenanki-app 2.7.0) and as a client (in an [[outbound]]), and katana serves sss nodes since 4.10.0, for helium alone since 5.0.0 (katana nodes). Xray and sing-box do not speak it.
At a glance
Section titled “At a glance”| Inbound (server) | Outbound (client) | |
|---|---|---|
| Credentials | users = [{ id = "…", email = "…" }], a UUID and a name per user |
id = "…", one UUID |
| Transports | tcp, tls, ws and grpc; ws and grpc with or without TLS; a Unix socket |
tcp, tls, ws and grpc |
| REALITY | Refused | Refused |
| TCP | Yes | Yes, one stream per flow |
| UDP | Yes, always on | Yes, one stream per UDP flow; every datagram carries its own address |
| Transform chains | transform = { up = …, down = … }, each one expression or a list of them |
The same two chains |
| Response header | None | None: payload follows the request header at once |
| mux | No | No |
| A stream that fails before authentication | Drained in silence, or handed to a fallback address | Not applicable |
Minimal example
Section titled “Minimal example”A server that accepts sss over WebSocket and TLS on port 443, and a client that offers a local SOCKS port and sends everything to it. Both run the same chains: byte stuffing from client to server, zstd from server to client.
# An sss server over WebSocket and TLS on port 443, with two users and a direct exit.# Replace the certificate paths, the domain and the UUIDs before you use it.
[log]level = "info"
[[inbound]]tag = "sss-in"protocol = "sss"listen = "0.0.0.0"port = 443
# sss encrypts nothing, the user's UUID included: keep TLS under the WebSocket.[inbound.stream]network = "ws"security = "tls"
[inbound.stream.ws]path = "/sss"
[inbound.stream.tls]cert_file = "/etc/etemenanki/fullchain.pem"key_file = "/etc/etemenanki/privkey.pem"
[inbound.settings]users = [ { id = "11111111-2222-3333-4444-555555555555", email = "alice@example.com" }, { id = "11111111-2222-3333-4444-666666666666", email = "bob@example.com" },]# The chains, written from the client's view: up is client to server, down is# server to client. Every client of this inbound must write the same two lists.transform = { up = ["stuff(f=0x00,k=5)"], down = ["zstd(c=16384)"] }udp_max_datagram = 65535 # the same on both endsheader_timeout = "10s"# A stream that fails before authentication is read and discarded until the# client closes it or header_timeout passes. To hand it to a real site instead:# reject = { fallback = "127.0.0.1:8080" }reject = "drain"
[[outbound]]tag = "direct"protocol = "freedom"
[[outbound]]tag = "block"protocol = "blackhole"
[route]default = "direct"
# Keep clients away from the server's own private networks.[[route.rule]]outbound = "block"cidr = ["10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16", "127.0.0.0/8", "fc00::/7", "::1/128"]# A local SOCKS proxy that sends everything, TCP and UDP, to an sss server over WebSocket and TLS.# Replace the server address, the domain and the UUID with your server's values.
[log]level = "info"
[[inbound]]tag = "socks-in"protocol = "socks"listen = "127.0.0.1"port = 1080
[[outbound]]tag = "proxy"protocol = "sss"server = "203.0.113.10" # the address to dialport = 443
[outbound.stream]network = "ws"security = "tls"
[outbound.stream.ws]path = "/sss" # must match the serverhost = "proxy.example.com" # the Host header of the upgrade request
[outbound.stream.tls]server_name = "proxy.example.com" # SNI, and the name the certificate is checked against
[outbound.settings]id = "11111111-2222-3333-4444-555555555555"# Exactly the server's chains and datagram limit.transform = { up = ["stuff(f=0x00,k=5)"], down = ["zstd(c=16384)"] }udp_max_datagram = 65535flush_delay = "0ms" # this end's own; at most 10ms
[route]default = "proxy"Check each file with etemenanki-app --test -c server.toml before you start it. --test parses every transform, so a typo in a chain stops the configuration. It cannot tell whether the two ends’ chains match: that shows only when a client connects, usually as a stream the server refuses (see Transform chains).
Generate a real UUID for each user with uuidgen or cat /proc/sys/kernel/random/uuid.
Inbound settings
Section titled “Inbound settings”These keys go in [inbound.settings] of an inbound with protocol = "sss". The common inbound keys (tag, listen, port, sniffing, stream) are described on the inbounds page.
| Key | Type | Required | Default | Description |
|---|---|---|---|---|
users | array of tables | no | [] | The users allowed to connect, one table per user, each identified by a UUID. The keys of an entry are id and email, as on a VLESS inbound. |
users[].id | string | yes | — | The user's UUID, in the forms a VLESS inbound accepts. All 16 bytes are compared: unlike VLESS, no group of the UUID is ignored. Two users cannot share a UUID (users … and … present the same credential). |
users[].email | string | yes | — | The name this user is known by, unique within the inbound. It never goes on the wire. |
transform | table | no | { up = [], down = [] } | The two transform chains, written from the client's view: up is what clients send (this inbound decodes it), down what this inbound sends back (it encodes it). Each is one expression in the transform notation, composed right to left ("baseN()|zstd()" runs zstd first), or an array of expressions run in the order written (["zstd()", "baseN()"]). Each direction compiles to at most 32 transforms. An empty or absent list is the identity. Every client must write the same two chains. |
udp_max_datagram | u16 | no | 65535 | The largest datagram one UDP record carries, from 1 to 65535. Both ends must set the same value. A reply larger than this is dropped; a record from the client that announces more fails its stream. |
flush_delay | string | no | "0ms" | How long this end may hold a flush back to gather more input into the same call, written with its unit ("5ms"). At most 10ms. The first flush of a stream is never held. Each end sets its own. |
header_timeout | string | no | "10s" | How long a stream has, from the moment the transport hands it over, to deliver a complete request header: "10s" or "500ms". Must be above zero. A stream refused before authentication is also drained for at most this long. |
reject | string or table | no | "drain" | What a stream refused before authentication gets: "drain" reads and discards until the client closes or header_timeout passes, then closes; { fallback = "127.0.0.1:8080" } replays the bytes received so far to that ip:port over TCP and relays the two connections from then on. The table holds fallback and nothing else: any other key is refused by name. A host name is refused. |
Durations are written with their unit, s or ms, and digits only: "10s", "500ms", "0ms". Anything else fails with flush_delay "5" is not a duration like "10s" or "5ms".
A reload that removes a user, or changes its UUID, closes that user’s open connections. Other users’ connections carry on.
Outbound settings
Section titled “Outbound settings”These keys go in [outbound.settings] of an outbound with protocol = "sss". The outbound also needs the common keys server and port, and address_family decides how the server’s name is resolved; see the outbounds page.
| Key | Type | Required | Default | Description |
|---|---|---|---|---|
id | string | yes | — | The UUID to authenticate with; it must match a users[].id on the server. Same accepted forms as a VLESS outbound. Leaving it out fails with invalid settings: missing field, a malformed value with invalid uuid. |
transform | table | no | { up = [], down = [] } | The server's two chains, exactly as the server writes them: up is what this outbound sends (it encodes it), down what the server sends back (it decodes it). Same notation and limits as the inbound. |
udp_max_datagram | u16 | no | 65535 | The server's datagram limit, from 1 to 65535. A datagram larger than this is dropped before it is sent. |
flush_delay | string | no | "0ms" | This end's own flush delay, at most 10ms; see the inbound key. It need not match the server's. The flush that carries the request header is never held. |
The outbound does not multiplex. Every TCP flow, and every UDP flow, opens its own connection to the server: TCP, then TLS, then the WebSocket upgrade or HTTP/2 connection when the transport has one. Because it has a server and port, an sss outbound can be a member of a balancer.
Transform chains
Section titled “Transform chains”Each direction of an sss stream passes through its own chain. On the way out, the chain encodes the sss bytes one transform after another, and the last one’s output goes onto the transport. On the way in, the decoders run in the reverse order.
A direction is written as one expression, or as a list of expressions:
# zstd compresses the sss bytes, then baseN turns the frames into text.transform = { up = "baseN()|zstd()", down = [] }# The same up chain as a list, run in the order written.transform = { up = ["zstd()", "baseN()"], down = [] }- In an expression,
|composes from right to left:A|Bencodes withBfirst and then withA, asA(B(x))reads.zstd()|mtf8()|bwt()runsbwt, thenmtf8, thenzstd. - A list runs its expressions in the order written, the first one nearest the sss framing. Inside each item,
|still runs right to left:["zstd()", "baseN()|stuff()"]runszstd,stuff, thenbaseN. upis the client-to-server direction anddownthe server-to-client direction, on both ends. The server decodesupand encodesdown; the client encodesupand decodesdown. So the two ends write identical chains.- An empty list, an absent key or
identity()is the identity: bytes pass unchanged. - The two directions are independent and need not use the same transforms.
- There is no negotiation, and nothing on the wire names the chain. If the client’s
updiffers from the server’s, the server cannot read the request header and refuses the stream before authentication; ifdowndiffers, the client fails to decode what comes back. Byte codecs and block maps accept every byte, so a mismatch in one of them can decode to wrong bytes instead of failing: onupthe server then refuses the stream as an unknown UUID or a malformed header, and ondownthe client can receive wrong payload without any error.
One direction’s chain, all its expressions together, is refused beyond these limits:
| Limit | Value |
|---|---|
| Text of the expressions | 8,192 bytes |
Syntax nodes: each configured expression, constructor, parameter, parenthesised group and entry of a bodies list counts one |
256 |
Nesting: the expression itself, then each parenthesised group, expression given as a parameter and entry of a bodies list one level deeper |
16 levels |
| Transforms, once every expression is composed | 32 |
Work in one block body (see Block maps) |
256 units |
| What the chain may turn a 276-byte header into (the header budget) | 1,048,576 bytes |
Three pad(P=65536) in one chain exceed the last limit: the budget counts the largest padding the receiver accepts, whatever the sender pads.
Notation
Section titled “Notation”Each transform is a constructor: a name, then its parameters in parentheses.
identity() baseN() baseN(N=32)stuff(f=0x00,k=5) zstd(c=16384) record(type=0x17,ver=0x0303)pad(r=16384,P=128,mode="uniform")http-chunk(H="POST / HTTP/1.1\r\nHost: example.com\r\n\r\n",r=16384)block(c=4096,body=shuffle(seed=17)|bitplane())zstd()|mtf8()|bwt()- The parentheses are always written, also when they are empty:
identity(),zstd(). Names are case-sensitive:baseN, notbasen. - A parameter left out takes its default, and writing the default gives the same transform:
zstd()andzstd(c=16384)are one transform. - A value is one of:
- an unsigned integer of at most 64 bits, in decimal without leading zeros or in hexadecimal after
0x; - a string in double quotes, with JSON’s escapes:
\",\\,\/,\b,\f,\n,\r,\tand\uXXXX; - an expression, for the
bodyofblockandrepeat; - a list of expressions in square brackets, for the
bodiesofcycle.
- an unsigned integer of at most 64 bits, in decimal without leading zeros or in hexadecimal after
- Parentheses group an expression:
(A|B)|Cis the same asA|B|C. - Spaces, tabs and line breaks outside strings are ignored.
- An unknown constructor or parameter, a parameter given twice, a missing required parameter, a value of the wrong kind or out of range, a trailing
|or,, and text after the expression are errors, each named:zstd: c=100 is outside [1024, 65536],http-chunk: H is required. Nothing is guessed, and nothing unknown becomes the identity, because both ends must agree on every value.
In a TOML string, a backslash is itself escaped, or the string is written as a literal. These two lines are the same transform:
up = ["http-chunk(H=\"POST / HTTP/1.1\\r\\nHost: example.com\\r\\n\\r\\n\")"]up = ['http-chunk(H="POST / HTTP/1.1\r\nHost: example.com\r\n\r\n")']The transforms
Section titled “The transforms”The constructors fall into four groups. The first three are transforms a chain can hold; block maps exist only inside a block.
Stream codecs
Section titled “Stream codecs”| Transform | Parameters | On the wire |
|---|---|---|
identity() |
None | The bytes unchanged. |
baseN(N=64,A=…) |
N: 16, 32 or 64. A: optional, a string that holds each symbol of the RFC 4648 alphabet for N exactly once, in any order. Without it, the RFC 4648 alphabet. |
Text symbols: 1 byte to 2 symbols, 5 bytes to 8, or 3 bytes to 4. For 32 and 64, a flush pads a partial group with =, so padded groups may appear in mid-stream. |
stuff(f=0,k=5) |
f: the filler byte, 0 to 255. k: 1 to 65536. |
The byte f after every k bytes. |
zstd(c=16384) |
c: the most bytes one frame holds, from 1024 to 65536. A dict parameter is refused: Etemenanki has no zstd dictionaries. |
Each piece of at most c bytes compressed into its own zstd frame (level 3) behind a varint length. Frames share no history. |
record(type=0x17,ver=0x0303) |
type: one byte. ver: two bytes. |
Pieces of at most 16,384 bytes behind a 5-byte header: type, ver, and the length in two bytes. The defaults give the header shape of a TLS application-data record. |
http-chunk(H=…,r=16384) |
H: required, at most 8,192 bytes of ASCII: an HTTP/1.1 request line (POST /x HTTP/1.1) or status line (HTTP/1.1 200 OK), header lines name: value, each line ended by \r\n, and a blank line at the end. r: the largest chunk, from 1 to 65536. |
H once, then each piece of at most r bytes as an HTTP/1.1 chunk with a lowercase hex size, and 0\r\n\r\n when the direction ends. |
pad(r=16384,P=0,mode="fixed",p=0,f=0) |
r: the largest data piece, from 1 to 65536. P: the largest padding the receiver accepts, from 0 to 65536. mode: "fixed" pads every piece with p bytes, p from 0 to P; "uniform" draws each padding length uniformly from 0 to P, and p stays 0. f: the padding byte, 0 to 255. |
Each piece of at most r bytes as its length, the padding length, the data, and the padding. |
Byte codecs
Section titled “Byte codecs”A byte codec turns each byte into one byte: it changes no length and adds nothing to the stream. In a chain it keeps its state across writes and flushes for the whole direction. Arithmetic is modulo 256, and i counts the direction’s bytes from 0.
| Transform | Parameters | What each byte becomes |
|---|---|---|
affine8(a=197,b=101,step=0) |
a: odd, from 1 to 255. b, step: 0 to 255. |
a·x + b + step·i |
sbox8(seed=0) |
seed |
Its image under a fixed permutation of the 256 byte values, which seed selects |
delta8(lag=1,init=0) |
lag: 1 to 4096. init: 0 to 255. |
The byte minus the original byte lag places before it; before the first byte, every place holds init |
feedback8(a=13,b=7,r=3) |
a, b: 0 to 255. r: 0 to 7. |
x + a·y + b, rotated left by r bits, where y is the previous output byte (0 at the start) |
adaptive8(seed=0) |
seed |
Its image under a permutation that starts as seed selects and, after each byte, swaps the entries at the output byte and at i mod 256 |
mtf8(seed=0) |
seed |
Its position in a list of the 256 byte values, which then moves that byte to the front. The list starts in an order seed selects. |
A seed is any integer from 0 to 2^64 − 1, default 0. Both ends derive the same table from it; it is not a secret.
Framed codecs
Section titled “Framed codecs”These cut each write into pieces and send each piece with its length, so the receiver finds every piece again however the transport splits the stream.
| Transform | Parameters | On the wire |
|---|---|---|
block(c=4096,body=identity()) |
c: the largest block, from 1 to 65536. body: an expression of block maps. |
Each piece of at most c bytes as a varint length d, then the d bytes through the body. Blocks are numbered from 0 in each direction. |
bwt(c=4096) |
c: the largest piece, from 1 to 65536. |
Each piece of at most c bytes as its length, a row number p, and the piece’s Burrows-Wheeler transform: the last byte of each of its cyclic rotations once they are sorted, p being the row of the piece itself. bwt compresses nothing by itself: follow it with mtf8 and zstd, as in zstd()|mtf8()|bwt(). |
shape(c=4096,in=4,out=5,ones=12) |
c: the largest piece, from 4 to 65536 and a multiple of 4. in, out and ones are fixed: they may be written only as 4, 5 and 12. |
Each piece of at most c bytes as its length, then every four bytes as five bytes with exactly twelve one-bits: the four bytes, read as a big-endian number, are the rank of that word among all such 40-bit words. A last group of one to three bytes is filled with zeros. The body is a quarter larger than the data. |
Block maps
Section titled “Block maps”Block maps rearrange or mix the bytes of one block and keep its length. They are allowed only in a block body, where | composes them right to left, as in a chain. identity() and the byte codecs are allowed there too, and start afresh for every block.
| Map | Parameters | What it does to a block of d bytes |
|---|---|---|
reverse() |
None | Reverses the byte order. |
rotate(k=1) |
k: 0 to 2^64 − 1 |
Rotates the bytes left by k mod d places. |
shuffle(seed=0) |
seed |
Reorders the bytes by a fixed permutation of length d, which seed selects. |
transpose(cols=16) |
cols: 1 to 65536 |
Writes the bytes in rows of cols, the last row short, and reads them column by column. |
bitplane() |
None | Reads the bits plane by plane: the most significant bit of every byte first, then the next, packed most significant bit first. |
mix2(w=8,a=1,b=1,c=1,d=2) |
w: 8, 16, 32 or 64. a, b, c, d: 0 to 2^w − 1, and ad − bc must be odd. |
Multiplies each pair of little-endian w-bit words by the matrix [[a, b], [c, d]], modulo 2^w. |
wordmix(w=32,a=197,b=17,r=3,k=37) |
w: as for mix2. a: odd. b, k: 0 to 2^w − 1. r: 0 to w − 1. |
Turns each little-endian w-bit word u into a·u + b rotated left by r bits, XORed with k. |
lift2(w=32,rounds=4,seed=0) |
w: as for mix2. rounds: 1 to 64. seed. |
Passes each pair of words through rounds lifting steps whose round functions seed selects. |
feistel(w=32,rounds=6,seed=0) |
As for lift2. |
Passes each pair of words through rounds Feistel rounds whose round functions seed selects. |
repeat(rounds=1,body=identity()) |
rounds: 1 to 64. body: block maps. |
Applies body rounds times. |
cycle(bodies=[…]) |
bodies: required, a list of 1 to 16 bodies. |
Sends block number j through body j mod m of the m listed, so consecutive blocks take turns. |
The word maps leave the bytes after the last whole word, or the last whole pair of words, as they are.
Each map costs one unit of work per block, lift2 and feistel one per round, repeat its rounds times its body, and cycle its most expensive body. A body that costs more than 256 units is refused, so block(body=repeat(rounds=64,body=lift2())) is the most one body can do.
What decoders refuse
Section titled “What decoders refuse”Every decoder is strict, and anything it does not expect fails the stream:
| Transform | The decoder refuses |
|---|---|
baseN |
A symbol outside the alphabet, padding that RFC 4648 would not write, nonzero unused bits |
stuff |
A filler byte other than f |
zstd |
A length of 0 or larger than a frame of c bytes can be; a record that is not exactly one zstd frame; a frame without its content size, with one outside 1 to c, or naming a dictionary |
record |
Another type or ver, a length outside 1 to 16,384 |
http-chunk |
Any difference from H; a size with a leading zero, uppercase digits or more digits than r needs; a chunk larger than r; a missing CRLF; any byte after the terminator |
pad |
A data length of 0 or above r, a padding length above P (mode, p and f are the sender’s alone and are not checked) |
block |
A length of 0 or above c |
bwt |
A length of 0 or above c, a row number not below the length, and a piece that would not encode back to exactly the bytes received |
shape |
A length of 0 or above c, a five-byte group without exactly twelve one-bits or with a rank of 2^32 or more, filler that is not zero |
| Byte codecs, block maps | Nothing: every byte decodes to some byte |
Every length is checked before the bytes it describes are read, so a peer cannot make a decoder buffer more than the configuration allows. block, bwt and shape hold a piece until it is complete, at most c bytes or, for shape, five fourths of that, and release nothing of a piece they refuse. A transport that ends in the middle of a group, record, chunk or piece, or an http-chunk direction that ends without its terminator, is an error rather than a clean end.
Writes, flushes and flush_delay
Section titled “Writes, flushes and flush_delay”An endpoint gathers what it writes and encodes it when it flushes, which it does as soon as it has nothing more to write right now. Everything gathered up to a flush goes through the chain as one call, and a call never splits on its way down the chain. So record, zstd, http-chunk, pad, block, bwt and shape frame what was available at once, not every small write separately. A call that reaches 16 KiB is encoded without waiting for the flush.
flush_delay lets an endpoint hold each flush for up to that long, at most 10 ms, so that input arriving meanwhile joins the same call: fewer and larger records, at the cost of up to that much added latency. The first flush of a stream, the one that carries a client’s request header, is never held. Each end sets its own flush_delay: of the keys both ends have, it is the only one they need not share.
The header budget
Section titled “The header budget”Before a stream has authenticated, the server reads at most a fixed number of transport bytes, enough for the longest request header (276 bytes) as the up chain could encode it. If those bytes arrive without a complete header, the stream is refused. The budget follows from the chain:
up chain |
Budget |
|---|---|
Identity, or byte codecs only, such as feedback8()|affine8() |
276 bytes |
block(c=4096,body=shuffle(seed=17)|bitplane()) |
278 bytes |
bwt() |
280 bytes |
record() |
281 bytes |
stuff(f=0x00,k=5) |
331 bytes |
zstd() |
344 bytes |
shape() |
347 bytes |
baseN() |
368 bytes |
record()|baseN() |
373 bytes |
pad(P=128,mode="uniform") |
410 bytes |
baseN()|zstd() |
460 bytes |
A client always sends its request header as one flushed call, so a client with the right chain always fits.
Transports
Section titled “Transports”sss runs over any stream transport in [inbound.stream] or [outbound.stream]. Both sides must use the same network, WebSocket path or gRPC service_name, and must agree on TLS. The keys are described on the transports page.
network |
security |
What goes over the wire |
|---|---|---|
"tls" |
absent, "none" or "tls" |
sss in TLS over TCP |
"ws" |
"tls" |
sss in WebSocket in TLS |
"grpc" |
"tls" |
sss in gRPC (HTTP/2) in TLS |
"tcp" (the default) |
absent or "none" |
Plain sss: the UUID is readable |
"ws" or "grpc" |
absent or "none" |
Plain WebSocket or gRPC: the UUID is readable |
REALITY is refused on both sides: inbound sss-in: reality is for vless only, and for an outbound outbound proxy@v0: reality is for vless only.
An sss inbound may listen on a Unix socket (a listen path). There it runs plain, without TLS, WebSocket or gRPC.
How a connection works
Section titled “How a connection works”sequenceDiagram
participant C as Client
participant S as sss inbound
participant T as Target
C->>S: Transport handshakes (TLS, WebSocket or gRPC)
C->>S: Request header with UUID, command and target, then payload
Note over S: Decode the up chain, look up the UUID, refuse the stream if unknown
S->>T: Connect through the outbound the router picks
S->>T: Payload
T-->>S: Reply
S-->>C: Reply, through the down chain
The request header, as it is before the up chain encodes it, is at most 276 bytes:
| Field | Size | Accepted values |
|---|---|---|
| User id | 16 bytes | A UUID from users |
| Command | 1 byte | 0x01 TCP, 0x02 UDP |
| Address type | 1 byte | 0x01 IPv4, 0x03 domain, 0x04 IPv6 |
| Address | 4, 16, or 1 + n bytes | A domain is a length byte and 1 to 255 printable ASCII bytes (0x21 to 0x7e), passed on unresolved |
| Port | 2 bytes | Big-endian |
The server checks every field and refuses anything else, at the first byte that shows it. It never answers: a TCP connect that fails simply ends the stream, and the client sees the connection close.
When the inbound’s sniffing is on (the default) and a TCP request names an IP address, the server holds the first payload bytes, for at most 300 ms and 4 KiB, to recover a TLS server name or HTTP Host for routing. UDP requests are not sniffed.
A UDP flow is one sss stream with command 0x02. The request header names the first datagram’s destination, and the server opens the flow toward it as soon as the header is in, so routing sees a UDP stream when it arrives, as it sees a TCP one. After the header, both directions carry records:
| Field | Size |
|---|---|
| Address type, address, port | As in the request header |
| Length | A varint of 1 to 3 bytes, at most udp_max_datagram |
| Data | That many bytes |
Each record names its own peer: from the client, where the datagram goes; from the server, which address it came from. So one UDP flow through an sss outbound can talk to several peers, and each reply is attributed to the peer that sent it. The server always names the source by its IP address; a reply that names a domain fails the client’s stream.
UDP has no half-close: when the client ends its direction, the server closes the flow and the stream.
Time limits
Section titled “Time limits”| Limit | Value | What happens |
|---|---|---|
| Transport handshake | 10 s | Shared by all inbounds; see Limits. |
| Request header | header_timeout, 10 s by default, from the moment the transport hands the stream over |
The stream is refused, as below. |
| Idle | 300 s with no byte in either direction | The connection closes, as for every protocol. |
Streams refused before authentication
Section titled “Streams refused before authentication”A stream is refused before authentication when its header does not decode through the up chain, is malformed, names an unknown UUID, does not arrive within header_timeout or within the header budget, or the transport ends first. The server then writes nothing at all, whatever the reason, and does what reject says:
reject = "drain"(the default) reads and discards everything the client sends until the client closes orheader_timeouthas passed since the stream was accepted, and then closes the connection in order. To the client, a refused stream looks like one whose header is still awaited.reject = { fallback = "ip:port" }opens a TCP connection to that address, sends it every byte the stream delivered so far, and then relays the two connections in both directions, so that the client talks to the service at that address. The relay ends when both sides are done, or after 300 seconds in which no byte moved. If the fallback cannot be reached beforeheader_timeouthas passed, the stream is drained instead.
The fallback receives the stream as the transport delivers it, before the up chain: over tls, the decrypted bytes; over ws or grpc, the message payloads, not the HTTP request that opened them. A fallback is therefore most useful on a tcp or tls inbound, pointing at a web server on the same host.
A refused stream never counts toward an IP ban. With [log] level = "debug", the server logs one line per refused stream, for example sss-in: sss stream from Some(198.51.100.20) refused: unknown uuid. The reason is one of:
| Reason | Meaning |
|---|---|
decode error |
The up chain refused the bytes: usually the client’s chains differ from the server’s. |
malformed header |
An unknown command or address type, or a bad domain. |
unknown uuid |
No user has this UUID. |
transport ended before the header |
The client closed before its header was complete. |
no header within the budget |
The header budget ran out. |
no header within the header time |
header_timeout passed. |
Traffic accounting
Section titled “Traffic accounting”katana bills an sss user for the sss bytes: the request header, the payload and the UDP records, counted after the transforms are undone. What the transforms add on the wire (baseN’s expansion, padding) or save (zstd’s compression) is not counted. For the other stream protocols the count is the protocol’s own stream as the transport delivers it; see traffic reporting.
Subscribe files
Section titled “Subscribe files”A subscribe file can offer an sss node:
[[proxy_server]]name = "sg-sss"server = "sg.example.com"port = 443protocol = "sss"id = "11111111-2222-3333-4444-555555555555"transform = { up = ["stuff(f=0x00,k=5)"], down = ["zstd(c=16384)"] }stream = { network = "ws", path = "/sss", tls = {} }| Key | Required | Meaning |
|---|---|---|
id |
Yes | The user’s UUID. |
transform |
No | The server’s chains, as the outbound key, except that each direction is a list: write a single expression as a list of one, ["baseN()|zstd()"]. Without it, both are the identity. |
udp_max_datagram |
No | The server’s datagram limit; 65535 when absent. |
stream |
No | The transport, as for other nodes; see subscribe files. |
A node has no flush_delay: that belongs to the client, and the outbound built from a node uses "0ms". A chain with a mistake fails the node as an outbound, like any other wrong value in a node.
The subscribe format has a revision, the version of the etemenanki-subscribe crate that reads it. A client built on it announces that revision in its User-Agent as etemenanki-subscribe/<version>, so that a provider can leave out nodes the client cannot read. sss nodes need revision 1.1 or later.
katana nodes
Section titled “katana nodes”katana 4.10.0 and later serve sss nodes, and since 5.0.0 they come from helium alone: a helium node config whose protocol is sss describes one, and the katana config sets no node_type for it. UniProxy panels describe no sss node, and katana refuses node_type = "sss" there; see Protocols and transports. helium’s node config gives the port and transport as for other stream nodes, and two of sss’s own settings beside them, under the names etemenanki-app uses:
| Panel key | Meaning |
|---|---|
protocol |
"sss" |
port |
The port |
transport |
{"type": "tcp"}, {"type": "ws", "path": "/sss"} or {"type": "grpc", "service_name": "sss"}, as for the other stream nodes |
security |
{"type": "none"}, or {"type": "tls"} with the certificate in [node.controller.cert]. Required; REALITY cannot be written here. |
transform |
{"up": [...], "down": [...]}, the chains from the client’s view, each a list of at most 8 expressions run in the order listed; absent is the identity |
udp_max_datagram |
1 to 65535; absent is 65535 |
{"protocol":"sss","port":443,"transport":{"type":"ws","path":"/sss"},"security":{"type":"tls"},"transform":{"up":["stuff(f=0x00,k=5)"],"down":["zstd(c=16384)"]}}The other inbound settings keep their defaults: flush_delay is "0ms", header_timeout is 10 s, and reject drains. Users are admitted by their UUID. A change to either chain or to the datagram limit rebuilds the node’s protocol; a node config katana cannot serve is refused as described in Protocols and transports.
Common errors
Section titled “Common errors”Configuration errors appear when you run --test or start the program, and when a hot reload is refused:
| Error | Cause | Fix |
|---|---|---|
inbound sss-in: transform.up: "zstd2()": unknown constructor "zstd2" |
A constructor that does not exist, or a name in the wrong case | Use a name from the tables above |
inbound sss-in: transform.up: "zstd": expected '(' after zstd, found the end |
A constructor without its parentheses | Write zstd() |
inbound sss-in: transform.up: "http-chunk()": http-chunk: H is required |
A required parameter is missing | Add it on both ends |
inbound sss-in: transform.up: "zstd(c=100)": zstd: c=100 is outside [1024, 65536] |
A parameter out of range | Use a value in the range |
inbound sss-in: transform.up: "http-chunk(H=…)": http-chunk: H does not end in a blank line (CRLF CRLF) |
The header block does not end in \r\n\r\n |
End H with a blank line |
outbound proxy: transform.down: "baseN(N=32,A=…)": baseN: A: 'A' appears twice in the alphabet |
An A that is not a permutation of the RFC 4648 alphabet |
List each symbol of the RFC 4648 alphabet once |
inbound sss-in: transform.up: "reverse()": reverse is a block map: it goes in a block body, block(body=reverse(...)) |
A block map outside a block |
Write it in a body: block(body=reverse()) |
inbound sss-in: transform.up: "affine8(a=4)": affine8: a=4 is even, so it has no inverse |
A map that could not be undone: an even multiplier, or an even determinant for mix2 |
Use an odd value |
inbound sss-in: transform.up: the expressions compile to more than 32 transforms |
Too many transforms | Shorten the chain |
inbound sss-in: transform.up: the chain expands a 276-byte header beyond 1048576 bytes |
The chain’s padding or expansion is too large | Use a smaller P or fewer expanding transforms |
inbound sss-in: transform.up: "block(…)": a block body does more than 256 units of work |
Too many maps, rounds or repeats in one body | Use fewer |
inbound sss-in: invalid settings: data did not match any variant of untagged enum SssChainCfg |
A direction that is neither a string nor a list of strings | Write up = "…" or up = ["…"] |
inbound sss-in: sss flush_delay must be at most 10ms |
flush_delay above 10 ms |
Lower it |
inbound sss-in: flush_delay "5" is not a duration like "10s" or "5ms" |
A duration without its unit | Write "5ms" |
inbound sss-in: sss header_timeout must be above zero |
header_timeout = "0s" |
Use a positive duration |
inbound sss-in: sss udp_max_datagram must be at least 1 |
udp_max_datagram = 0 |
Use 1 to 65535 on both ends |
inbound sss-in: reject is neither "drain" nor { fallback = "ip:port" } |
Another reject string, an empty table, or a fallback that is not a string |
Use "drain" or a fallback table |
inbound sss-in: reject has an unknown key "fallbak"; it takes only fallback |
A key other than fallback in the reject table, a misspelling included |
Write the table as { fallback = "ip:port" } and nothing else |
inbound sss-in: reject.fallback "example.com:80" is not an ip:port address |
A host name as the fallback | Write an IP address and port |
inbound sss-in: reality is for vless only |
security = "reality" |
Use TLS |
inbound sss-in: users[0] has no email; a user of this inbound is named by its email |
A user without email |
Give every user a unique email |
outbound proxy: invalid uuid "…" |
The outbound id is not a UUID |
Use the UUID the server lists |
A stream that fails at runtime is logged at debug level. A refused stream is logged as shown above. An admitted stream that fails later, for example on a decode error in the middle of the stream, is logged as sss connection from Some(198.51.100.20) ended: …. The client sees only the connection close.