mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #5002] [Feature]: Unified Client Management & Traffic Stats for WireGuard Peers #3521
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#3521
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 @DIMFLIX on GitHub (Jun 6, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5002
Is your feature request related to a problem?
Yes. Currently, managing WireGuard peers is a major UX pain point compared to VLESS/VMess. Because WG peers are managed strictly inside the inbound settings, we cannot:
I want to draw attention to a growing trend: WireGuard is no longer just a simple VPN connection between two points. It is increasingly being used as the underlying transport layer for modern routing, masking, and circumvention solutions (such as olcrtc, vk-turn-proxy, and various TURN-based infrastructures). Due to this shift, the demand for proper management of WG clients has skyrocketed.
Currently, there is significant dissatisfaction within the community regarding 3x-ui’s limitations with WG. As a result, we are seeing a negative trend:
Describe the solution you'd like
I would like to see WireGuard peers integrated into the global "Clients" tab (just like VLESS/VMess/Trojan), OR at least have a dedicated "WireGuard Clients" sub-menu where we can manage traffic limits, expiration dates, and toggle peers on/off.
Additional context
I am aware that a similar request (#3419) was closed as "not planned" in the past. However, as WireGuard adoption grows, the lack of basic client management (traffic stats, expiration) makes 3x-ui very inconvenient for WG compared to other panels.
Even a basic implementation (like showing traffic and adding an expiration date) would be a massive quality-of-life improvement for the community.
Alternatives you've considered
No response
Concrete use case
No response
Mockups, screenshots, or examples
No response
Which parts of the panel would this affect?
Backend (API endpoints, login, settings)
Are you willing to help?
Before submitting
@github-actions[bot] commented on GitHub (Jun 6, 2026):
Thanks for the detailed write-up and for referencing the history. This is a genuine and well-motivated request. Here's an honest look at where things stand in the current codebase and why this is non-trivial.
Why WireGuard peers can't slot into the existing client system today
The entire "Clients" tab and its surrounding infrastructure is built around a specific contract that WireGuard doesn't satisfy:
1. Settings JSON key mismatch
GetClients()inweb/service/inbound.goreadssettings["clients"]from the inbound JSON. WireGuard inbounds usesettings["peers"](matching the Xray-core WireGuard schema). So WireGuard peers are invisible to every part of the pipeline that callsGetClients()— traffic stats sync, enable/disable, expiry jobs, the Telegram bot, etc.2. No hot-add/remove via Xray API
AddUser()inxray/api.gohandles vmess, vless, trojan, shadowsocks, and hysteria — all of which support Xray-core'sAlterInboundgRPC operation for live user changes. The WireGuard case hitsdefault: return nil(a no-op), meaning any peer add/remove/toggle always requires a full Xray restart. The Xray-core gRPC API simply has no equivalent ofAddUserOperationfor WireGuard peers.3. Identity model is fundamentally different
model.ClientcarriesID(UUID),Password,Auth,Flow,SubID, etc. WireGuard peers are identified by a public key and anallowedIPslist — none of which map to the existing client fields.fillProtocolDefaults()inclient.goauto-generates credentials for vmess/vless/trojan/shadowsocks/hysteria but has no WireGuard case.4. Explicit exclusion in the Telegram bot
tgbot.goexplicitly excludesmodel.WireGuardfrom client-related functions alongsideTunnel,Mixed, andHTTP— all protocols that lack the client model.What would need to change
A minimal "per-peer traffic + expiry + toggle" implementation would require at minimum:
"peers"as the WireGuard equivalent of"clients"throughout the service layerClientTraffictable via a stable email/identifierThis is a meaningful chunk of work, but the clearest blocker is the Xray-core API gap — unlike VLESS/Trojan where toggling a client is a live gRPC call, WireGuard always needs a restart for any peer change.
Similar requests have been filed before (#3419, #4381). If you or anyone in the community is interested in implementing this, a PR would be very welcome — the roadmap above should help scope what needs to change. Happy to answer questions about the code if that helps.
@DIMFLIX commented on GitHub (Jun 6, 2026):
I understand the architectural challenges with WireGuard integration.
However, I'd like to propose a minimal viable solution (MVP) that doesn't require full integration into the Clients tab:
Proposed MVP approach:
Why this is still valuable:
I'm willing to help with testing and documentation if this MVP approach is acceptable.
@MHSanaei commented on GitHub (Jul 3, 2026):
Good news — this has been implemented. WireGuard is now a first-class multi-client protocol: peers are managed as regular clients on the Clients page, with per-client traffic stats, expiry dates, traffic limits, and enable/disable toggles, and peer changes are hot-applied to Xray without a manual restart.
Existing WireGuard inbounds are migrated automatically (legacy
peersentries become managed clients), and subscriptions emit per-client WireGuard configs.Please update to the latest release, and open a new issue if anything specific is still missing.