English
The mux block
sing-mux multiplexing: many connections inside one connection to the server. Compatible with sing-box multiplex. Taken by VLESS, Trojan and Shadowsocks, on inbound and outbound. Other protocols do not have the block.
Xray mux.cool multiplexing (and XUDP) is something else: a VLESS inbound always accepts it, without a mux block; a VLESS outbound enables it with the xray key (see below and vless.md).
Outbound
The protocol is the key of the block: h2mux, smux or yamux.
yaml
mux:
smux:
max_connections: 4
min_streams: 4| Field | Type | Default | Meaning |
|---|---|---|---|
max_connections | number | 0 (no limit) | How many connections to the server to keep at the same time |
min_streams | number | 0 | How many streams to put into a connection before opening the next one; used only with max_connections |
max_streams | number | 0 | The maximum number of streams in one connection (works if max_connections is not set) |
padding | bool | false | Pad the traffic with sing-mux padding; the server must require it too |
brutal | {up_mbps, down_mbps} | — | TCP Brutal, see below |
Without limits every new stream may open a new connection. An empty connection is closed after 30 seconds of idleness.
Xray mux.cool (xray)
VLESS only: a mux.cool client, like the mux of an Xray outbound. The server is Xray or an ours VLESS inbound.
yaml
mux:
xray:
concurrency: 8| Field | Type | Default | Meaning |
|---|---|---|---|
concurrency | number | 8 | How many TCP connections to carry in one connection to the server; negative means TCP goes without mux.cool |
xudp_concurrency | number | 16 | The same for UDP; negative means UDP goes as without the block (XUDP, a connection per flow) |
xudp_proxy_udp_443 | reject, allow, skip | reject | UDP to port 443 (QUIC): reject it so the client falls back to TCP, let it through mux.cool, or send it without mux.cool |
One connection carries no more than 128 sessions in its lifetime; an empty one is closed after 16 seconds. A UDP packet larger than 8 KiB is dropped: Xray tears down the whole connection on one. With the Vision flow the block is an error: an Xray server breaks mux.cool with TCP under Vision.
TCP Brutal
brutal: {up_mbps, down_mbps} — on outbound and inbound, like sing-box brutal: the presence of the block enables it, enabled is not written. Speeds are whole Mbit/s, no less than 1.
After a session opens, the client tells the server its receive speed, the server answers with its own, and each side sets the brutal algorithm on its TCP socket with a send rate equal to the lesser of its own up_mbps and the other side's receive speed. A client with Brutal keeps one connection to the server.
The tcp-brutal kernel module is needed on the server (and on the client, to speed up sending from it). Without the module the server answers with an error and the session does not open: brutal exchange: remote error: enable TCP Brutal: … please make sure you have installed the tcp-brutal kernel module. A server without brutal answers brutal is not enabled by the server. A client that could not enable Brutal on its side keeps working without it. The server sets Brutal only on a connection without a transport and not under TLS 1.2; on the others it answers with an error.
Inbound
An inbound understands any of the three protocols; the protocol key is not written.
| Field | Type | Default | Meaning |
|---|---|---|---|
padding | bool | false | Require padding from clients |
brutal | {up_mbps, down_mbps} | — | TCP Brutal for clients that ask for it |
Without a mux block an inbound rejects sing-mux connections (multiplex is disabled).
Example
yaml
inbounds:
vless-in:
vless:
listen: ":443"
users:
- uuid: b831381d-6324-4d53-ad4f-8cda48b30811
tls:
certificate_path: /etc/ours/cert.pem
key_path: /etc/ours/key.pem
mux:
padding: true
outbounds:
vless-out:
vless:
server: de.example.com:443
uuid: b831381d-6324-4d53-ad4f-8cda48b30811
tls:
sni: de.example.com
mux:
h2mux:
max_connections: 4
padding: true
route:
final:
outbound: vless-outFor developers: the mux module.