mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #6438] [Feature]: Add DNSTT (DNS Tunneling) inbound for emergency bypass during strict whitelist lockdowns (Iran NIN & Russia LTE blackouts) #4357
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#4357
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?
Originally created by @Iaslav24 on GitHub (Sep 9, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6438
Is your feature request related to a problem?
During state-enforced whitelist / default-deny lockdowns:
Under these conditions, all modern obfuscated protocols (VLESS-Reality, AmneziaWG, Hysteria 2, Shadowsocks) completely fail because foreign IPs and ports are blocked before any TLS/noise handshake can even start.
The only channel that consistently remains open through carrier gateways and recursive resolvers is DNS query traffic on UDP port 53.
Describe the solution you'd like
Integrate DNSTT (DNS Tunneling Tool by David Fifield) into 3x-ui as an emergency "last resort" inbound protocol, either embedded via Go modules or managed as a background runner daemon.
Key Implementation Requirements:
dnsttsystemd-resolvedso port 53 can be bound without manual terminal troubleshooting.Reference: https://www.bamsoftware.com/software/dnstt/
Alternatives you've considered
Concrete use case
A humanitarian lifeline connection when mobile and broadband networks are pushed into strict white-list isolation:
While DNSTT throughput is modest (100–500 Kbps), it provides critical survivability: it allows users to route low-bandwidth text messaging (Telegram, Signal, Matrix), emergency news feeds, and coordination traffic through public recursive resolvers (Cloudflare, Google, or local ISP DNS) when everything else is completely severed.
Mockups, screenshots, or examples
Architecture diagram:
Client (dnstt-client / mobile app)
↓ Encrypted DNS queries (UDP 53, DoH, or DoT)
Public / ISP Recursive Resolvers (1.1.1.1, 8.8.8.8, Local ISP)
↓ Queries forwarded to authoritative NS
3x-ui Server (dnstt inbound listening on UDP 53)
↓ Noise decryption
Internal Xray Dispatcher / Outbound
Which parts of the panel would this affect?
Backend (API endpoints, login, settings), Frontend (UI / panel pages), Subscription (share links / Clash / JSON), Install / upgrade script
Are you willing to help?
Before submitting
@github-actions[bot] commented on GitHub (Sep 9, 2026):
Valid request and the reasoning about default-deny whitelists is technically sound — but nothing in 3x-ui does this today, and DNSTT cannot be an "inbound" the way VLESS is: it would become a third subsystem living outside Xray, next to
internal/mtproto/andinternal/amneziawgnet/. For the record, DNS tunnelling has been asked twice before, so the "not requested before" checkbox in the form isn't accurate: #3903 (DNSTT specifically) and #4389 (MasterDnsVPN / StormDNS), both closed.Your distinction from the panel's existing
xdnsmask is correctThe panel already exposes a UDP FinalMask named
xdns:That is shaping only. The docs describe FinalMask as something that "wraps traffic after the transport and security layers" (
docs/content/docs/en/config/transports.mdx:121-123) — the packets still leave for your server's IP and port on the same socket. Under an IP whitelist that never happens, soxdnsdoes not cover your scenario. Worth stating explicitly, because the earlier DNSTT request drew exactly that objection in its thread.No DNS-tunnel protocol exists in the panel: the protocol enum is
internal/database/model/model.go:24-36(vmess,vless,tunnel,http,trojan,shadowsocks,mixed,wireguard,hysteria,mtproto,amneziawg), pinned again by the validation tag atinternal/database/model/model.go:65.What integrating dnstt would actually take here
Your "pipe into a local SOCKS5 inbound" idea is not the hard part — that mechanism already exists. AmneziaWG does exactly that, relaying decapsulated traffic into a loopback SOCKS5 Xray inbound that carries one account per client email, because the username is what gives Xray's stats an identity:
The sidecar precedent is MTProto: binary resolved next to the Xray binary (
internal/mtproto/process.go:38-41), launched asmtg run <config>(internal/mtproto/process.go:165), and reconciled plus scraped by a cron job that "folds the per-client traffic scraped from each mtg/statsendpoint into the usual client and inbound traffic accounting" (internal/web/job/mtproto_job.go:10-13).That is the real blocker. The panel's whole client model is per-client — credential,
totalGB,expiryTime, IP limit — andmtg-multionly works as a sidecar because it is a fork that exposes per-client secrets, ad-tags and quotas plus a stats endpoint.dnstt-serverupstream has a single server keypair and no per-client credential (your own field list has one Private Key / one Public Key), so there is nothing for a client, its quota or its expiry to bind to. That last point about upstream dnstt is inference — I could not read the upstream source from here — but the panel-side requirement it collides with is not.Beyond that, a new protocol drags the whole chain in
CLAUDE.md: a migration ininternal/database/db.go, theStructAllowallowlist intools/openapigen/main.go,frontend/src/pages/api-docs/endpoints.ts, 13 locale files ininternal/web/translation/, and the docs. The mtproto sidecar alone touches ~10 files underinternal/web/service/plus its own job.The parts that can't be delivered as written
vmess/vless/trojan/shadowsocksonly (internal/sub/clash_service.go:302-324), and there is no dnstt URI scheme that any downstream client (sing-box, mihomo, v2rayNG) parses. Whatever the panel emitted, users would still needdnstt-clientconfigured by hand — so the "Subscription (share links / Clash / JSON)" box in your request has no destination.systemd-resolved,resolv.confor port-53 reference anywhere ininstall.shorx-ui.sh, and the unit is a plainExecStart=/usr/local/x-ui/x-uiwith no capability grants (x-ui.service.debian:13). A button that reconfigures host DNS resolution is a far larger blast radius than anything the panel does today.What works today, with no panel change
dnstt-serverforwards each tunnelled stream to one upstream TCP address, so point it at an inbound the panel already manages:127.0.0.1— the field exists (internal/database/model/model.go:63) and the editor exposes it (docs/content/docs/en/config/inbounds.mdx:18-19).plus your NS delegation for
tunnel.example.comand a UDP 53 → 5300 redirect.Two caveats for that setup: throughput will be whatever dnstt gives you, and per-IP limits stop working for those clients — every connection arrives from loopback, and the core drops
127.0.0.1/[::1]before the IP-limit job ever sees them (internal/web/job/check_client_ip_job.go:113-114).Whether a full
dnsttprotocol lands in the panel is the maintainer's call; the code facts above are what that decision rests on. Note that #4389 — the general DNS-tunnelling ask — was closed as not planned, while #3903 was closed as completed even though no DNSTT code exists on the default branch, so neither closure is a decision I can point you to. I'm leaving this one open underenhancement.Verdict: Feature request (related: #3903, #4389 — same DNS-tunnelling ask, both closed; no shared defect, so nothing to close here)
This reply was generated automatically; a maintainer may follow up.
@Iaslav24 commented on GitHub (Sep 9, 2026):
Thank you for this brilliant and in-depth architectural breakdown!
Clarification on Previous Issues:
Understood regarding #3903 and #4389. The clarification about why FinalMask
xdnsis fundamentally different from authoritative DNS tunneling during default-deny whitelists is crucial, and I appreciate that the bot highlighted this distinction.Multi-User Accounting & Architecture:
The point about
dnstt-serverlacking per-user authentication is completely fair. Your suggested workaround is actually brilliant: binding an internal VLESS/TCP (or SOCKS) inbound to127.0.0.1and pointing standalonednstt-serverto it allows Xray to handle UUIDs, user traffic quotas, and expiry times naturally, completely sidestepping the need to refactor 3x-ui's user database.Conclusion:
Even if full native GUI integration is currently too heavy due to subscription schemas and port 53 conflicts, having this documented or offered as an optional auxiliary background service would be a lifesaver for people facing severe regional blackouts.
Thank you for keeping the issue open for the maintainers!