mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[PR #6753] [MERGED] fix(tuic): preserve IP destinations during sniffing #6442
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#6442
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/6753
Author: @libmur-dev
Created: 10/6/2026
Status: ✅ Merged
Merged: 10/7/2026
Merged by: @MHSanaei
Base:
main← Head:fix/tuic-sniffing-route-only📝 Commits (2)
c586d94fix(tuic): preserve IP destinations during sniffing1710dc0Merge branch 'main' into fix/tuic-sniffing-route-only📊 Changes
2 files changed (+18 additions, -4 deletions)
View changed files
📝
internal/web/service/inbound_tuic_test.go(+14 -2)📝
internal/web/service/xray.go(+4 -2)📄 Description
English
Summary
Root cause
The native TUIC server forwards decrypted traffic through a generated loopback SOCKS inbound. That inbound enabled Xray sniffing with
destOverride, but omittedrouteOnly. When a client connected to an IP while TLS carried a different or non-resolvable SNI, Xray replaced the requested IP with that hostname and the connection failed during DNS resolution.Fix
Set
routeOnly: trueon the generated TUIC relay inbound. This matches the existing AmneziaWG relay behavior: the sniffed domain remains available for routing, while the actual connection keeps the client-requested destination.Testing
go test ./internal/web/service -run '^TestInjectTuicSocks$' -count=1go test ./internal/web/service -count=1go build ./...go test ./...passed all packages except one unrelated Discord WebSocket timing test; that exact test passed on an immediate isolated rerun.npm auditon vulnerabilities in the existing lockfile; this PR changes no frontend files or dependencies.Русский
Кратко
Причина
Встроенный TUIC-сервер передаёт расшифрованный трафик в автоматически созданный loopback SOCKS-inbound. В нём Xray sniffing включался с
destOverride, но безrouteOnly. Когда клиент подключался к IP, а TLS содержал другой или неразрешимый SNI, Xray заменял исходный IP этим доменом, после чего соединение завершалось ошибкой DNS.Исправление
Для сгенерированного TUIC relay inbound установлено
routeOnly: true. Это соответствует уже используемому поведению AmneziaWG: обнаруженный домен применяется для маршрутизации, но фактическое соединение сохраняет адрес, запрошенный клиентом.Проверка
go test ./internal/web/service -run '^TestInjectTuicSocks$' -count=1go test ./internal/web/service -count=1go build ./...go test ./...прошёл все пакеты, кроме одного постороннего нестабильного Discord WebSocket-теста; при немедленном отдельном повторе этот тест прошёл.npm auditиз-за уязвимостей в существующем lockfile; этот PR не меняет frontend-файлы или зависимости.Fixes #6750
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.