mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #6437] [Feature]: Support Mieru protocol for port-hopping and anti-probing resilience #4359
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#4359
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/6437
Is your feature request related to a problem?
In regions with aggressive DPI filtering (such as Russia, China, and Iran), traditional TLS/Reality setups and single-port UDP connections are increasingly facing port-based throttling, IP bans, and active probing. Censors easily detect and throttle persistent high-bandwidth connections tied to a single listening port.
Describe the solution you'd like
Integrate the Mieru protocol (
github.com/enigmasa/mieru) as a supported inbound, similar to how userspace AmneziaWG was recently introduced.Desired implementation:
mieru40000-40050)TCPorUDPRepository reference: https://github.com/enigmasa/mieru
Alternatives you've considered
Tried using VLESS-Reality, AmneziaWG, and standard Shadowsocks. While Reality works well for general browsing, aggressive ISP filters frequently throttle high-bandwidth single-port connections. AmneziaWG helps with header obfuscation, but without dynamic port-hopping, censors can still flag and throttle persistent UDP flows to a single destination port. Mieru addresses both active probing and port-based throttling simultaneously.
Concrete use case
Managing a private server for users in heavily censored regions (Russia, Iran, China). During DPI throttling waves, continuous traffic on a single static port (even VLESS-Reality on 443 or AWG) frequently gets throttled to unusable speeds (<1 Mbps) or dropped. Mieru's port-hopping and active-probing resistance allow users to maintain a persistent, reliable connection by dynamically rotating ports without needing to change server endpoints manually.
Mockups, screenshots, or examples
Example inbound JSON structure:
@github-actions[bot] commented on GitHub (Sep 9, 2026):
Thanks — this is a legitimate feature request, and nothing in the panel supports Mieru today (no
mierustring exists anywhere in the repository). It is worth saying up front that this cannot be a small addition, and that the port-hopping half of what you are after already has a partial answer in the panel today.Why Mieru is not a drop-in
The panel's protocol set is fixed in one place,
internal/database/model/model.go:24-36, and enforced on the inbound:Everything in that list except
mtprotoandamneziawgis a native Xray-core inbound — the panel builds the account objects straight from Xray-core's own proto types (internal/xray/api.go:614,case "hysteria":→hysteriaAccount.Account). Mieru is not one of those: nomierumodule appears ingo.sum, so the pinned core (github.com/xtls/xray-core v1.260327.1-0.20260908222543-52a412d9e2f5,go.mod:28) does not carry it either.So Mieru would have to become the third out-of-core runtime, next to the two exceptions you correctly identified:
internal/mtproto/,docs/architecture.md§1).internal/amneziawgnet/). Its introduction,effcccce feat(amneziawg): add native AmneziaWG protocol support (#6105), changed 146 files, 15 241 insertions.Your "Statistics / traffic counters" bullet is the part that bites hardest. Per-client accounting in this panel comes from Xray's gRPC stats, so AmneziaWG does not count traffic itself — it relays decapsulated traffic into a loopback Xray SOCKS5 inbound purely to borrow that identity:
A Mieru integration would need the same relay, plus config generation, a reconcile cron job, share-link output in the three independent link implementations (
internal/util/link/+internal/sub/,frontend/src/lib/xray/,docs/lib/xray/), the frontend forms/schemas and i18n keys in 13 locale files.Also note your example
"port": "40000-40050": the inbound port is a single integer today (Port int ... validate:"gte=0,lte=65535",internal/database/model/model.go:64). Port ranges on an inbound are a separate open request, #5601.What you can use today for port hopping
Hysteria2 inbounds already support a hop range. In Inbound → Stream → FinalMask → QUIC Params → "UDP Hop" you set Hop Ports and Hop Interval (s) (
frontend/src/lib/xray/forms/transport/FinalMaskForm.tsx:1486-1501), and the panel advertises the range to clients asmport=in the share link (hysteriaHopPorts,internal/sub/service.go:1375-1384).One thing that trips people up: the panel advertises the range but does not install host firewall rules — the operator forwards the range to the listen port. That is the maintainer's documented position in #5402 (and #4993 / #4974), with this workaround for listen port 443 and hop range 20000-30000:
Make it persistent so it survives a reboot. A Mieru inbound would need the same operator-side NAT (or #5601) — port hopping is a client-side behaviour in every implementation the panel currently ships.
One thing I could not check
Your request links
github.com/enigmasa/mieru. I have no network access in this environment, so I could not verify that repository; the Mieru project I am aware of isgithub.com/enfein/mieru. Please confirm which one you mean — whichever it is becomes a Go dependency of the panel (or a fetched sidecar binary likemtg-multi), so the exact upstream matters.Verdict: Feature request — kept open for the maintainer to decide. Related: #5601 (inbound port ranges).
This reply was generated automatically; a maintainer may follow up.
@Iaslav24 commented on GitHub (Sep 9, 2026):
Thank you for the detailed architectural breakdown.
Upstream Repository:
Yes, the official and canonical repository is indeed https://github.com/enfein/mieru. Please consider
github.com/enfein/mieruas the target dependency.Architecture & Traffic Stats:
Following the AmneziaWG pattern (
internal/amneziawgnet/relay.godecapsulating traffic into a loopback Xray SOCKS5 inbound) makes complete sense. It cleanly solves the per-client gRPC traffic accounting without requiring upstream changes in Xray-core.Port-Hopping Handling:
Using the same approach as Hysteria 2 (binding to a single port while delegating the port range redirection to host-level
iptables/nftablesREDIRECT rules) is a completely acceptable and practical solution. It avoids blocking on #5601 and keeps the database model intact.Looking forward to the maintainers' feedback on this!