Skip to content

Inbounds

inbounds is the array of listening services. Unlike Xray-core there is no nested settings block: each entry is a flat object — the type / tag envelope below plus the selected type's own fields merged at the same level. The envelope is decoded first, then the remaining keys are decoded into the option struct registered for type, with unknown fields rejected.

Envelope

FieldTypeDefaultAllowed valuesDescription
typestringtun | redirect | tproxy | direct | socks | http | mixed | shadowsocks | vmess | trojan | naive | shadowtls | vless | anytls | hysteria | tuic | hysteria2Inbound type. Selects which option struct the rest of the object is decoded into. An unregistered value fails at startup with "unknown inbound type".
tagstringUnique name for this inbound. Referenced by routing rules (inbound) and by log lines.

Source: option/inbound.go:18-22 · pinned at v1.13.15 (3708fa1)

Per-type fields are documented on the protocol pages: TUN, Redirect & TProxy, Direct, HTTP & SOCKS (also mixed), Shadowsocks, VMess, Trojan, Naive, VLESS, AnyTLS, Hysteria2, TUIC.

Shared listen fields (ListenOptions)

Every socket-based inbound embeds ListenOptions; the fields appear at the same flat level as the envelope.

FieldTypeDefaultAllowed valuesDescription
listen*badoption.AddrAddress to bind, e.g. "::" or "127.0.0.1".
listen_portuint16Port to listen on.
bind_interfacestringNetwork interface to bind the listener to.
routing_markFwMarkSO_MARK (fwmark) to set on the listening socket. Linux only.
reuse_addrboolfalsetrue | falseSet SO_REUSEADDR on the listener.
netnsstringNetwork namespace to listen in (name or path). Linux only.
disable_tcp_keep_aliveboolfalsetrue | falseTurn TCP keep-alive off for accepted connections.
tcp_keep_alivebadoption.DurationKeep-alive idle period before probes start. Duration string, e.g. "15m".
tcp_keep_alive_intervalbadoption.DurationInterval between keep-alive probes. Duration string.
tcp_fast_openboolfalsetrue | falseEnable TCP Fast Open on the listener.
tcp_multi_pathboolfalsetrue | falseEnable Multipath TCP (requires Go MPTCP support on the platform).
udp_fragment*boolfalsetrue | falseAllow fragmenting UDP packets larger than the MTU instead of dropping them.
udp_timeoutUDPTimeoutCompatIdle timeout for UDP NAT entries. Duration string; the effective default depends on the sniffed protocol.
detourstringForward accepted connections straight into another inbound, addressed by its tag.
proxy_protocolboolDeprecated and removed: PROXY-protocol header support no longer exists; setting it is an error.
proxy_protocol_accept_no_headerboolDeprecated and removed together with proxy_protocol.

Source: option/inbound.go:66-88 · pinned at v1.13.15 (3708fa1)

Minimal example

json
{
  "inbounds": [
    {
      "type": "mixed",
      "tag": "mixed-in",
      "listen": "127.0.0.1",
      "listen_port": 2080
    }
  ]
}

Notes

  • The strict unmarshaler applies inside inbound entries too: a typo in any field name is a startup error, not silently ignored.
  • The legacy sniffing fields (sniff, sniff_override_destination, sniff_timeout, domain_strategy, udp_disable_domain_unmapping) were deprecated in 1.11.0 and removed in 1.13.0 — supplying them is an error pointing to the rule-actions migration. Sniffing now lives in route rules.
  • shadowsocksr is still registered but only as a stub that errors: ShadowsocksR support was removed in sing-box 1.6.0.
  • hysteria, tuic and hysteria2 require a build with the with_quic tag (official release binaries include it).

Cross-core notes

  • Xray-core nests protocol fields in a settings object and keeps sniffing per-inbound. See Xray Inbounds.
  • mihomo uses individual root keys (port, socks-port, mixed-port, …) plus a listeners list. See HTTP & SOCKS and Redirect & TProxy.

Source: option/inbound.go:18-22 · v1.13.15 (3708fa1)

Core Tutorial by Argsment