English
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.mdIndividual 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-box | ours |
|---|---|
| A JSON file | A YAML file (.yaml, .yml); writing rules |
inbounds, outbounds are lists with tag | Mappings "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_port | One 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 inbound | The 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_name | tls.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 outbounds | The groups section: members and rank (manual, delay, …) |
The block outbound, the reject action | The action to: block; there is no block outbound |
A rule: conditions, action, outbound in one object | match: {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, invert | match: {all: […]}, match: {any: […]}, match: {not: …} |
route.final: "proxy", otherwise the first outbound | route.final: {outbound: proxy} — required |
route.rule_set | The rule_sets section |
route.default_domain_resolver | A dns.rules rule with match: {outbound: "*"}, see Resolvers for outbounds |
route.geoip, route.geosite | No 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: tls | dns.upstreams as a mapping by name, kind dot (DNS) |
clash_api, v2ray_api | Its 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: proxyWhere 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:
| What | Error |
|---|---|
An outbound without server (vless, trojan, shadowsocks, socks, http, …) | outbound: `server` is required |
server without a port | server: `de.example.com` has no port (for hysteria/hysteria2, hop.ports may stand instead of the port) |
An inbound without listen | inbound: `listen` is required. In sing-box an inbound without an address listens on a random port |
listen without a port | listen: `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
checkand 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.
| Was | Now | Status |
|---|---|---|
experimental.cache_file: {…} | cache: {…} at the top level | still read |
experimental.clash_api, experimental.v2ray_api | None; Admin API and dashboard | always an error |
Was:
yaml
experimental:
cache_file:
path: ours-cache
store: [fakeip]Now:
yaml
cache:
path: ours-cache
store: [fakeip]