[GH-ISSUE #5002] [Feature]: Unified Client Management & Traffic Stats for WireGuard Peers #3521

Closed
opened 2026-10-31 20:33:02 +07:00 by bsakaguchi · 3 comments
Owner

Originally created by @DIMFLIX on GitHub (Jun 6, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5002

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:

  • See real-time traffic usage per peer.
  • Set expiration dates (expire dates) for specific peers.
  • Quickly enable/disable a specific peer without opening and saving the entire inbound configuration.
  • When you have more than 5-10 users, navigating inside the inbound settings becomes a nightmare.

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:

  • Many users are switching to competing dashboards simply because they handle WG clients better.
  • Others are forced to deploy separate, specialized WireGuard panels (such as wg-easy or WireGuard-UI) alongside 3x-ui.

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?

  • I'd like to implement this feature myself and open a PR.
  • I can help test once a PR is open.

Before submitting

  • I searched existing issues and this feature has not been requested.
  • This feature request is written in English.
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: - See real-time traffic usage per peer. - Set expiration dates (expire dates) for specific peers. - Quickly enable/disable a specific peer without opening and saving the entire inbound configuration. - When you have more than 5-10 users, navigating inside the inbound settings becomes a nightmare. 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: - Many users are switching to competing dashboards simply because they handle WG clients better. - Others are forced to deploy separate, specialized WireGuard panels (such as wg-easy or WireGuard-UI) alongside 3x-ui. ### 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? - [ ] I'd like to implement this feature myself and open a PR. - [x] I can help test once a PR is open. ### Before submitting - [x] I searched [existing issues](../issues?q=is%3Aissue) and this feature has not been requested. - [x] This feature request is written in English.
bsakaguchi 2026-10-31 20:33:02 +07:00
Author
Owner

@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() in web/service/inbound.go reads settings["clients"] from the inbound JSON. WireGuard inbounds use settings["peers"] (matching the Xray-core WireGuard schema). So WireGuard peers are invisible to every part of the pipeline that calls GetClients() — traffic stats sync, enable/disable, expiry jobs, the Telegram bot, etc.

2. No hot-add/remove via Xray API
AddUser() in xray/api.go handles vmess, vless, trojan, shadowsocks, and hysteria — all of which support Xray-core's AlterInbound gRPC operation for live user changes. The WireGuard case hits default: 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 of AddUserOperation for WireGuard peers.

3. Identity model is fundamentally different
model.Client carries ID (UUID), Password, Auth, Flow, SubID, etc. WireGuard peers are identified by a public key and an allowedIPs list — none of which map to the existing client fields. fillProtocolDefaults() in client.go auto-generates credentials for vmess/vless/trojan/shadowsocks/hysteria but has no WireGuard case.

4. Explicit exclusion in the Telegram bot
tgbot.go explicitly excludes model.WireGuard from client-related functions alongside Tunnel, Mixed, and HTTP — all protocols that lack the client model.


What would need to change

A minimal "per-peer traffic + expiry + toggle" implementation would require at minimum:

  • Recognising "peers" as the WireGuard equivalent of "clients" throughout the service layer
  • A WireGuard-specific peer model (publicKey + allowedIPs as first-class fields) that maps into the ClientTraffic table via a stable email/identifier
  • Accepting that any peer mutation requires an Xray restart (the Xray gRPC API limitation cannot be worked around at the 3x-ui layer)
  • Frontend changes to surface per-peer rows with traffic/expiry/toggle controls

This 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.

<!-- gh-comment-id:4638045887 --> @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()` in `web/service/inbound.go` reads `settings["clients"]` from the inbound JSON. WireGuard inbounds use `settings["peers"]` (matching the Xray-core WireGuard schema). So WireGuard peers are invisible to every part of the pipeline that calls `GetClients()` — traffic stats sync, enable/disable, expiry jobs, the Telegram bot, etc. **2. No hot-add/remove via Xray API** `AddUser()` in `xray/api.go` handles vmess, vless, trojan, shadowsocks, and hysteria — all of which support Xray-core's `AlterInbound` gRPC operation for live user changes. The WireGuard case hits `default: 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 of `AddUserOperation` for WireGuard peers. **3. Identity model is fundamentally different** `model.Client` carries `ID` (UUID), `Password`, `Auth`, `Flow`, `SubID`, etc. WireGuard peers are identified by a **public key** and an `allowedIPs` list — none of which map to the existing client fields. `fillProtocolDefaults()` in `client.go` auto-generates credentials for vmess/vless/trojan/shadowsocks/hysteria but has no WireGuard case. **4. Explicit exclusion in the Telegram bot** `tgbot.go` explicitly excludes `model.WireGuard` from client-related functions alongside `Tunnel`, `Mixed`, and `HTTP` — all protocols that lack the client model. --- ## What would need to change A minimal "per-peer traffic + expiry + toggle" implementation would require at minimum: - Recognising `"peers"` as the WireGuard equivalent of `"clients"` throughout the service layer - A WireGuard-specific peer model (publicKey + allowedIPs as first-class fields) that maps into the `ClientTraffic` table via a stable email/identifier - Accepting that any peer mutation requires an Xray restart (the Xray gRPC API limitation cannot be worked around at the 3x-ui layer) - Frontend changes to surface per-peer rows with traffic/expiry/toggle controls This 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.
Author
Owner

@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:

  • Separate "WireGuard Clients" page (not merged with VLESS/VMess clients)
  • Basic operations with Xray restart:
    • Add/Edit/Delete peers (with confirmation that it triggers restart)
    • Enable/Disable toggle for each peer
    • Show peer traffic stats (if Xray-core can provide them)
    • Expiration date support - simple timestamp check in the UI

Why this is still valuable:

  • Users won't need to open the full inbound config just to disable one peer
  • Basic traffic monitoring becomes possible
  • The "restart required" limitation is acceptable for most use cases (unlike VLESS where hot-reload is critical)

I'm willing to help with testing and documentation if this MVP approach is acceptable.

<!-- gh-comment-id:4638077041 --> @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: - Separate "WireGuard Clients" page (not merged with VLESS/VMess clients) - Basic operations with Xray restart: - Add/Edit/Delete peers (with confirmation that it triggers restart) - Enable/Disable toggle for each peer - Show peer traffic stats (if Xray-core can provide them) - Expiration date support - simple timestamp check in the UI Why this is still valuable: - Users won't need to open the full inbound config just to disable one peer - Basic traffic monitoring becomes possible - The "restart required" limitation is acceptable for most use cases (unlike VLESS where hot-reload is critical) I'm willing to help with testing and documentation if this MVP approach is acceptable.
Author
Owner

@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 peers entries 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.

<!-- gh-comment-id:4873800098 --> @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 `peers` entries 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.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#3521
No description provided.