Close the "rules live, engine dead" LAN-blackout class and make an admin `stop` durable: - live-flag /var/run/shater.active gates hotplug/cron reconcile, so `stop` sticks — a WAN flap can no longer resurrect interception behind a stopped engine. - procd respawn retry=0 (never abandon the engine while rules stand) + guard that /usr/bin/xray is executable before installing the data plane. - shater-cron watchdog: engine dead N ticks with interception live escalates per kill_switch (open -> auto-stop/fail-open, closed -> crit log). - fix procd cron detach: `command "$INIT_SCRIPT" loop` (rc.common dispatch) instead of `/bin/sh $INIT_SCRIPT loop`, which detached the loop from procd (running:false + respawn churn) — the auto-updater/watchdog ran unsupervised. - run.json regenerated at start after sysupgrade; cron stamps only on success with backoff, and waits for a default route before boot-time fetches. - sysctl route_localnet/accept_local scoped to lo (was all — WAN anti-spoof weakening); applied at install time so no reboot is needed. - fix stale example filenames; bump shater-core to r19. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LLthkP2S8WAfxu7fcYbPfE
examples/ — sample configs & parser fixtures
Realistic, heavily-annotated fixtures for the shater xray control-plane
(xrayctl). They double as (a) manual test fixtures and (b) onboarding docs.
Every option name is cross-checked against ../CONTRACT.md;
any field the contract left ambiguous is flagged in
Contract gaps / interpretations below.
Files
| File | What it is |
|---|---|
etc-config-shater.full |
Complete /etc/config/shater exercising every section type in the contract: globals, multi-LAN inbound, two subscription (HAPP auto-hwid + fixed-hwid with extra headers), manual node, subscription- and manual-sourced group, a 3-hop chain, egress of all four types (interface/proxy/direct/block), ruleset (domain-from-url + inline ipcidr), rule (per-client /32, MAC, domain-list, geosite, egress binding, kill modes), resolver (doh+detour / local / fakeip / default) with dns_rule, and a WAN-mode profile. Generalizes the real BPi-R3 Mini setup (see ../01-mini_router-audit.md). |
etc-config-shater.minimal |
Smallest useful config: one subscription, one group, one tproxy inbound, one default rule → group. For quick starts. |
sublinks.txt |
Mixed share-link list (one per line) covering vless+reality+vision(tcp), vless+xhttp+tls, vless+ws+tls, vmess+ws, trojan+grpc, and shadowsocks (aes-256-gcm + 2022-blake3). Structurally valid, fake values. Parser fixture. |
README.md |
This file. |
How to use
Render a config to xray JSON (no apply), validate, then apply:
# On the router, install one of the sample configs:
cp examples/etc-config-shater.minimal /etc/config/shater
xrayctl test # gen + `xray -test`
xrayctl apply # gen -> test -> atomic swap (xray + nft + routing)
# or, with auto-rollback if you don't confirm within globals.confirm_timeout:
xrayctl apply --confirm 120 && xrayctl confirm
# Full-feature reference config:
cp examples/etc-config-shater.full /etc/config/shater && xrayctl test
Parse the share-link fixture (does not touch device state):
xrayctl gen --links examples/sublinks.txt # parse -> node objects / JSON
xrayctl selftest # smoke-tests parsers on fixtures
Consistency notes
- All option names and section types match
CONTRACT.mdexactly. - Cross-object references use the contract's target grammar
(
chain:<name>/group:<name>/node:<name>/direct/block) and refer to other sections by theirnameoption (see gap #1). sublinks.txtvalues are deliberately fake (fake UUIDs/keys/hosts) but syntactically valid so parsing succeeds; the realitypbk, the vmess base64 payload, and both shadowsocks userinfo encodings are all well-formed.
Contract gaps / interpretations
Points where CONTRACT.md is silent or ambiguous and I had to make a call.
Listed so the lead can tighten the spec.
-
Section addressing vs UCI anonymous sections. All sections except
globals/defaultare written anonymous (no explicit section id), yet the contract references them by name (group:sub0,egress=via-awg, andprofile.set=rule.pc-triple.egress=...). I assumed thenameoption is the identity and must be unique per section type. The spec should state this (and howprofile.setaddresses a rule: byname, not UCI index). -
globals.resolver_fallback. Mentioned only in prose (CONTRACT line ~146: "config resolver 'default'+option resolver_fallbackв globals"), but NOT in theglobalsoption block. I added it with a resolver name as its value (system-local). Confirm placement + that the value is a resolver name. -
config resolver 'default'. The default resolver is a section literally nameddefault. I gave it nonameoption (the section id is the name). Ambiguous whetherdefaultshould also carryoption name 'default'. -
dst_domainsub-forms. Contract lists "домен|suffix|keyword|geosite:x" but only defines thegeosite:prefix. There is no stated syntax for suffix vs keyword vs exact matches. I used plain domains andgeosite:only, and avoided inventing prefixes. Spec should define these (e.g. xray-styledomain:/full:/keyword:/regexp:). -
rule.srcMAC andiface:/zone:forms. MAC format unspecified — I used lowercase colon formaa:bb:cc:dd:ee:ff.iface:<name>— I mapped it to an inbound'snetwork/interface name (iface:guest); unclear if it means a UCI network interface, a device, or an inbound name. Clarify the namespace. -
dst_portrange syntax. "port|range|список" — comma-list is obvious (80,443), but the range delimiter is undefined (dash1000-2000vs colon1000:2000). I used comma-lists only to stay unambiguous. -
resolvertype=fakeip has no pool field. Theresolverschema only hasaddress+detour. Fortype=fakeipI put the pool CIDR inaddress(198.18.0.0/15, per feature-catalog §8). A dedicatedpooloption (and fakeip-domain/real-ip lists) may be warranted. -
resolvertype=local address. No format given. I used dnsmasq notation127.0.0.1#53. Could equally be empty (implied local) — clarify. -
group.strategy=singleselection. For a subscription-sourced group,singleneeds to say which node is fixed, but nopin/nodeoption is defined for that case. Not used in the examples; flag for the spec. -
Chain layers from one subscription. The contract's
chainexample usesgroup:sub0/sub1/sub2, but eachgroupbinds to exactly onesubscription. Producing three distinct layers from a single sub (the real "inverted chain") presumably needs three groups over the same sub with differentinclude/excludefilters — the mechanism isn't stated. Mychain 'triple'hops across a sub group, a manual group, and a fixed node to sidestep this; document the intended multi-layer-from-one-sub pattern. -
inbound.networkmultiplicity. "UCI-интерфейс(ы)" implies multiple, but it's anoption(single value), not alist. I assumed space-separated values in one option; alist networkmight be cleaner. Clarify.