Fix mermaid: quote labels, drop slashes and list-prefixes (Gitea render), remove stray fence

This commit is contained in:
omar committed 2026-07-09 00:11:37 +03:00
1 parent 2f021c1a1a
commit d3d8cc6be4
1 file changed
+62 -63
+62 -63
View File
@@ -7,83 +7,83 @@
```mermaid ```mermaid
flowchart TB flowchart TB
subgraph PRES[Presentation] subgraph PRES["Presentation"]
LUCI[LuCI app - JS] LUCI["LuCI app (JS)"]
UBUS[ubus / rpcd] UBUS["ubus, rpcd"]
end end
subgraph CTRL[Control plane - xrayctl - Go] subgraph CTRL["Control plane — xrayctl (Go)"]
UCIM[UCI model /etc/config/xray] UCIM["UCI model — etc-config-xray"]
FETCH[sub fetch + parse - libXray] FETCH["sub fetch + parse (libXray)"]
GEN[config generator - xray JSON + nft + ip-rules] GEN["config generator — xray JSON, nft, ip-rules"]
REC[reconciler - atomic apply / rollback] REC["reconciler — atomic apply, rollback"]
TEL[telemetry - xray API / nft counters / logs] TEL["telemetry — xray API, nft counters, logs"]
end end
subgraph DATA[Data plane - kernel + one xray] subgraph DATA["Data plane — kernel + one xray"]
XRAY[xray-core - tproxy in / balancers / observatory] XRAY["xray-core — tproxy in, balancers, observatory"]
NFT[nftables fw4 - own table / tproxy / marks / counters] NFT["nftables fw4 — own table, tproxy, marks, counters"]
DNSM[dnsmasq + DoH / FakeIP] DNSM["dnsmasq + DoH, FakeIP"]
ROUTE[ip rule / route - policy routing / egress bind] ROUTE["ip rule, route — policy routing"]
PROCD[procd - supervise / respawn] PROCD["procd — supervise, respawn"]
end end
LUCI <--> UBUS LUCI <--> UBUS
UBUS <--> CTRL UBUS <--> CTRL
CTRL -->|render + atomic apply| DATA CTRL -->|"render + atomic apply"| DATA
DATA -->|telemetry| TEL DATA -->|"telemetry"| TEL
``` ```
## 2. Модель данных — 8 объектов ## 2. Модель данных — 8 объектов
```mermaid ```mermaid
flowchart LR flowchart LR
SUB[Subscription - URL + HAPP headers] --> NODE[1. Node] SUB["Subscription — URL + HAPP headers"] --> NODE["1 — Node"]
MAN[manual - paste / \n / file] --> NODE MAN["manual — paste, file, link"] --> NODE
NODE --> GRP[2. Group +balancer] NODE --> GRP["2 — Group +balancer"]
GRP --> CH[3. Chain L1..Ln] GRP --> CH["3 — Chain L1..Ln"]
NODE --> CH NODE --> CH
INB[5. Inbound - multi-LAN tproxy] --> RULE[6. Rule] INB["5 — Inbound (multi-LAN tproxy)"] --> RULE["6 — Rule"]
RULE --> CH RULE --> CH
RULE --> GRP RULE --> GRP
RULE --> NODE RULE --> NODE
RULE --> EG[4. Egress] RULE --> EG["4 — Egress"]
LIST[8. List / Ruleset] --> RULE LIST["8 — List, Ruleset"] --> RULE
LIST --> DNS[DNS] LIST --> DNS["DNS"]
PROF[7. Profile - WAN-mode] -.override.-> RULE PROF["7 — Profile (WAN-mode)"] -.->|"override"| RULE
EG --> OUT[iface / tunnel / chain / direct / block] EG --> OUT["iface, tunnel, chain, direct, block"]
``` ```
## 3. Путь трафика ## 3. Путь трафика
```mermaid ```mermaid
flowchart LR flowchart LR
C[LAN client] -->|nft tproxy - mark to :12345| IN[xray inbound - dokodemo :12345 - sniff SNI/Host] C["LAN client"] -->|"nft tproxy, mark to :12345"| IN["xray inbound — dokodemo :12345, sniff SNI+Host"]
IN --> R{rule match - src / dst / list / geo} IN --> R{"rule match — src, dst, list, geo"}
R --> T[target - Chain L1-L2-L3 / Group / Node] R --> T["target — Chain L1-L2-L3, Group, Node"]
T -->|mark 0x11 to table| E[egress - awgOut / eth / wifi] T -->|"mark 0x11 to table"| E["egress — awgOut, eth, wifi"]
E --> NET[Internet - exit IP] E --> NET["Internet — exit IP"]
``` ```
Loop-guard: `sockopt.mark` на egress xray + bypass RFC1918/сервера; flow-offload остаётся ON для direct. Loop-guard: `sockopt.mark` на egress xray + bypass RFC1918 и сервера; flow-offload остаётся ON для direct.
## 4. DNS (настраиваемый, без утечек) ## 4. DNS (настраиваемый, без утечек)
```mermaid ```mermaid
flowchart LR flowchart LR
C[client :53] -->|hijack DNAT| DM[dnsmasq - noresolv / cache] C["client :53"] -->|"hijack DNAT"| DM["dnsmasq — noresolv, cache"]
DM --> DR{DNS router - domain / list / geo / client} DM --> DR{"DNS router — domain, list, geo, client"}
DR --> R1[ISP / local] DR --> R1["ISP, local"]
DR --> R2[DoH - detour via outbound] DR --> R2["DoH — detour via outbound"]
DR --> R3[FakeIP 198.18.x] DR --> R3["FakeIP 198.18.x"]
DR --> SET[(domain to nftset - для роутинга)] DR --> SET[("domain to nftset — для роутинга")]
``` ```
## 5. Жизненный цикл ноды и идентичность ## 5. Жизненный цикл ноды и идентичность
```mermaid ```mermaid
flowchart LR flowchart LR
S[subscription - HAPP HWID fixed/auto] --> P[parse - libXray] S["subscription — HAPP HWID fixed or auto"] --> P["parse (libXray)"]
P --> FP[fingerprint - hash addr/port/id/net/sec/sni] P --> FP["fingerprint — hash addr, port, id, net, sec, sni"]
FP --> RC{reconcile} FP --> RC{"reconcile"}
RC -->|new| ADD[add] RC -->|"new"| ADD["add"]
RC -->|present| KEEP[keep] RC -->|"present"| KEEP["keep"]
RC -->|missing| ST[stale N refreshes then remove] RC -->|"missing"| ST["stale N refreshes then remove"]
ADD --> SEL[selection - Group dynamic / pinned Node] ADD --> SEL["selection — Group dynamic or pinned Node"]
KEEP --> SEL KEEP --> SEL
SEL -->|pinned & missing| FB[fallback - group / direct / block] SEL -->|"pinned and missing"| FB["fallback — group, direct, block"]
``` ```
Обновление подписки: **интервал на каждую подписку** + вручную + при бутe; после апдейта → этот reconcile. Обновление подписки: **интервал на каждую подписку** + вручную + при бутe; после апдейта → этот reconcile.
@@ -92,10 +92,10 @@ flowchart LR
stateDiagram-v2 stateDiagram-v2
[*] --> Edit [*] --> Edit
Edit --> Build Edit --> Build
Build --> Validate: xray -test / nft -c Build --> Validate: xray-test, nft-c
Validate --> KeepOld: fail Validate --> KeepOld: fail
Validate --> Stage: ok Validate --> Stage: ok
Stage --> Apply: atomic nft -f + swap Stage --> Apply: atomic nft-f + swap
Apply --> ConfirmWindow Apply --> ConfirmWindow
ConfirmWindow --> Committed: confirmed ConfirmWindow --> Committed: confirmed
ConfirmWindow --> Rollback: timeout N s ConfirmWindow --> Rollback: timeout N s
@@ -104,33 +104,32 @@ stateDiagram-v2
Committed --> [*] Committed --> [*]
LastGood --> [*] LastGood --> [*]
``` ```
Свои метки/таблицы (fw4 не трогаем) · идемпотентный reconcile · hotplug-персист · mgmt-bypass всегда. Свои метки, таблицы (fw4 не трогаем) · идемпотентный reconcile · hotplug-персист · mgmt-bypass всегда.
## 7. Per-consumer статистика (ядро считает, демон агрегирует) ## 7. Per-consumer статистика (ядро считает, демон агрегирует)
```mermaid ```mermaid
flowchart LR flowchart LR
subgraph K[Kernel - in-path, free] subgraph K["Kernel — in-path, free"]
C1[nft dynamic counter set - per saddr] C1["nft dynamic counter set — per saddr"]
C2[saddr x mark counters - client x proxy] C2["saddr x mark counters — client x proxy"]
end end
subgraph U[Userspace - aggregate] subgraph U["Userspace — aggregate"]
X[xray Stats API - per-outbound] X["xray Stats API — per-outbound"]
L[access-log parse - T2 per-domain] L["access-log parse — T2 per-domain"]
RRD[RRD / nlbwmon - history] RRD["RRD, nlbwmon — history"]
end end
C1 --> AGG[xrayctl aggregator] C1 --> AGG["xrayctl aggregator"]
C2 --> AGG C2 --> AGG
X --> AGG X --> AGG
L --> AGG L --> AGG
RRD --> AGG RRD --> AGG
AGG -->|ubus| DASH[Dashboard - leaderboard / per-proxy / Sankey / conn-inspector] AGG -->|"ubus"| DASH["Dashboard — leaderboard, per-proxy, Sankey, conn-inspector"]
``` ```
## 8. Роадмап ## 8. Роадмап
| Тир | Содержание | | Тир | Содержание |
|-----|-----------| |-----|-----------|
| **MVP** | подписки+manual импорт · TPROXY multi-LAN · balancer+observatory · rules(src/dst/domain-list/ip-list) · DNS(DoH+hijack+split,±FakeIP) · atomic apply+rollback+kill-switch · LuCI(nodes/subs/status) · build OpenWrt+ImmortalWrt+feed | | **MVP** | подписки+manual импорт · TPROXY multi-LAN · balancer+observatory · rules (src, dst, domain-list, ip-list) · DNS (DoH+hijack+split, ±FakeIP) · atomic apply+rollback+kill-switch · LuCI (nodes, subs, status) · build OpenWrt+ImmortalWrt+feed |
| **T1** | multi-hop chains · per-client policy+egress-select · explain/trace · consumer leaderboard+SLA · profiles/scenes · config-history+rollback · one-click test-all · Telegram-алерты | | **T1** | multi-hop chains · per-client policy + egress-select · explain, trace · consumer leaderboard + SLA · profiles, scenes · config-history + rollback · one-click test-all · Telegram-алерты |
| **T2** | per-domain stats · connection inspector · device quotas · schedules · FakeIP · geo-map · WAN-mode profiles · awg-wrap · auto route-optimization · QR | | **T2** | per-domain stats · connection inspector · device quotas · schedules · FakeIP · geo-map · WAN-mode profiles · awg-wrap · auto route-optimization · QR |
| **T3** | fleet (много роутеров) · per-destination latency-routing · config-конвертеры · sing-box адаптер · REST/gRPC API · TG-бот | | **T3** | fleet (много роутеров) · per-destination latency-routing · config-конвертеры · sing-box адаптер · REST, gRPC API · TG-бот |
</content>