mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #5168] [Feature]: Peer Comments for WireGuard Inbounds #3632
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#3632
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 @Ssentiago on GitHub (Jun 10, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5168
Is your feature request related to a problem?
Summary
Add the ability to annotate WireGuard peers with human-readable comments directly in the 3x-ui panel.
Problem
When managing a WireGuard inbound with many peers, it's impossible to tell at a glance which peer belongs to which client or device. The only identifiers are the public key and allowed IP — neither of which is human-friendly. There's no way to label a peer as "Alice's laptop" or "office router" without keeping a separate external document.
Describe the solution you'd like
Since WireGuard peer config is passed directly to Xray and comments can't be stored inside the Xray JSON config, the panel itself should own this metadata.
Concretely: store a separate key-value map in the panel's own database, keyed by peer's allowed IP (or public key), with a comment string as the value.
Lifecycle rules:
UI
Alternatives you've considered
No response
Concrete use case
Concrete Use Case
a WireGuard inbound with ~40 peers across multiple devices and users
Mockups, screenshots, or examples
No response
Which parts of the panel would this affect?
Frontend (UI / panel pages)
Are you willing to help?
Before submitting
@github-actions[bot] commented on GitHub (Jun 10, 2026):
Thanks for the detailed request and for offering to implement it — this is a well-scoped feature.
Current state (confirmed in source)
In v3.3.0, a WireGuard peer object is a plain JSON blob stored inside
Inbound.Settingswith only these fields (internal/database/model/model.go,frontend/src/test/golden/fixtures/inbound-full/wireguard-server.json):There is no
comment,remark, or name field at the peer level. The per-inboundRemarkfield on theInboundstruct exists, but only labels the inbound as a whole. Two related issues (#3285, #4381) were previously filed and closed as completed, but this specific sub-feature was not included.Key implementation constraint
The entire
settingsJSON string is passed verbatim to the Xray API as ajson_util.RawMessage(internal/xray/inbound.go:15). Adding acommentkey inside each peer object would send that field directly to Xray-core, which may reject unknown fields or behave unexpectedly. Your instinct to keep comments outside the Xray config is correct.Recommended storage approach
Add a
peerCommentsmap at the top level of the settings JSON, sibling to thepeersarray (not nested inside each peer):Using
publicKeyas the map key is more reliable thanallowedIPssince keys are stable identifiers that don't change when the IP is reassigned. ThepeerCommentskey must then be stripped out in the Xray config-building path before the settings are handed off to Xray-core.Touch points for the PR
internal/database/model/model.go— add a helper or document thepeerCommentsconvention if a typed struct is introducedpeerCommentsfrom the settings before dispatching to Xray (look at howinternal/xray/inbound.goandinternal/web/service/build the config)frontend/src/lib/xray/) — add acommentfield to the peer form adapter and the peer add/edit dialog; render it as a secondary label in the peers listpublicKeychanges, delete key on peer removal) — this will live in the frontend form adapter and/or the inbound serviceHappy to review a draft PR when it's ready.
@MHSanaei commented on GitHub (Jun 12, 2026):
Implemented in
d04cb109. Each WireGuard peer now has an optional Comment field in the inbound form — it''s echoed next to the peer number in the form, stored as panel-side metadata in the peer JSON (xray-core ignores it), and when set it''s appended to the generated share link / .conf remark (e.g. "wg-1 (Alice''s laptop)") so the device is identifiable in client apps as well. Will be in the next release.