defaultIface() now asks the kernel authoritatively which interface it would egress
a public destination through (`ip route get 8.8.8.8`/`1.1.1.1`) instead of parsing
`ip route show default` by metric. This is correct for multi-WAN / mwan3 / policy-
routing setups where the active uplink is chosen by metric AND ip rules — the query
carries no fwmark so it reflects the real WAN egress, not the tproxy loopback table.
Falls back to the lowest-metric default route if `ip route get` is unavailable.
Clarifies the two orderings: which INTERFACE is active = kernel route metric; which
PROFILE applies = profile priority among those whose conditions all hold.
Verified live: `ip route get 8.8.8.8` -> eth1; a profile matching dum0 with HIGHER
priority stays inactive (its iface condition fails) while the eth1 profile (lower
priority, condition holds) is active — priority never overrides an unmet condition.
- profile_wanmode.go: defaultIface -> ip route get + devFromRouteGet +
lowestMetricDefaultIface fallback.
- test: TestDevFromRouteGet. r17.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The Profiles page was a stub for the actual catalog §7 feature (WAN-mode / failover
conditional overrides); this implements it. A `config profile` defines conditions
(active default-route interface, a connectivity probe up/down, a time window — all
AND'd) and overrides (force-enable/disable named rules, override the default
catch-all target/egress). The highest-priority profile whose conditions all hold is
active; its overrides are applied at gen/reconcile time and the cron re-applies when
the active profile flips.
- model.go/uci.go: Profile struct + `config profile` parse.
- profile_wanmode.go: defaultIface() (ip route), profileProbeUp() (HTTP), condition
eval, activeWanProfile() (priority + AND conditions; no-condition profile never
auto-activates), ProfileStatusJSON. strSet helper.
- generate.go: builder.activeProfile set in buildConfigInternal; buildRoutingRules
applies enable/disable-by-name + injects a default-target catch-all when active.
- schedule.go: scheduleSignature includes the active profile name, so shater-cron
reconciles on a profile transition (iface/probe/time boundary).
- main.go: `xrayctl wanmode`. shater.uc `wanmode` ubus + acl.
- profiles.js: rewritten to host WAN-mode Profiles (config profile GridSection) +
active-profile banner + Config snapshots + Backup/Restore + xray compatibility.
- tests: profile_wanmode_test.go (iface/schedule/AND conditions, priority selection,
no-condition never active, override enable/disable, default-target injection,
inactive-no-override).
Verified live on the 512M VM: `wanmode` reports active sim-mode (iface eth1);
force-enabled a disabled rule (profileonly.example appears); flipping the iface
condition deactivates it; schedule condition active at 22:30 / inactive at 12:00;
xray -test OK. Playwright: Profiles page renders the WAN-mode form + active banner +
snapshots + backup + compat with 0 console errors. r16.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>