mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 19:11:53 +07:00
[PR #5466] [CLOSED] feat(wireguard): manage WireGuard peers as clients on the Clients tab #5888
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#5888
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?
📋 Pull Request Information
Original PR: https://github.com/MHSanaei/3x-ui/pull/5466
Author: @mrAntonD
Created: 6/21/2026
Status: ❌ Closed
Base:
main← Head:feat/wireguard-clients📝 Commits (10+)
1e9290ffeat(wireguard): manage WG peers as clients on the Clients page67ed0c8fix(wg): fix peer data loss, delete error, QR/info for WireGuard clients053200efeat(wg): show config text and download button in QR modalf7c09e4fix(wg): next IP suggestion, QR public key, and malformed JSON on add236e49cfix(wg): toggle enable/disable and show config in QR modal9231c00feat(wg): download config in info/edit modals, preserve wgPeer on hydratefe18197feat(wg): hide subscription/links blocks for WireGuard clients13ff78aperf(wg): patch peers[] in-place instead of full DB rebuild on add/update/delf4317c9fix(ci): register WgPeerSettings in codegen and document WG client endpoints962b9a3fix(ci): regenerate openapi.json after adding WG client endpoint docs📊 Changes
33 files changed (+1978 additions, -504 deletions)
View changed files
📝
frontend/public/openapi.json(+233 -2)📝
frontend/src/generated/examples.ts(+12 -2)📝
frontend/src/generated/schemas.ts(+39 -1)📝
frontend/src/generated/types.ts(+9 -0)📝
frontend/src/generated/zod.ts(+10 -0)📝
frontend/src/hooks/useClients.ts(+3 -0)📝
frontend/src/pages/api-docs/endpoints.ts(+31 -0)📝
frontend/src/pages/clients/ClientFormModal.tsx(+316 -116)📝
frontend/src/pages/clients/ClientInfoModal.css(+8 -0)📝
frontend/src/pages/clients/ClientInfoModal.tsx(+223 -96)📝
frontend/src/pages/clients/ClientQrModal.tsx(+113 -13)📝
frontend/src/pages/clients/ClientsPage.tsx(+54 -2)📝
frontend/src/pages/inbounds/form/InboundFormModal.tsx(+1 -7)📝
frontend/src/pages/inbounds/form/protocols/wireguard.tsx(+3 -123)📝
frontend/src/pages/inbounds/info/InboundInfoModal.tsx(+18 -86)📝
frontend/src/pages/inbounds/qr/QrCodeModal.tsx(+3 -2)📝
frontend/src/pages/inbounds/useInbounds.ts(+15 -2)📝
frontend/src/schemas/client.ts(+10 -0)📝
internal/database/model/model.go(+47 -22)📝
internal/web/controller/inbound.go(+92 -0)...and 13 more files
📄 Description
Why
WireGuard peers were second-class citizens — managed only inside the Inbounds form alongside transport settings. This meant no per-peer traffic limits, no expiry, no sub IDs, and no per-client QR/config download. Moving peers to the Clients tab gives WireGuard the same UX as any other protocol while keeping the Inbounds form clean.
Screenshot
Summary
settings.peers[]are migrated to theclientstable on first startup — no data lossReconcileWgPeersruns on each panel start, so peers added directly tosettings.peers[]always appear in the Clients taballowedIPsin the client form auto-assigns the first available IP instead; existing clients are not affected when editingKey changes
Backend
model.go—WgPeerSettingsstruct +wg_settingscolumn onClientRecord;MarshalJSON/UnmarshalJSONexpose it aswgPeerin API responsesclient_wg_apply.go—AddWgClient,UpdateWgClient,DelWgClient: full CRUD; each mutation patchessettings.peers[]in-place (no full DB rebuild)client_wg_peers.go—syncWgPeersFromClients,wgPeerToRecord,SyncWgInboundinbound_migration.go—ReconcileWgPeerscalled on every panel start to keepsettings.peers[]andclientstable in syncinbound.go—UpdateInboundpreservessettings.peers[]when the form omits them;inboundWgPublicKeyderives server public key fromsecretKeyvia curve25519;GetInboundOptionsexposeswgPublicKeyclient_crud.go—Delete()routes WG inbounds throughDelWgClientclient_paging.go—ClientSlimincludeswgPeerso next-IP suggestion works from the paged listinbound.gocontroller — WG CRUD endpoints under/panel/api/inbounds/:id/Frontend
ClientFormModal— WG fields (public/private key, PSK, allowed IPs, keepalive) when WG inbound selected; irrelevant fields hidden; auto-suggests next sequential IP; auto-resolves duplicateallowedIPson blur (create only — edit mode skips unchanged values)ClientQrModal— generates WireGuard.conf([Interface]+[Peer]); supports.confdownloadClientInfoModal— WG-specific fields shown; subscription/links blocks hidden for WG clientsuseInbounds— WireGuard added toTRACKED_PROTOCOLS; peer count read fromsettings.peersTest plan
.confwith correct keys and endpointsettings.peers[]appear in Clients tab🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.