English
Shared blocks
An inbound or outbound has one protocol block. tls, transport and mux go inside it; dial, listener and reload go next to it. The kind of a block is its key; the type and enabled fields are not written: the presence of a block enables it.
yaml
outbounds:
proxy:
vless: # the protocol block, exactly one
server: de.example.com:443
uuid: b831381d-6324-4d53-ad4f-8cda48b30811
tls: # a shared block
sni: de.example.com
transport: # a shared block, the kind is a key inside
ws:
path: /ws
dial: # outbound only
interface: eth0
route:
final:
outbound: proxy| Block | Where | What it sets |
|---|---|---|
tls | inbound, outbound | TLS: certificates, SNI, ALPN, uTLS, fragmentation, kTLS |
tls.reality | inbound, outbound | REALITY over TLS 1.3 |
transport | inbound, outbound | The V2Ray/Xray transport: ws, grpc, http, httpupgrade, xhttp |
dial | outbound | How the outbound opens a connection: interface, fwmark, detour, timeouts, tcp, udp |
listener | inbound | The listening socket: interface, fwmark, tcp, udp |
mux | inbound, outbound (VLESS, Trojan, Shadowsocks) | sing-mux multiplexing: h2mux, smux, yamux |
reload | inbound, outbound, group | What a configuration reload does to live connections |
Shared blocks inside the protocol block are of the same kind for every protocol that takes them:
| Block | Where | What it sets |
|---|---|---|
quic | hysteria, hysteria2, tuic | Receive windows, keep-alive, idle timeout, MTU |
udp_over_tcp | outbound socks, shadowsocks | UDP inside a TCP connection (UoT) |
Shared blocks are the same for all protocols and differ only by side (inbound, outbound): the server's and the client's tls differ, but trojan and vless on the same side have the same one. What only one protocol has is written in its block under its own name.
Which protocol takes which blocks
A block the protocol does not take is a load error (outbound x: sockstakes notls block).
| Protocol | inbound | outbound |
|---|---|---|
anytls | tls | tls, dial |
direct | — | dial |
http | tls | tls, dial |
mixed | tls | — |
hysteria, hysteria2, tuic | tls | tls, dial |
shadowsocks | mux | dial, mux |
shadowtls | — | tls, dial |
socks | — | dial |
tproxy, redirect, tun | — | (no outbound) |
trojan | tls, transport, mux | tls, transport, mux, dial |
vless | tls, transport, mux | tls, transport, mux, dial |
Every inbound, outbound and group takes reload.
What cannot be written where
- An inbound has no
dialblock: the parameters of the listening socket are thelistenerblock. - The protocol block cannot contain
dialfields (interface,fwmark,detour…); the loader says which block they belong in (`detour` belongs in the `dial` block). tls,transportandmuxare written inside the protocol block, never next to it (`tls` belongs inside the `vless` block). sing-box'smultiplexismux.outbounds.defaultsis a reserved name: all outbounds inherit its blocks. More in dial.md.
For developers: the modules.