Skip to content

Migrating from sing-box and between format versions ​

ours speaks the same protocols as sing-box and interoperates with it over the network, but its configuration format is its own: YAML, different from the sing-box configuration format. A sing-box JSON file is neither read nor converted; the configuration has to be rewritten. This page is about what maps to what.

Given a sing-box file, ours check answers with one line that links here:

text
FATAL config.json: this is a configuration in another format: this one is YAML, with inbounds and
outbounds as mappings by name and the protocol as the key of its block; see docs/usage/migration.md

Individual constructs of the other format in YAML get the same answer: type and tag on an inbound or outbound, action and outbound in a rule, a list instead of a mapping in inbounds/outbounds.

Correspondences ​

sing-boxours
A JSON fileA YAML file (.yaml, .yml); writing rules
inbounds, outbounds are lists with tagMappings "name → description": the name is the key, tag is an error
"type": "vless"The key of the protocol block: proxy: {vless: {…}}
server + server_port, listen + listen_portOne host:port string: server: de.example.com:443, listen: 127.0.0.1:1080
"listen": "::"listen: :1080 — all addresses
bind_interface, routing_mark, tcp_fast_open on an inboundThe listener block next to the protocol block
"udp_timeout": 300 (seconds)listener: {udp: {timeout: 5m}} — a duration always has its unit
Dial fields of an outbound (detour, bind_interface, routing_mark, connect_timeout, …)The dial block: interface, fwmark, detour
tls.server_nametls.sni; tls, transport, multiplex are written inside the protocol block, and multiplex is mux
transport: {"type": "ws", …}transport: {ws: {…}} — the kind is a key too
The selector and urltest outboundsThe groups section: members and rank (manual, delay, …)
The block outbound, the reject actionThe action to: block; there is no block outbound
A rule: conditions, action, outbound in one objectmatch: {conditions} and exactly one of to / do (rules)
"action": "route", "outbound": "proxy"to: {outbound: proxy}; a group is to: {group: main}
type: logical, mode, rules, invertmatch: {all: […]}, match: {any: […]}, match: {not: …}
route.final: "proxy", otherwise the first outboundroute.final: {outbound: proxy} — required
route.rule_setThe rule_sets section
route.default_domain_resolverA dns.rules rule with match: {outbound: "*"}, see Resolvers for outbounds
route.geoip, route.geositeNo built-in database; the geoip/geosite conditions refer to rule-sets, including ones from geosite.dat/geoip.dat (the dat format)
dns.servers as a list, type: tlsdns.upstreams as a mapping by name, kind dot (DNS)
clash_api, v2ray_apiIts own Admin API and dashboard

What sing-box does not have: subscriptions (subscriptions), outbounds.defaults for values shared by outbounds, tproxy + auto_nft interception.

One configuration in both formats ​

A client: SOCKS/HTTP on 127.0.0.1:1080, VLESS with TLS, example.org domains directly, ads refused.

sing-box:

json
{
  "inbounds": [
    {"type": "mixed", "tag": "local", "listen": "127.0.0.1", "listen_port": 1080}
  ],
  "outbounds": [
    {"type": "vless", "tag": "proxy", "server": "de.example.com", "server_port": 443,
     "uuid": "b831381d-6324-4d53-ad4f-8cda48b30811",
     "tls": {"enabled": true, "server_name": "de.example.com"}},
    {"type": "direct", "tag": "direct"}
  ],
  "route": {
    "rules": [
      {"domain_suffix": ["example.org"], "action": "route", "outbound": "direct"},
      {"domain_keyword": ["ads"], "action": "reject"}
    ],
    "final": "proxy"
  }
}

ours:

yaml
inbounds:
  local:
    mixed:
      listen: 127.0.0.1:1080

outbounds:
  proxy:
    vless:
      server: de.example.com:443
      uuid: b831381d-6324-4d53-ad4f-8cda48b30811
      tls:
        sni: de.example.com
  direct:
    direct:

route:
  rules:
    - match:
        domain_suffix: example.org
      to:
        outbound: direct
    - match:
        domain_keyword: ads
      to: block
  final:
    outbound: proxy

Where ours is stricter ​

sing-box check lets such configurations through, and running them gives an inbound or outbound that does not work. ours refuses at load time, with the position:

WhatError
An outbound without server (vless, trojan, shadowsocks, socks, http, …)outbound: `server` is required
server without a portserver: `de.example.com` has no port (for hysteria/hysteria2, hop.ports may stand instead of the port)
An inbound without listeninbound: `listen` is required. In sing-box an inbound without an address listens on a random port
listen without a portlisten: `127.0.0.1` has no port. A random port is explicit: listen: 127.0.0.1:0
A vless or anytls inbound without users (and without fallbacks)inbound: `users` is required: such an inbound refuses every client
Two inbounds on the same address and port (TCP with TCP, UDP with UDP)inbound `b` listens on port 1080 (tcp) as inbound `a` does

A port taken by another process (including a second instance of ours) is a startup error: listen 127.0.0.1:1080 (tcp): address already in use by another process or inbound.

One thing is left lenient, as in sing-box: a uuid that is not a UUID is accepted and turned into a version 5 UUID of the text (as sing-box and Xray do). check and startup warn about it: uuid `x` is not a UUID; it is taken as the name-based UUID ….

Format version and renames ​

The ours format has a version number, the top-level field version (currently 1; without the field, the file is read as version 1; see Configuration). The compatibility rules:

  • A file of a newer version than the build understands is not loaded: configuration format version N is newer than this build reads (1): update ours. Update ours first, then the file.
  • A file of a previous version is read: on load it is brought to the current version, and check and startup warn about every rewritten place. The file itself does not change; fix it following the text of the warning.
  • A rename within a version works the same way: the old name is read with a warning; the new and the old name together are an error.
WasNowStatus
experimental.cache_file: {…}cache: {…} at the top levelstill read
experimental.clash_api, experimental.v2ray_apiNone; Admin API and dashboardalways an error

Was:

yaml
experimental:
  cache_file:
    path: ours-cache
    store: [fakeip]

Now:

yaml
cache:
  path: ours-cache
  store: [fakeip]

GPL-3.0-or-later