[PR #5623] [CLOSED] feat(wireguard): support Xray dynamic peer runtime #5932

Closed
opened 2026-11-02 04:05:08 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/5623
Author: @mrAntonD
Created: 6/27/2026
Status: ❌ Closed

Base: main ← Head: feat/wireguard-clients


📝 Commits (10+)

  • 1e9290f feat(wireguard): manage WG peers as clients on the Clients page
  • 67ed0c8 fix(wg): fix peer data loss, delete error, QR/info for WireGuard clients
  • 053200e feat(wg): show config text and download button in QR modal
  • f7c09e4 fix(wg): next IP suggestion, QR public key, and malformed JSON on add
  • 236e49c fix(wg): toggle enable/disable and show config in QR modal
  • 9231c00 feat(wg): download config in info/edit modals, preserve wgPeer on hydrate
  • fe18197 feat(wg): hide subscription/links blocks for WireGuard clients
  • 13ff78a perf(wg): patch peers[] in-place instead of full DB rebuild on add/update/del
  • f4317c9 fix(ci): register WgPeerSettings in codegen and document WG client endpoints
  • 962b9a3 fix(ci): regenerate openapi.json after adding WG client endpoint docs

📊 Changes

41 files changed (+2499 additions, -523 deletions)

View changed files

📝 frontend/public/openapi.json (+236 -2)
📝 frontend/src/generated/examples.ts (+13 -2)
📝 frontend/src/generated/schemas.ts (+43 -1)
📝 frontend/src/generated/types.ts (+10 -0)
📝 frontend/src/generated/zod.ts (+11 -0)
📝 frontend/src/hooks/useClients.ts (+3 -0)
📝 frontend/src/lib/xray/inbound-defaults.ts (+9 -9)
📝 frontend/src/pages/api-docs/endpoints.ts (+30 -0)
📝 frontend/src/pages/clients/ClientFormModal.tsx (+356 -122)
📝 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)
📝 go.mod (+1 -1)

...and 21 more files

📄 Description

Summary

This updates WireGuard client handling to align with Xray-core dynamic peer management introduced in Xray-core v26.6.27.

Related context:

What Changed

  • Update the xray-core dependency to the commit that includes WireGuard dynamic peer management.
  • Add WireGuard support to runtime AddUser by building a WireGuard peer account from publicKey, allowedIPs, preSharedKey, keepAlive, and email.
  • For local Xray runtime, WireGuard client add/update/delete now first tries dynamic AddUser/RemoveUser.
  • If dynamic runtime update fails, the code falls back to the existing full inbound update path.
  • Persist email on WireGuard peers while keeping comment for backward compatibility.
  • Keep old peer migration behavior: existing comment values still work.

Why

Xray-core v26.6.27 changed WireGuard server-mode peers into users internally and added dynamic peer management. This PR keeps the existing 3x-ui WireGuard client model, while allowing new Xray versions to apply peer changes without rebuilding the whole inbound.

Compatibility

  • Non-WireGuard protocols should not change behavior.
  • New Xray versions use dynamic peer operations where possible.
  • Older or unsupported runtimes fall back to the previous inbound update behavior.
  • Existing peer configs using comment remain supported.

Validation

Automated checks:

  • go test ./internal/...
  • go test ./...
  • git diff --check

