System architecture
Two planes, cleanly split. The control plane (a Go daemon xrayctl +
LuCI UI over ubus) renders configuration and reconciles state. The data plane is a single
xray process plus kernel machinery — nothing heavy sits in the packet path.
xray.* + ACLxrayctl owns a dedicated
nft table, a reserved fwmark range and its own routing tables — it never edits fw4's table, so a
firewall reload can't break it, and every apply is a single atomic transaction.Data model — 8 objects
Everything the plugin does is expressed by composing these. No feature sprawl — just relationships between eight primitives, edited in UCI, rendered to xray + nftables.
1 Node
- vless/vmess/trojan/ss/socks/http
- reality · xhttp · vision · ws · grpc
- stable fingerprint identity
2 Group
- set of Nodes (a subscription)
- balancer: leastPing/random/failover
- observatory health
3 Chain
- ordered hops L1→L2→L3
- hop = Group or fixed Node
- inverted proxySettings
4 Egress
- interface (eth/wifi/sim)
- tunnel (wg/awg)
- chain/group · direct · block
5 Inbound
- TPROXY per LAN (multi-LAN)
- tcp + udp · explicit subnets
- + local socks/http (T1)
6 Rule
- src: cidr/host/mac/iface
- dst: domain/list/ip/list/geo/port
- → target + egress + kill-mode
7 Profile
- conditional overrides
- trigger: active WAN / probe / time
- scenes: Home/Travel/Night
8 List / Ruleset
- domain-list / ip-cidr-list
- inline / file / URL (auto-update)
- plain · clash-provider · geosite
Traffic flow
A LAN packet's journey, and exactly where the decisions happen. Sniffing recovers SNI/Host so domain rules work on transparent traffic. Every hop is annotated with its mark/table.
mark 0xT → :12345
sniff SNI/Host/QUIC
first-match
| Group | Node
mark 0x11 → table
DNS — configurable & leak-proof
Clients can't bypass it; resolution matches routing. Named resolvers, per-domain and per-client routing, and a switchable transparent (nftset) ↔ zero-leak (FakeIP) strategy.
block DoT/DoH bypass
→ 127.0.0.1
detour via outbound
Node lifecycle & identity
A subscription refresh must never silently break a pinned rule. Nodes carry a stable fingerprint; reconcile diffs by it; vanished pins fall back by policy.
HWID fixed/auto
present → keep
missing → stale
or pinned Node
Reliability — the “железно” contract
The top requirement: routing tables never break, you never lock yourself out. Every change is validated, applied atomically, and auto-reverts if it can't be confirmed.
xray -test · nft -c→ stage→ atomic apply
nft -f · swap→ commit-confirm
window→ committed ✓
Per-consumer analytics
Who ate how much — per device, per proxy, per domain, live and historical. The kernel counts; the daemon aggregates. Zero cost in the packet path.
Roadmap — we build all of it
Ship a rock-solid core first, then layer the dream features. Each tier is shippable and tested in QEMU before the next.
- Subscriptions + manual import paste/\n/file
- TPROXY multi-LAN · tcp+udp
- Balancer + observatory prune
- Rules: src/dst/domain-list/ip-list
- DNS: DoH + hijack + split (+FakeIP switch)
- Atomic apply · rollback · kill-switch
- LuCI: nodes(ping)/subs/status
- Build OpenWrt+ImmortalWrt · feed
- Multi-hop chains (L1→L2→L3)
- Per-client policy · egress select
- explain / trace
- Consumer leaderboard · node SLA
- Profiles / scenes
- Config history + diff + rollback
- One-click test-all → rank
- Telegram / webhook alerts
- Per-domain stats · connection inspector
- Device quotas · schedules
- FakeIP · geo-map · ad-block
- WAN-mode profiles · awg-wrap
- Auto route optimization
- QR import/export
- Fleet: one UI → many routers
- Per-destination latency routing
- Config converters (passwall/clash)
- sing-box engine adapter
- REST/gRPC API · TG bot