mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[PR #6577] [MERGED] feat(tuic): implement native in-process Go TUIC v5 server #6357
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#6357
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/MHSanaei/3x-ui/pull/6577
Author: @poise52
Created: 9/16/2026
Status: ✅ Merged
Merged: 10/3/2026
Merged by: @MHSanaei
Base:
main← Head:feat/tuic-native-go📝 Commits (10+)
5fdefa5feat(tuic): implement native in-process Go TUIC v5 serverb194c4cMerge branch 'main' into feat/tuic-native-goe4e58c0Merge branch 'MHSanaei:main' into feat/tuic-native-gob272beefix(tuic): address traffic accounting, client reload, and socket lifecycle issuesa73737aMerge branch 'MHSanaei:main' into feat/tuic-native-go520634dfix(service): update checkTuicSocksReverseConflict to use bindAddr for listenOverlaps846fd6bfix(tuic): resolve traffic double-accounting, UDP fragmentation, and socket lifecycle issues386deb3feat(tuic): complete native Go integration and address audit findingse960dc0Merge main into feat/tuic-native-go and preserve TUIC Host compatibilityf0d4360Merge main into feat/tuic-native-go📊 Changes
100 files changed (+7930 additions, -1455 deletions)
View changed files
📝
.github/workflows/release.yml(+0 -25)📝
DockerInit.sh(+0 -21)📝
docs/architecture.md(+6 -7)📝
docs/content/docs/en/config/clients.mdx(+1 -1)📝
docs/content/docs/en/config/inbounds.mdx(+1 -1)📝
docs/content/docs/en/config/tuic.mdx(+8 -11)📝
docs/content/docs/fa/config/clients.mdx(+1 -1)📝
docs/content/docs/fa/config/inbounds.mdx(+1 -1)📝
docs/content/docs/ru/config/clients.mdx(+1 -1)📝
docs/content/docs/ru/config/inbounds.mdx(+1 -1)📝
docs/content/docs/ru/config/tuic.mdx(+8 -11)📝
docs/content/docs/zh/config/clients.mdx(+1 -1)📝
docs/content/docs/zh/config/inbounds.mdx(+1 -1)➕
frontend/src/lib/tuic.ts(+35 -0)📝
frontend/src/lib/xray/inbound-form-adapter.ts(+7 -1)📝
frontend/src/lib/xray/inbound-link.ts(+5 -3)📝
frontend/src/pages/clients/ClientBulkAddModal.tsx(+1 -16)📝
frontend/src/pages/clients/ClientFormModal.tsx(+1 -18)📝
frontend/src/pages/clients/tuicConfig.ts(+2 -1)📝
frontend/src/pages/inbounds/form/protocols/tuic.tsx(+19 -29)...and 80 more files
📄 Description
Summary
Replaces the external Rust
tuic-serversidecar with a native in-process Go TUIC v5 server built ongithub.com/apernet/quic-go, the QUIC stack xray-core already ships. Decrypted TCP and UDP traffic goes through a loopback SOCKS5 inbound into Xray-core, so TUIC traffic follows Xray routing like any other inbound.Fixes #6560
Why
totalGB,expiryTimeand "start after first use" are enforced per client, not just per inbound. Online status no longer depends on parsing sidecar log lines.tuic-serveris no longer downloaded ininstall.sh,update.sh,DockerInit.shorrelease.yml. Old sidecar processes and files are cleaned up on install/update.Benchmark (main sidecar vs this PR)
Same TUIC client for both, loopback, default
bbr, Linux (Docker). This PR's path includes the hop through real Xray.A CONNECT whose first payload is neither TLS nor HTTP waits ~200 ms for Xray sniffing, which is the same as every other sniffing-enabled Xray inbound. TLS traffic is not affected.
Notes for operators
bbr(default) andnew_renorun server-side.cubicis still written to client profiles, but the server serves it asnew_renobecause quic-go has no CUBIC sender.64001–65000, derived from its id. Port conflicts with it are checked on save.Maintainer fixes on top of the contribution
main(node deployment of AmneziaWG/TUIC/MTProto): the forwarded-ports check stays node-scoped, and the TUIC relay port is checked next to AmneziaWG's.github.com/poise52/quic-gofork. BBR is installed per connection with xray-core'scongestion.UseBBRonapernet/quic-go, which removed a second QUIC/TLS stack and the cross-module BBR adapter.postgres:15).tuic_traffic_receiptswas created by a runtimeCREATE TABLE. It is now a GORM model registered inallModelsandmigrationModels, sox-ui migrate-dbcarries it.Type of change
Areas affected
How was this tested?
make test-go,make lint(0 issues),make gen-check, and frontend tests (179 files / 1786 tests),buildandbuild-storybook.internal/tuicfull suite and-raceon Linux: green.TestSyncInboundClientsOnPostgresagainst PostgreSQL 15: red before the alias fix, green after.tuic-server1.0.0 sidecar frommainand a real Xray build.Checklist
go build ./...and the test suite pass locally.npm run lint,npm run typecheck, andnpm run buildpass.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.