→ همهی بخشها
معماری
اجزا و مسیر داده
Section titled “اجزا و مسیر داده”
flowchart LR
Admin(["Administrator"])
subgraph PanelHost["Panel server · docker compose"]
direction TB
Dash["tifusi-dashboard<br/>nginx + React SPA<br/>TCP 443 / 8080"]
API["tifusi-panel<br/>FastAPI · TCP 8000"]
DB[("SQLite<br/>./data")]
Dash -->|"/api · /sub · /code · /app"| API
API <--> DB
end
subgraph NodeHost["Node server · tifusi-node · host network"]
direction TB
Agent["Node agent<br/>HTTPS · TCP 62050"]
Xray["Xray-core<br/>VLESS · VMess · Trojan · SS"]
Swan["strongSwan charon<br/>IKEv2 · EAP-MSCHAPv2"]
L2TP["xl2tpd<br/>L2TP over IPsec"]
Agent -->|"write config, restart"| Xray
Agent -->|"swanctl --load-all"| Swan
Agent -->|"apply config"| L2TP
end
subgraph Clients["Clients"]
direction TB
App["Android app<br/>(legacy)"]
XC["Xray clients<br/>v2rayNG · V2Box · sing-box · Clash"]
Native["Native IKEv2 / L2TP<br/>iOS · Android · Windows"]
end
Admin -->|"HTTPS"| Dash
API -->|"POST /config<br/>POST /ipsec-config<br/>X-Node-Api-Key"| Agent
API -.->|"GET /health · GET /stats<br/>every 30 s"| Agent
App -->|"GET /code/{code}/app.json<br/>POST /app/report"| Dash
XC -->|"GET /sub/{secret}"| Dash
App ==>|"VLESS REALITY"| Xray
App ==>|"IKEv2 · UDP 500/4500"| Swan
XC ==>|"proxy protocols"| Xray
Native ==>|"UDP 500/4500"| Swan
Native ==>|"UDP 1701 in IPsec"| L2TP
فلشهای پیوسته درخواستهای لایهی کنترل، فلشهای نقطهچین پایش دورهای و فلشهای ضخیم ترافیک لایهی داده را نشان میدهند. پنل ترافیک کاربران را عبور نمیدهد و کلاینتها مستقیماً به نشانی نودهایی که در هاستها منتشر شدهاند متصل میشوند.
چرخهی همگامسازی نود
Section titled “چرخهی همگامسازی نود”
sequenceDiagram
autonumber
participant Admin
participant Panel as Panel API
participant Agent as Node agent
participant Core as Xray / strongSwan
participant Client
Admin->>Panel: Create, update, reset or delete a user
Panel->>Panel: Persist change and resolve group access
Panel-)Agent: POST /config (rendered Xray JSON)
Panel-)Agent: POST /ipsec-config (swanctl connections, EAP secrets, PSK, pools)
Agent->>Core: Apply configuration
Client->>Panel: GET /code/{code}/app.json
Panel-->>Client: Endpoints, credentials, remaining quota and expiry
Client->>Core: Establish tunnel
Client-)Panel: POST /app/report (connection result)
loop Every TIFUSI_TRAFFIC_SYNC_INTERVAL_SECONDS (default 30)
Panel->>Agent: GET /health, GET /stats
Agent-->>Panel: Process state and per-user traffic counters
Panel->>Panel: Accumulate usage, transition expired / limited users
Panel-)Agent: Resync nodes whose effective user set changed
end
ساختار مخزن
Section titled “ساختار مخزن”| Path | Contents |
|---|---|
backend/app |
FastAPI application: routers, SQLAlchemy models, Xray config builder, subscription renderers, node sync, traffic accounting, Connection Shield failover (shield/), network health (network_health/) |
backend/alembic |
Database migrations |
backend/cli |
tifusi-cli, including first-run admin key generation |
backend/node_agent |
سرویس ایجنت نود، یکپارچگی strongSwan/xl2tpd، اعتبارسنجی و برگشت کانفیگ (safe_apply.py)، Dockerfile نود |
backend/app/node_ssh |
نصب، ترمینال و آپدیت Canary نودها با SSH |
backend/app/tunnels |
کانفیگ تانل، بستهی آفلاین، نصب و آپدیت با SSH |
backend/tests |
تستهای pytest (توسعه) |
backend/tunnel_agent |
Relay agent for the Tunnels feature (Go) |
frontend |
React dashboard and nginx image |
install.sh, install-node.sh |
Panel and node installers |
manage.sh |
Operations menu, installed as /usr/local/bin/tifusi-panel and run as tifusi panel |
scripts/tifusi |
Shared tifusi launcher for Tifusi Panel, the node and Tifusi Bot |
.github/workflows/tests.yml |
اجرای تستها و بیلد داشبورد با هر push |
build-images.yml (ریپوی عمومی) |
اول تستها، بعد ساخت و انتشار ایمیجهای پنل، داشبورد و نود در GHCR |
داشبورد با React 18، Vite و Tailwind CSS ساخته شده، به فارسی (راستبهچپ) و انگلیسی بومیسازی شده و از قلمهای Vazirmatn و Poppins بهصورت خودمیزبان استفاده میکند.