Runtime smoke test:

  • Built frontend with Node 22: cd frontend && npm run build
  • Built panel binary: go build -o x-ui-build main.go
  • Deployed to a Linux amd64 systemd test deployment running Xray v26.6.27
  • Restarted x-ui successfully
  • Verified x-ui service is active
  • Verified Xray process starts successfully
  • Verified Xray reports version 26.6.27
  • Verified panel and subscription HTTP ports are listening
  • Verified no startup errors after restart

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/MHSanaei/3x-ui/pull/5623 **Author:** [@mrAntonD](https://github.com/mrAntonD) **Created:** 6/27/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `feat/wireguard-clients` --- ### 📝 Commits (10+) - [`1e9290f`](https://github.com/MHSanaei/3x-ui/commit/1e9290f864245246070acd5b5ef52c6e4ae6a01a) feat(wireguard): manage WG peers as clients on the Clients page - [`67ed0c8`](https://github.com/MHSanaei/3x-ui/commit/67ed0c842d35bb814401845116c5e8d1e8c36761) fix(wg): fix peer data loss, delete error, QR/info for WireGuard clients - [`053200e`](https://github.com/MHSanaei/3x-ui/commit/053200ed71f996c9a9ab3336819409a03e2da509) feat(wg): show config text and download button in QR modal - [`f7c09e4`](https://github.com/MHSanaei/3x-ui/commit/f7c09e4214bac8fa56eb7685acf8c5b9278f6b10) fix(wg): next IP suggestion, QR public key, and malformed JSON on add - [`236e49c`](https://github.com/MHSanaei/3x-ui/commit/236e49cf1ae4e6921b402cc74102b4b0b9e3e133) fix(wg): toggle enable/disable and show config in QR modal - [`9231c00`](https://github.com/MHSanaei/3x-ui/commit/9231c00062348abd066a9e36423f248381728e7f) feat(wg): download config in info/edit modals, preserve wgPeer on hydrate - [`fe18197`](https://github.com/MHSanaei/3x-ui/commit/fe18197d30bc0c05d243c080069cffa58c2679f4) feat(wg): hide subscription/links blocks for WireGuard clients - [`13ff78a`](https://github.com/MHSanaei/3x-ui/commit/13ff78a8a4c8025cf65a7f794cd9127a0b2d3b19) perf(wg): patch peers[] in-place instead of full DB rebuild on add/update/del - [`f4317c9`](https://github.com/MHSanaei/3x-ui/commit/f4317c997222512b9b5d8b0d7b5e9e99912cca0c) fix(ci): register WgPeerSettings in codegen and document WG client endpoints - [`962b9a3`](https://github.com/MHSanaei/3x-ui/commit/962b9a3bc1d0d08cc0c8b690e33b6e0a10a03b12) fix(ci): regenerate openapi.json after adding WG client endpoint docs ### 📊 Changes **41 files changed** (+2499 additions, -523 deletions) <details> <summary>View changed files</summary> 📝 `frontend/public/openapi.json` (+236 -2) 📝 `frontend/src/generated/examples.ts` (+13 -2) 📝 `frontend/src/generated/schemas.ts` (+43 -1) 📝 `frontend/src/generated/types.ts` (+10 -0) 📝 `frontend/src/generated/zod.ts` (+11 -0) 📝 `frontend/src/hooks/useClients.ts` (+3 -0) 📝 `frontend/src/lib/xray/inbound-defaults.ts` (+9 -9) 📝 `frontend/src/pages/api-docs/endpoints.ts` (+30 -0) 📝 `frontend/src/pages/clients/ClientFormModal.tsx` (+356 -122) 📝 `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) 📝 `go.mod` (+1 -1) _...and 21 more files_ </details> ### 📄 Description ## Summary This updates WireGuard client handling to align with Xray-core dynamic peer management introduced in Xray-core v26.6.27. Related context: - Previous PR: #5607 - Xray-core change: https://github.com/XTLS/Xray-core/commit/345c76f9a8ec438e24bbbc5a246bd0bfeab480b1 - Related PR: #5620 ## What Changed - Update the xray-core dependency to the commit that includes WireGuard dynamic peer management. - Add WireGuard support to runtime AddUser by building a WireGuard peer account from publicKey, allowedIPs, preSharedKey, keepAlive, and email. - For local Xray runtime, WireGuard client add/update/delete now first tries dynamic AddUser/RemoveUser. - If dynamic runtime update fails, the code falls back to the existing full inbound update path. - Persist email on WireGuard peers while keeping comment for backward compatibility. - Keep old peer migration behavior: existing comment values still work. ## Why Xray-core v26.6.27 changed WireGuard server-mode peers into users internally and added dynamic peer management. This PR keeps the existing 3x-ui WireGuard client model, while allowing new Xray versions to apply peer changes without rebuilding the whole inbound. ## Compatibility - Non-WireGuard protocols should not change behavior. - New Xray versions use dynamic peer operations where possible. - Older or unsupported runtimes fall back to the previous inbound update behavior. - Existing peer configs using comment remain supported. ## Validation Automated checks: - `go test ./internal/...` - `go test ./...` - `git diff --check` Runtime smoke test: - Built frontend with Node 22: `cd frontend && npm run build` - Built panel binary: `go build -o x-ui-build main.go` - Deployed to a Linux amd64 systemd test deployment running Xray `v26.6.27` - Restarted `x-ui` successfully - Verified `x-ui` service is active - Verified Xray process starts successfully - Verified Xray reports version `26.6.27` - Verified panel and subscription HTTP ports are listening - Verified no startup errors after restart --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 04:05:08 +07:00
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#5932
No description provided.