Two release-blocking defects found via live 512M OpenWrt VM testing.
1) Fork-storm / OOM (critical). Reconcile() -> reloadXray() ->
"/etc/init.d/shater reload" -> reload_service -> shater_reconcile ->
`xrayctl reconcile` -> Reconcile() was an infinite mutual recursion; each
level blocked on CombinedOutput and spawned a process (854x reconcile +
853x reload observed), exhausting RAM and pinning both vCPUs -> OOM-killer.
- Reconcile() no longer calls reloadXray(); procd's file-watch on run.json
restarts xray. Reconcile runs inside the init lifecycle, so calling the
init back is the recursion.
- reloadXray() now runs `/etc/init.d/shater start` (not `reload`); it is only
invoked from Apply()/Rollback() (LuCI/ubus/CLI), never the init lifecycle.
- init reload_service() simplified to start/stop (dropped the double reconcile).
Verified: `xrayctl apply` 0.39s (was >185s hang); 93 procs / load 0.00 stable
with an active 254-node config on 512M; xray binds :10853 API + :12345 tproxy.
2) UCI config namespace clash. shater shipped /etc/config/xray, which collides
with the xray-core dependency's own /etc/config/xray (opkg dropped ours to
/etc/config/xray-opkg, so the schema never took effect). Renamed the UCI
namespace xray -> shater everywhere (Go uci export/commit, all 11 LuCI views +
acl, init scripts, hotplug, Makefile conffiles, examples). Runtime paths
(/etc/xray/run.json, /usr/share/xray), the xray-core package, and the ubus
object name are intentionally unchanged.
Also: ci/pack-xrayctl.sh (local ipk packer) with a postinst chmod so the binary
is executable regardless of host-tar mode handling; PKG_RELEASE bumped to r3.
Verified end-to-end on a fresh 512M OpenWrt 24.10.3 VM: feed install
(opkg install luci-app-shater pulls xrayctl+shater-core), real LAN client
(netns in br-lan) proxied through a live subscription node -> exit IP changed
(104.156.233.234 vs 45.131.214.140 direct); per-client nft counters + xray
stats API populated. See PROOFS.md.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
64 lines
2.3 KiB
Plaintext
64 lines
2.3 KiB
Plaintext
#
|
|
# =============================================================================
|
|
# /etc/config/shater -- MINIMAL quick-start example (shater / xrayctl)
|
|
# =============================================================================
|
|
#
|
|
# The smallest useful config: ONE subscription, ONE group, ONE tproxy inbound,
|
|
# ONE default rule sending everything to the group. Copy to the device and
|
|
# apply:
|
|
# cp examples/etc-config-xray.minimal /etc/config/shater
|
|
# xrayctl test && xrayctl apply
|
|
#
|
|
# From here, add rules/chains/egresses incrementally (see etc-config-xray.full).
|
|
# =============================================================================
|
|
|
|
config globals 'globals'
|
|
option enabled '1'
|
|
option loglevel 'warning'
|
|
option kill_switch 'closed' # fail-closed: block if the proxy is down
|
|
option dns_mode 'nftset'
|
|
option ipv6 '1'
|
|
option fwmark_base '0x2000'
|
|
option table_base '0x2000'
|
|
option confirm_timeout '0' # no commit-confirm for the simple case
|
|
|
|
# Transparent intercept of the main LAN (TCP+UDP), with sniffing for domain rules.
|
|
config inbound
|
|
option name 'lan'
|
|
option enabled '1'
|
|
option network 'lan'
|
|
option tproxy_port '12345'
|
|
option tcp '1'
|
|
option udp '1'
|
|
option sniff '1'
|
|
|
|
# One subscription (HAPP emulation, auto HWID).
|
|
config subscription
|
|
option name 'qomar'
|
|
option enabled '1'
|
|
option url 'https://pro.qomar.pw/sub/EXAMPLEtoken0000'
|
|
option update_interval '6h'
|
|
option fetch_via 'direct'
|
|
option ua 'Happ/3.13.0'
|
|
option hwid 'auto'
|
|
option device_os 'Android'
|
|
option ver_os '14'
|
|
option device_model 'SM-G998B'
|
|
|
|
# One group over that subscription, pick the lowest-latency node.
|
|
config group
|
|
option name 'sub0'
|
|
option source 'subscription'
|
|
option subscription 'qomar'
|
|
option strategy 'leastping'
|
|
option probe_url 'http://www.gstatic.com/generate_204'
|
|
option probe_interval '60s'
|
|
|
|
# One default rule: everything -> the group. Fail-closed if it dies.
|
|
config rule
|
|
option name 'default'
|
|
option enabled '1'
|
|
option order '1000'
|
|
option target 'group:sub0'
|
|
option kill 'closed'
|