Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

sing-box Compatibility Contract

xrat supports managed sing-box configurations for any sing-box version >=1.13.0. There is no upper bound: newer stable and prerelease binaries are accepted so users are not blocked by a hard ceiling. The conformance target is v1.13.21, and the range planned for conformance fixtures is >=1.13.0, <1.15.0. The tagged top-level options and the corresponding official configuration pages are the source of truth for every generated JSON field.

The runtime inspects sing-box version before writing a config or starting a session. It rejects pre-1.13, malformed, and unavailable binaries with the configured path, detected version, supported range, and a remediation. A version outside the planned conformance range (for example >=1.15.0, 2.x, or a prerelease) is accepted with a warning instead of being rejected. Preflight still runs sing-box check -c <config> with the actual binary before launch, so an incompatible newer binary fails safely rather than starting a broken session. Managed setup installs v1.13.21. The full native fixture matrix and release CI gate for that version are pending (TASK-102 and TASK-109).

Generated-shape Matrix

Generated areav1.13.21 authorityContract statusOwner
Top-level log, inbounds, outbounds, dns, route, experimentaloptions sourceVersion-gatedTASK-98 / TASK-73
Hysteria2 outboundHysteria2 outboundSupported strictly for password, tcp/udp, SNI, insecure, ALPN, Salamander, and integer bandwidth; unknown or lossy input failsTASK-101
VLESS outboundVLESS outboundSupported: UUID, xtls-rprx-vision flow over direct TLS/REALITY, packet_encoding, TLS, transportsTASK-99.3
VMess outboundVMess outboundSupported: UUID, security, alter_id, packet_encoding, TLS, transportsTASK-99.5
Trojan outboundTrojan outboundSupported: password, TLS, transportsTASK-99.6
HTTP outboundHTTP outboundSupported: credentials, HTTPS tls block only when the import requires itTASK-99.2
SOCKS outboundSOCKS outboundSupported: version 5, credentialsTASK-99.4
Shadowsocks outboundShadowsocks outboundSupported for documented AEAD/2022 and legacy methods; SIP003 plugins are rejectedTASK-99.7
TLS and V2Ray transportsTLS and V2Ray transportSupported: SNI, insecure, ALPN, uTLS fingerprint, REALITY, WebSocket, gRPC, HTTP, HTTPUpgrade, QUIC; unknown values failTASK-99.1
SOCKS, HTTP, Shadowsocks inboundstagged inbound sourceSupported as typed per-inbound output; SOCKS UDP cannot be disabled independently and HTTP has no auth settings in xratTASK-105
Typed local, UDP, TCP, TLS, QUIC, HTTPS, HTTP/3, and hosts DNS serverstagged DNS sourceVersion-gated; unsupported settings fail before launch and a route-level default_domain_resolver is emitted whenever DNS is presentTASK-103
Domain and IP/CIDR route rulesroute rulesVersion-gated for exact/suffix/keyword/regex domains and IP/CIDRTASK-100.2
GeoIP/geosite rules and rule-set assetsrule setsSupported via remote SagerNet sing-geosite/sing-geoip .srs rule-sets, cached with experimental.cache_file; Xray .dat assets are not a sing-box format and cannot be reusedTASK-100.1 / TASK-100.2
experimental.clash_apiClash APIVersion-gated; requires a loopback controller host and a port distinct from local inboundsTASK-106

All generated configurations must pass sing-box check -c <config>, the same command used by managed-runtime preflight. A missing validator is a skipped local check, never a passing conformance result. The complete fixture matrix and release enforcement belong to TASK-102 and TASK-109.

Upstream Deprecation Watch

Because newer versions are accepted, track upstream deprecations that will become removals. Verified against the official migration guide and a real sing-box 1.14.1 binary:

Emitted shapeUpstream statusAction
Remote rule-sets relying on the implicit HTTP clientDeprecated in 1.14, removed in 1.16Add http_clients/default_http_client for versions >=1.14 before 1.16 (TASK-117)
Legacy DNS address-filter fields (ip_accept_any)Deprecated in 1.14Migrate hosts routing to response matching if it is removed
block outbound with outbound: "block"Deprecated since 1.11Switch to action: reject when a bounded minimum rises past the removal
Inline ACME, rule-set download_detour, TUN stackDeprecated/removed 1.14–1.17Not emitted

Representative generated shapes have passed sing-box check on 1.13.x and 1.14.1; the full matrix remains pending.

Implementation Rules

  • Read the v1.13.21 documentation and tagged upstream option type before adding or changing each field.
  • Generate a field only when xrat’s normalized model preserves its complete sing-box meaning.
  • Reject unrepresentable, deprecated, or unknown input with a field-specific error before process launch.
  • Add a native validation fixture for every accepted JSON shape; run it against the pinned v1.13.21 binary.
  • Update this matrix when the supported range or an emitted shape changes.