Files
shater/xrayctl
omarandClaude Opus 4.8 f1e4f16a9f
build / aarch64_cortex-a53 (push) Successful in 3m29s
build / x86_64 (push) Successful in 3m17s
fix(profiles): pick the active uplink via ip route get (metric/policy-aware)
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>
2026-07-09 17:16:16 +03:00
..