Skip to content

sing-box — Config Layout

sing-box reads a single JSON document at startup. The root object maps to Go struct _Options at option/options.go:12 (exported as Options via a type alias whose UnmarshalJSONContext enforces strict unknown-field checking — typos in your config produce a startup error, not silent ignoring).

Root keys

KeyGo fieldTypePageDescription
$schemaSchemastring(none)JSON-schema URL; ignored at runtime.
logLog*LogOptionsLogSeverity, output, timestamp, disable toggle.
dnsDNS*DNSOptionsDNSPhase 5DNS servers, rules, hosts, fakeip.
ntpNTP*NTPOptionsNTPOptional embedded NTP client.
certificateCertificate*CertificateOptionsCertificateRoot-CA bundle source for TLS verification.
endpointsEndpoints[]EndpointEndpointsPhase 3Endpoint inbound/outbound (WireGuard, Tailscale).
inboundsInbounds[]InboundInboundsPhase 3List of listening services.
outboundsOutbounds[]OutboundOutboundsPhase 3List of upstream targets.
routeRoute*RouteOptionsRoutePhase 5Routing rules, rule-set, default outbound.
servicesServices[]ServiceServicesPhase 6Background services (resolved, derp, ssm-api).
experimentalExperimental*ExperimentalOptionsExperimentalCache file, Clash API, V2Ray API, pprof debug.

Pages marked Phase 3/5/6 ship in those later phases; the column is here so the layout is complete today.

At a glance

json
{
  "log": { "level": "info", "timestamp": true },
  "dns": { "servers": [{ "tag": "google", "address": "tls://8.8.8.8" }] },
  "ntp": { "enabled": true, "server": "time.cloudflare.com" },
  "certificate": { "store": "system" },
  "inbounds": [],
  "outbounds": [],
  "route": { "final": "direct" },
  "experimental": {
    "cache_file": { "enabled": true },
    "clash_api": { "external_controller": "127.0.0.1:9090" }
  }
}

Source: option/options.go:12-25 · v1.13.11 (553cfa1)

Core Tutorial by Argsment