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*DNSOptionsDNSDNS servers, rules, hosts, fakeip.
ntpNTP*NTPOptionsNTPOptional embedded NTP client.
certificateCertificate*CertificateOptionsCertificateRoot-CA bundle source for TLS verification.
endpointsEndpoints[]EndpointEndpointsEndpoint inbound/outbound (WireGuard, Tailscale).
inboundsInbounds[]InboundInboundsList of listening services.
outboundsOutbounds[]OutboundOutboundsList of upstream targets.
routeRoute*RouteOptionsRouteRouting rules, rule-set, default outbound.
servicesServices[]ServiceServicesBackground services (resolved, derp, ssm-api).
experimentalExperimental*ExperimentalOptionsExperimentalCache file, Clash API, V2Ray API, pprof debug.

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.15 (3708fa1)

Core Tutorial by Argsment