mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 19:11:53 +07:00
[PR #5679] [MERGED] fix(panel): use the hosting node address for WireGuard client configs #5957
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#5957
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/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)
a271f83fix(panel): use the hosting node address for WireGuard client configs568a7c4Merge branch 'main' into fix/wireguard-ui-node-endpointbd57a1aMerge branch 'main' into fix/wireguard-ui-node-endpoint930a174Merge branch 'main' into fix/wireguard-ui-node-endpointfc00551fix(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
Endpointpointed 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 theconfig 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 usedwindow.location.hostname.The fix exposes the share-host resolution inputs (hosting node address, listen,
share-address strategy/address) on
InboundOptionand routesbuildWireguardClientConfigthroughresolveShareHost, extracted from theexisting
resolveAddrso the clients page, the inbounds-page share links, andthe backend
resolveInboundAddressall agree on the endpoint host.Type of change
Areas affected
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
Endpointshowed the master's host; after it shows the node's address.Automated tests added:
internal/web/service/inbound_options_node_address_test.go(
TestGetInboundOptions_NodeAddress): asserts a node-managed inbound carriesits node's
NodeAddress, thenodestrategy default, andListen/ShareAddrpassthrough; a local inbound reports an emptyNodeAddress.frontend/src/test/wireguard-client-config.test.ts: asserts theendpoint host for node / blank-fallback /
custom/listenstrategies.Gate:
make verifypasses (gen-check, Go + frontend lint, typecheck, Go + 638frontend tests, build);
go build ./...andgolangci-lint runclean.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
listenaddress ora
listen/customshare-address strategy now honor those in the clients-pageWireGuard
Endpoint, matching the subscription and inbounds-page share links.The common
listen=0.0.0.0case is unchanged (still falls back to the panelhost).
Checklist
go build ./...and the test suite pass locally.npm run lint,npm run typecheck, andnpm run buildpass.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.