Skip to content

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
BlockWhereWhat it sets
tlsinbound, outboundTLS: certificates, SNI, ALPN, uTLS, fragmentation, kTLS
tls.realityinbound, outboundREALITY over TLS 1.3
transportinbound, outboundThe V2Ray/Xray transport: ws, grpc, http, httpupgrade, xhttp
dialoutboundHow the outbound opens a connection: interface, fwmark, detour, timeouts, tcp, udp
listenerinboundThe listening socket: interface, fwmark, tcp, udp
muxinbound, outbound (VLESS, Trojan, Shadowsocks)sing-mux multiplexing: h2mux, smux, yamux
reloadinbound, outbound, groupWhat a configuration reload does to live connections

Shared blocks inside the protocol block are of the same kind for every protocol that takes them:

BlockWhereWhat it sets
quichysteria, hysteria2, tuicReceive windows, keep-alive, idle timeout, MTU
udp_over_tcpoutbound socks, shadowsocksUDP 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).

Protocolinboundoutbound
anytlstlstls, dial
direct—dial
httptlstls, dial
mixedtls—
hysteria, hysteria2, tuictlstls, dial
shadowsocksmuxdial, mux
shadowtls—tls, dial
socks—dial
tproxy, redirect, tun—(no outbound)
trojantls, transport, muxtls, transport, mux, dial
vlesstls, transport, muxtls, transport, mux, dial

Every inbound, outbound and group takes reload.

What cannot be written where ​

  • An inbound has no dial block: the parameters of the listening socket are the listener block.
  • The protocol block cannot contain dial fields (interface, fwmark, detour…); the loader says which block they belong in (`detour` belongs in the `dial` block).
  • tls, transport and mux are written inside the protocol block, never next to it (`tls` belongs inside the `vless` block). sing-box's multiplex is mux.
  • outbounds.defaults is a reserved name: all outbounds inherit its blocks. More in dial.md.

For developers: the modules.

GPL-3.0-or-later