[PR #5679] [MERGED] fix(panel): use the hosting node address for WireGuard client configs #5957

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

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/5679
Author: @STRENCH0
Created: 6/30/2026
Status: ✅ Merged
Merged: 7/2/2026
Merged by: @MHSanaei

Base: main ← Head: fix/wireguard-ui-node-endpoint


📝 Commits (5)

  • a271f83 fix(panel): use the hosting node address for WireGuard client configs
  • 568a7c4 Merge branch 'main' into fix/wireguard-ui-node-endpoint
  • bd57a1a Merge branch 'main' into fix/wireguard-ui-node-endpoint
  • 930a174 Merge branch 'main' into fix/wireguard-ui-node-endpoint
  • fc00551 fix(frontend): keep a raw fallback host and refresh node-fed inbound options

📊 Changes

12 files changed (+265 additions, -44 deletions)

View changed files

📝 frontend/public/openapi.json (+17 -0)
📝 frontend/src/api/queries/useNodeMutations.ts (+4 -1)
📝 frontend/src/generated/examples.ts (+4 -0)
📝 frontend/src/generated/schemas.ts (+13 -0)
📝 frontend/src/generated/types.ts (+4 -0)
📝 frontend/src/generated/zod.ts (+4 -0)
📝 frontend/src/lib/xray/inbound-link.ts (+39 -19)
📝 frontend/src/pages/clients/wireguardConfig.ts (+2 -2)
📝 frontend/src/schemas/client.ts (+7 -0)
📝 frontend/src/test/wireguard-client-config.test.ts (+37 -0)
📝 internal/web/service/inbound.go (+45 -22)
➕ internal/web/service/inbound_options_node_address_test.go (+89 -0)

📄 Description

The clients page rendered a node-managed WireGuard inbound's config with the master panel's host in Endpoint instead of the hosting node's address, so the copied/QR config pointed at the wrong server. The subscription path already resolves this via resolveInboundAddress; the UI generator did not.

Expose the share-host resolution inputs (node address, listen, share-address strategy/address) on InboundOption and route buildWireguardClientConfig through the same canonical resolver the inbounds-page share links use, extracted as resolveShareHost. This also brings local inbounds with a shareable listen or a listen/custom share strategy into parity with the subscription Endpoint; the common listen=0.0.0.0 case still falls back to the panel host.

Summary

Fix the clients page rendering a node-managed WireGuard config whose Endpoint
pointed at the master panel instead of the hosting node. The WireGuard config
generator now resolves the endpoint host through the same canonical resolver the
inbounds-page share links and the subscription path already use.

Why

For a node-managed (sub-node) WireGuard inbound, the clients page built the
client config (copy/QR) with the master panel's host in Endpoint, so the
config pointed at the wrong server and couldn't connect. The subscription path
already resolves the correct host via resolveInboundAddress; the UI generator
(buildWireguardClientConfig) bypassed it and used window.location.hostname.

The fix exposes the share-host resolution inputs (hosting node address, listen,
share-address strategy/address) on InboundOption and routes
buildWireguardClientConfig through resolveShareHost, extracted from the
existing resolveAddr so the clients page, the inbounds-page share links, and
the backend resolveInboundAddress all agree on the endpoint host.

Type of change

  • Bug fix
  • New feature
  • Refactoring (no behavior change)
  • Documentation
  • Tests only
  • Build / CI / tooling
  • Other

Areas affected

  • Frontend (UI / panel pages)
  • Backend (API endpoints, login, settings)
  • Xray config generation
  • Subscription (share links / Clash / JSON)
  • Statistics / traffic counters
  • Database / migrations
  • Install / upgrade script
  • Docker image
  • Multi-node (sub-nodes)
  • Telegram bot

How was this tested?

Repro: create a WireGuard inbound on a sub-node, add a client, open the clients
page on the master, and copy the WireGuard config — before this change
Endpoint showed the master's host; after it shows the node's address.

Automated tests added:

  • Backend internal/web/service/inbound_options_node_address_test.go
    (TestGetInboundOptions_NodeAddress): asserts a node-managed inbound carries
    its node's NodeAddress, the node strategy default, and Listen /
    ShareAddr passthrough; a local inbound reports an empty NodeAddress.
  • Frontend frontend/src/test/wireguard-client-config.test.ts: asserts the
    endpoint host for node / blank-fallback / custom / listen strategies.

Gate: make verify passes (gen-check, Go + frontend lint, typecheck, Go + 638
frontend tests, build); go build ./... and golangci-lint run clean.

Screenshots / recordings

N/A — the affected output is the copied/QR WireGuard config text, not a visual
layout change.

Breaking changes

None. Note: local (non-node) inbounds that have a shareable listen address or
a listen/custom share-address strategy now honor those in the clients-page
WireGuard Endpoint, matching the subscription and inbounds-page share links.
The common listen=0.0.0.0 case is unchanged (still falls back to the panel
host).

Checklist

  • I tested the change locally and confirmed the described behavior.
  • I added or updated tests for the new behavior (when applicable).
  • go build ./... and the test suite pass locally.
  • For frontend changes: npm run lint, npm run typecheck, and npm run build pass.
  • I updated the Wiki / README / API docs if user-facing behavior changed.
  • My commits follow the project's existing message style.
  • I have no unrelated changes mixed into this PR.

🔄 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/5679 **Author:** [@STRENCH0](https://github.com/STRENCH0) **Created:** 6/30/2026 **Status:** ✅ Merged **Merged:** 7/2/2026 **Merged by:** [@MHSanaei](https://github.com/MHSanaei) **Base:** `main` ← **Head:** `fix/wireguard-ui-node-endpoint` --- ### 📝 Commits (5) - [`a271f83`](https://github.com/MHSanaei/3x-ui/commit/a271f83bcdc26c2f8277b22036431cde7f992add) fix(panel): use the hosting node address for WireGuard client configs - [`568a7c4`](https://github.com/MHSanaei/3x-ui/commit/568a7c461470b1319205578d98af08f8f59bacbe) Merge branch 'main' into fix/wireguard-ui-node-endpoint - [`bd57a1a`](https://github.com/MHSanaei/3x-ui/commit/bd57a1ad3ee688853592326e0f9ae3679fa9ed4d) Merge branch 'main' into fix/wireguard-ui-node-endpoint - [`930a174`](https://github.com/MHSanaei/3x-ui/commit/930a17431f0f5d43dee3db23e543f056ce0b4272) Merge branch 'main' into fix/wireguard-ui-node-endpoint - [`fc00551`](https://github.com/MHSanaei/3x-ui/commit/fc0055170fbe14ae36cabe8dc771a5cec7f76c08) fix(frontend): keep a raw fallback host and refresh node-fed inbound options ### 📊 Changes **12 files changed** (+265 additions, -44 deletions) <details> <summary>View changed files</summary> 📝 `frontend/public/openapi.json` (+17 -0) 📝 `frontend/src/api/queries/useNodeMutations.ts` (+4 -1) 📝 `frontend/src/generated/examples.ts` (+4 -0) 📝 `frontend/src/generated/schemas.ts` (+13 -0) 📝 `frontend/src/generated/types.ts` (+4 -0) 📝 `frontend/src/generated/zod.ts` (+4 -0) 📝 `frontend/src/lib/xray/inbound-link.ts` (+39 -19) 📝 `frontend/src/pages/clients/wireguardConfig.ts` (+2 -2) 📝 `frontend/src/schemas/client.ts` (+7 -0) 📝 `frontend/src/test/wireguard-client-config.test.ts` (+37 -0) 📝 `internal/web/service/inbound.go` (+45 -22) ➕ `internal/web/service/inbound_options_node_address_test.go` (+89 -0) </details> ### 📄 Description The clients page rendered a node-managed WireGuard inbound's config with the master panel's host in Endpoint instead of the hosting node's address, so the copied/QR config pointed at the wrong server. The subscription path already resolves this via resolveInboundAddress; the UI generator did not. Expose the share-host resolution inputs (node address, listen, share-address strategy/address) on InboundOption and route buildWireguardClientConfig through the same canonical resolver the inbounds-page share links use, extracted as resolveShareHost. This also brings local inbounds with a shareable listen or a listen/custom share strategy into parity with the subscription Endpoint; the common listen=0.0.0.0 case still falls back to the panel host. ## Summary Fix the clients page rendering a node-managed WireGuard config whose `Endpoint` pointed at the master panel instead of the hosting node. The WireGuard config generator now resolves the endpoint host through the same canonical resolver the inbounds-page share links and the subscription path already use. ## Why For a node-managed (sub-node) WireGuard inbound, the clients page built the client config (copy/QR) with the master panel's host in `Endpoint`, so the config pointed at the wrong server and couldn't connect. The subscription path already resolves the correct host via `resolveInboundAddress`; the UI generator (`buildWireguardClientConfig`) bypassed it and used `window.location.hostname`. The fix exposes the share-host resolution inputs (hosting node address, listen, share-address strategy/address) on `InboundOption` and routes `buildWireguardClientConfig` through `resolveShareHost`, extracted from the existing `resolveAddr` so the clients page, the inbounds-page share links, and the backend `resolveInboundAddress` all agree on the endpoint host. ## Type of change - [x] Bug fix - [ ] New feature - [ ] Refactoring (no behavior change) - [ ] Documentation - [ ] Tests only - [ ] Build / CI / tooling - [ ] Other ## Areas affected - [x] Frontend (UI / panel pages) - [x] Backend (API endpoints, login, settings) - [ ] Xray config generation - [ ] Subscription (share links / Clash / JSON) - [ ] Statistics / traffic counters - [ ] Database / migrations - [ ] Install / upgrade script - [ ] Docker image - [x] Multi-node (sub-nodes) - [ ] Telegram bot ## How was this tested? Repro: create a WireGuard inbound on a sub-node, add a client, open the clients page on the master, and copy the WireGuard config — before this change `Endpoint` showed the master's host; after it shows the node's address. Automated tests added: - Backend `internal/web/service/inbound_options_node_address_test.go` (`TestGetInboundOptions_NodeAddress`): asserts a node-managed inbound carries its node's `NodeAddress`, the `node` strategy default, and `Listen` / `ShareAddr` passthrough; a local inbound reports an empty `NodeAddress`. - Frontend `frontend/src/test/wireguard-client-config.test.ts`: asserts the endpoint host for node / blank-fallback / `custom` / `listen` strategies. Gate: `make verify` passes (gen-check, Go + frontend lint, typecheck, Go + 638 frontend tests, build); `go build ./...` and `golangci-lint run` clean. ## Screenshots / recordings N/A — the affected output is the copied/QR WireGuard config text, not a visual layout change. ## Breaking changes None. Note: local (non-node) inbounds that have a shareable `listen` address or a `listen`/`custom` share-address strategy now honor those in the clients-page WireGuard `Endpoint`, matching the subscription and inbounds-page share links. The common `listen=0.0.0.0` case is unchanged (still falls back to the panel host). ## Checklist - [x] I tested the change locally and confirmed the described behavior. - [x] I added or updated tests for the new behavior (when applicable). - [x] `go build ./...` and the test suite pass locally. - [x] For frontend changes: `npm run lint`, `npm run typecheck`, and `npm run build` pass. - [ ] I updated the Wiki / README / API docs if user-facing behavior changed. - [x] My commits follow the project's existing message style. - [x] I have no unrelated changes mixed into this PR. --- <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:18 +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#5957
No description provided.