Files
3x-ui/docs/content/docs/fa/config/inbounds.mdx
T
Egor 0054e671f8 feat(tuic): implement native in-process Go TUIC v5 server (#6577)
* feat(tuic): implement native in-process Go TUIC v5 server

- Implement native TUIC v5 protocol server on pure Go using quic-go
- Bridge decrypted TCP/UDP traffic into Xray-core via loopback SOCKS5 inbound
- Support full Xray routing rules (geosite/geoip) and cascading outbounds
- Implement atomic per-client traffic accounting with TotalGB and ExpiryTime
- Add automatic legacy cleanup for older Rust tuic-server binaries, configs, and orphaned processes
- Eliminate external Rust tuic-server downloads from install/CI scripts

* fix(tuic): address traffic accounting, client reload, and socket lifecycle issues

* fix(service): update checkTuicSocksReverseConflict to use bindAddr for listenOverlaps

* fix(tuic): resolve traffic double-accounting, UDP fragmentation, and socket lifecycle issues

* feat(tuic): complete native Go integration and address audit findings

- Integrate an isolated QUIC fork pinned to a specific commit
- Preserve original QUIC dependencies for Xray, Hysteria and Gin
- Apply BBR, CUBIC and Reno to server connections and exported client profiles
- Bridge Xray BBR with correct monotonic time and congestion type conversions
- Handle congestion sender recreation after PMTU changes
- Update congestion control for new connections without restarting the listener
- Preserve existing connections and their selected congestion controller
- Apply per-inbound log levels through the shared panel logger
- Add lifecycle, authentication and TCP/UDP relay events without exposing secrets
- Rate-limit repeated authentication and relay warnings
- Support native and QUIC UDP relay modes on the same listener
- Recover UDP associations after relay worker failures
- Fix TCP relay cancellation, idle shutdown and half-close handling
- Close active sessions when client credentials are revoked or disabled
- Track traffic by immutable client statistics IDs across email and UUID changes
- Prevent ambiguous accounting and duplicate UUIDs within TUIC inbounds
- Persist pending traffic in a durable shutdown journal
- Replay journal batches transactionally without duplicate accounting
- Report server shutdown failures through the shared logger
- Preserve legacy flat and nested TUIC settings compatibility
- Normalize congestion controller values consistently across backend and frontend
- Preserve controller, UDP mode and SNI in client links and subscriptions
- Separate client profile options from server settings in the TUIC form
- Keep certificate path autofill explicit when changing client SNI
- Align UDP packet size validation with protocol limits
- Simplify and localize TUIC field hints and certificate autofill messages
- Add controller, TCP/UDP, logging and live settings update tests
- Add accounting identity, journal replay and shutdown regression tests
- Add relay recovery, session revocation and legacy frontend form tests

* fix(service): alias the TUIC duplicate-UUID subquery for PostgreSQL < 16

syncInboundClients runs a COUNT(*) FROM (subquery) for every client sync,
whatever the protocol. PostgreSQL before 16 rejects a FROM subquery with
no alias, so on the distro PostgreSQL install.sh provisions (14 on Ubuntu
22.04, 15 on Debian 12) every client add or edit failed with SQLSTATE
42601. Reproduced against postgres:15 with the new env-gated test.

* fix(database): create tuic_traffic_receipts through the model migration

AddTuicTrafficBatch issued CREATE TABLE IF NOT EXISTS at runtime, a schema
change outside db.go. The table was invisible to allModels and
migrationModels, so x-ui migrate-db dropped the receipts and a retained
journal could be counted twice after a SQLite to PostgreSQL move. It is
now a GORM model in both lists, and the insert uses OnConflict DoNothing.

* chore(tuic): skip the ICMP-dependent relay test on Windows, drop dead collectors

Go disables SIO_UDP_CONNRESET on Windows, so a dead UDP bridge never fails
a read there and TestAudit3UDPAssociationMustRecoverAfterBridgeReadFailure
was red on every Windows run. Server.CollectTotalTraffic and
Manager.CollectTraffic had no caller.

* refactor(tuic): serve TUIC on apernet/quic-go instead of a personal fork

The native server depended on github.com/poise52/quic-go, a personal fork
of apernet/quic-go patched only to pick the congestion controller before
the handshake. That put a second QUIC/TLS stack in the binary that no
upstream security fix reaches. apernet/quic-go is already in the graph
through xray-core and exposes SetCongestionControl, so BBR is now installed
on each accepted connection with Xray's own congestion.UseBBR; the
cross-module BBR adapter is gone.

apernet ships New Reno as its only built-in sender, so a cubic setting is
served as new_reno server-side (clients still get cubic in their profile).
The test inspectors now read the sender under congestionMutex, which the
post-handshake install writes under.

Linux loopback, single stream through Xray: 2428 -> 3383 Mbit/s (bbr).

---------

Co-authored-by: Sanaei <ho3ein.sanaei@gmail.com>
2026-10-03 02:56:02 +02:00

103 lines
6.1 KiB
Plaintext

---
title: ورودی‌ها و پروتکل‌ها
description: ساخت ورودی‌ها در 3x-ui — پروتکل‌ها، انتقال‌ها، بازنشانی و انقضای ترافیک، و fallbackهایی که چند پروتکل را روی یک پورت سرویس می‌دهند.
icon: ArrowDownToLine
---
یک **ورودی (inbound)** شنونده‌ای است که اتصال‌های کلاینت را روی یک پورت با
پروتکل و انتقال مشخصی می‌پذیرد. بیشتر کارهای روزمره شما ساخت و مدیریت ورودی‌ها و
کلاینت‌های درون آن‌هاست.
## ساخت یک ورودی
<Steps>
<Step>
### افزودن یک ورودی
به **Inbounds → Add** بروید، یک توضیح (remark) برای آن بگذارید، یک **پروتکل**
انتخاب کنید، و یک **پورت** و آدرس شنود انتخاب کنید.
</Step>
<Step>
### انتخاب انتقال و امنیت
انتقال (TCP، WebSocket، gRPC، HTTPUpgrade، XHTTP، …) و لایه امنیتی (هیچ‌کدام،
TLS یا REALITY) را انتخاب کنید. به [انتقال‌ها](/docs/config/transports) و
[REALITY](/docs/config/reality) مراجعه کنید.
</Step>
<Step>
### افزودن کلاینت‌ها
یک یا چند کلاینت اضافه کنید که هر کدام اعتبارنامه، محدودیت‌ها و لینک اشتراک
خودش را دارد. به [کلاینت‌ها](/docs/config/clients) مراجعه کنید.
</Step>
<Step>
### تنظیم محدودیت ترافیک، انقضا و بازنشانی
به‌صورت اختیاری می‌توانید کل ترافیک را محدود کنید و یک تاریخ انقضا برای ورودی
تعیین کنید، و یک زمان‌بندی **بازنشانی ترافیک** دوره‌ای انتخاب کنید: `never`
(پیش‌فرض)، `hourly`، `daily`، `weekly` یا `monthly`.
برای بازنشانی `monthly`، روزی از ۱ تا ۳۱ انتخاب کنید. اگر آن روز در ماهی کوتاه‌تر
وجود نداشته باشد، بازنشانی در آخرین روز همان ماه انجام می‌شود.
</Step>
</Steps>
## پروتکل‌های پشتیبانی‌شده
ویرایشگر ورودی این پروتکل‌ها را می‌پذیرد:
| پروتکل | توضیحات |
| ---------------------- | ------------------------------------------------------------------------ |
| **VLESS** | سبک؛ پایه‌ی REALITY + XTLS-Vision. توصیه‌شده. |
| **VMess** | قدیمی‌تر اما با پشتیبانی بسیار گسترده در کلاینت‌ها. |
| **Trojan** | مبتنی بر TLS؛ از XTLS و fallback پشتیبانی می‌کند. |
| **Shadowsocks** | شامل رمزهای Shadowsocks-2022 (`2022-blake3-*`). |
| **WireGuard** | تونل مدرن. |
| **AmneziaWG** | نسخه مبهم‌شده فورک WireGuard که در فرایند پنل تعبیه شده است. مشاهده [AmneziaWG](/docs/config/amneziawg). |
| **Hysteria2** | با عنوان `hysteria` انتخاب می‌شود؛ پنل لینک‌های `hysteria2://` تولید می‌کند. |
| **HTTP** | پراکسی HTTP. |
| **Mixed (SOCKS/HTTP)** | یک شنونده ترکیبی SOCKS + HTTP. |
| **Dokodemo-door / Tunnel** | فورواردینگ پورت / هدایت ترافیک. |
| **MTProto** | پراکسی MTProto تلگرام که توسط یک فرایند همراه `mtg` سرویس می‌شود (نه Xray). |
| **TUIC** | پروتکل پراکسی مبتنی بر QUIC نسخه ۵ که به صورت سرور بومی Go درون فرایند ارائه می‌شود. مشاهده [TUIC](/docs/config/tuic). |
<Callout type="info">
Hysteria2 در سطح داخلی یک پروتکل جداگانه نیست — همان پروتکل `hysteria` است که
نسخه انتقال آن روی ۲ تنظیم شده، و پنل برای آن لینک‌های اشتراک `hysteria2://`
تولید می‌کند.
</Callout>
## Fallbackها — چند پروتکل روی یک پورت
Fallbackها به یک پورت TLS واحد (مثلاً `443`) اجازه می‌دهند بیش از یک پروتکل را
سرویس دهد — برای مثال VLESS **و** Trojan — با هدایت دست‌دادن‌های (handshake)
ناهماهنگ به یک ورودی فرزند. در 3x-ui، fallbackها در پنل مدیریت می‌شوند (لیست
**Fallbacks** یک ورودی اصلی) به‌جای آنکه به‌صورت دستی در JSON نوشته شوند.
Fallbackها تنها زمانی در دسترس‌اند که ورودی اصلی این‌گونه باشد:
- **VLESS** یا **Trojan**،
- روی انتقال خام **TCP**،
- با امنیت **TLS** یا **REALITY**.
هر قاعده fallback یک ورودی فرزند را هدف قرار می‌دهد و می‌تواند بر اساس `path`،
`alpn` و `dest` تطبیق یابد. لینک‌های اشتراک کلاینت برای یک فرزند fallback
به‌صورت خودکار بازنویسی می‌شوند تا آدرس، پورت و TLS ورودی اصلی را اعلام کنند.
## مطمئن نیستید کدام را انتخاب کنید؟
از این جادوگر استفاده کنید تا بر اساس اهداف و کلاینت‌هایتان یک پیشنهاد دریافت کنید:
<ProtocolWizard />
<Callout type="info">
برای مقاومت در برابر سانسور با کلاینت‌های مدرن، **VLESS + REALITY +
XTLS-Vision** معمولاً بهترین انتخاب است — به
[REALITY](/docs/config/reality) ادامه دهید.
</Callout>