[GH-ISSUE #6007] [Bug]: wireguard host problem #4161

Closed
opened 2026-10-31 20:37:36 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @vercel9500 on GitHub (Jul 16, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6007

Describe the bug

When we configure an inbound WireGuard interface on the host, it doesn't get applied correctly in the panel.

In the Clients section:

If the client imports the configuration using the subscription link, the subscription URL's domain is used as the WireGuard endpoint.
If the configuration is added manually, the panel's domain/address is used as the WireGuard endpoint instead.

This behavior is incorrect because the configured inbound WireGuard host/address is ignored in both cases.

Expected behavior

No response

Actual behavior

No response

Relevant logs


Screenshots

No response

3x-ui version

v3.5.0

Xray-core version

26.7.11

How did you install 3x-ui?

install.sh script

Operating system

ubuntu 24

Which parts of the panel are affected?

No response

Browser (only if it is a UI bug)

No response

Is the panel behind a reverse proxy or CDN?

No response

Before submitting

  • I searched existing issues and this bug has not been reported.
  • I am running the latest released version of 3x-ui (or have verified the bug still exists on it).
  • This bug report is written in English.
  • I have redacted any sensitive data (tokens, real domains, client UUIDs).
Originally created by @vercel9500 on GitHub (Jul 16, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6007 ### Describe the bug When we configure an inbound WireGuard interface on the host, it doesn't get applied correctly in the panel. In the Clients section: If the client imports the configuration using the subscription link, the subscription URL's domain is used as the WireGuard endpoint. If the configuration is added manually, the panel's domain/address is used as the WireGuard endpoint instead. This behavior is incorrect because the configured inbound WireGuard host/address is ignored in both cases. ### Expected behavior _No response_ ### Actual behavior _No response_ ### Relevant logs ```shell ``` ### Screenshots _No response_ ### 3x-ui version v3.5.0 ### Xray-core version 26.7.11 ### How did you install 3x-ui? install.sh script ### Operating system ubuntu 24 ### Which parts of the panel are affected? _No response_ ### Browser (only if it is a UI bug) _No response_ ### Is the panel behind a reverse proxy or CDN? _No response_ ### Before submitting - [x] I searched [existing issues](../issues?q=is%3Aissue) and this bug has not been reported. - [x] I am running the latest released version of 3x-ui (or have verified the bug still exists on it). - [x] This bug report is written in English. - [x] I have redacted any sensitive data (tokens, real domains, client UUIDs).
bsakaguchi 2026-10-31 20:37:36 +07:00
Author
Owner

@github-actions[bot] commented on GitHub (Jul 16, 2026):

There is no separate "WireGuard host" field per inbound. Confirmed in frontend/src/schemas/protocols/inbound/wireguard.ts: WireguardInboundSettingsSchema only has mtu, secretKey, dns, peers, clients, noKernelTun, domainStrategy — no host/endpoint field. The endpoint written into client configs comes from the inbound's general Share address strategy, the same mechanism used for VLESS/VMess/Trojan/etc. share links.

The endpoint host is resolved with this priority (confirmed in internal/sub/service.go resolveInboundAddress, mirrored on the panel side in frontend/src/lib/xray/inbound-link.ts resolveShareHost):

  1. the address of the node the inbound is deployed to (multi-node only),
  2. the inbound's own Address field (the listen column) — only if it holds a real, routable host (not blank, not 0.0.0.0, not loopback, not a unix-socket path),
  3. Custom share address — only when Share address strategy is set to Custom,
  4. a last-resort fallback that differs by surface: the subscription server uses the domain the client requested the subscription on (PrepareForRequest / s.address in internal/sub/service.go), while the panel's own Clients/QR pages (frontend/src/pages/clients/wireguardConfig.ts, frontend/src/pages/inbounds/qr/QrCodeModal.tsx) use the browser's current hostname (or the configured Sub/Web domain if reached via localhost).

That matches exactly what's described: with Share address strategy left on its default (Node address) and no routable value in Address, both flows fall through to step 4 and pick the two different fallback hosts — the sub domain for subscription imports, the panel's own host for manual/QR — instead of a WireGuard-specific host.

Fix: open the inbound (Edit), Basics tab, set Share address strategy to Custom, and put the real host/IP in Custom share address (no scheme or port). I traced both consumers — internal/sub/service.go (genWireguardLink) and the panel side (frontend/src/pages/clients/wireguardConfig.ts / QrCodeModal.tsx, both via resolveShareHost) — and they read the same shareAddr / shareAddrStrategy columns, so a value set there is honored identically by both. If the WireGuard inbound genuinely listens on a specific public IP/domain in Address, Inbound listen works instead.

I did not find a code path where a correctly-set Custom or Inbound listen strategy gets overridden for WireGuard specifically, so before this can be confirmed as a defect rather than a configuration/discoverability gap, it would help to have:

  1. The exact value currently in the inbound's Address field, and which Share address strategy is selected (screenshot or the inbound's exported JSON).
  2. Whether this WireGuard inbound is deployed to a remote node, or runs on the local panel.
  3. A redacted sample: the Endpoint = value actually produced vs. the host expected.

@MHSanaei for visibility regardless: Share address strategy lives in the generic Basics tab, not the WireGuard-specific settings, so it doesn't read as "the WireGuard endpoint setting" — even if no code defect turns up here, this may be worth a UI hint or docs note scoped to WireGuard inbounds.

This reply was generated automatically; a maintainer may follow up.

<!-- gh-comment-id:4996503408 --> @github-actions[bot] commented on GitHub (Jul 16, 2026): There is no separate "WireGuard host" field per inbound. Confirmed in `frontend/src/schemas/protocols/inbound/wireguard.ts`: `WireguardInboundSettingsSchema` only has `mtu`, `secretKey`, `dns`, `peers`, `clients`, `noKernelTun`, `domainStrategy` — no `host`/`endpoint` field. The endpoint written into client configs comes from the inbound's general **Share address strategy**, the same mechanism used for VLESS/VMess/Trojan/etc. share links. The endpoint host is resolved with this priority (confirmed in `internal/sub/service.go` `resolveInboundAddress`, mirrored on the panel side in `frontend/src/lib/xray/inbound-link.ts` `resolveShareHost`): 1. the address of the node the inbound is deployed to (multi-node only), 2. the inbound's own **Address** field (the `listen` column) — only if it holds a real, routable host (not blank, not `0.0.0.0`, not loopback, not a unix-socket path), 3. **Custom share address** — only when **Share address strategy** is set to `Custom`, 4. a last-resort fallback that differs by surface: the subscription server uses the domain the client requested the subscription on (`PrepareForRequest` / `s.address` in `internal/sub/service.go`), while the panel's own Clients/QR pages (`frontend/src/pages/clients/wireguardConfig.ts`, `frontend/src/pages/inbounds/qr/QrCodeModal.tsx`) use the browser's current hostname (or the configured Sub/Web domain if reached via `localhost`). That matches exactly what's described: with **Share address strategy** left on its default (`Node address`) and no routable value in **Address**, both flows fall through to step 4 and pick the two different fallback hosts — the sub domain for subscription imports, the panel's own host for manual/QR — instead of a WireGuard-specific host. Fix: open the inbound (Edit), Basics tab, set **Share address strategy** to `Custom`, and put the real host/IP in **Custom share address** (no scheme or port). I traced both consumers — `internal/sub/service.go` (`genWireguardLink`) and the panel side (`frontend/src/pages/clients/wireguardConfig.ts` / `QrCodeModal.tsx`, both via `resolveShareHost`) — and they read the same `shareAddr` / `shareAddrStrategy` columns, so a value set there is honored identically by both. If the WireGuard inbound genuinely listens on a specific public IP/domain in **Address**, `Inbound listen` works instead. I did not find a code path where a correctly-set `Custom` or `Inbound listen` strategy gets overridden for WireGuard specifically, so before this can be confirmed as a defect rather than a configuration/discoverability gap, it would help to have: 1. The exact value currently in the inbound's **Address** field, and which **Share address strategy** is selected (screenshot or the inbound's exported JSON). 2. Whether this WireGuard inbound is deployed to a remote node, or runs on the local panel. 3. A redacted sample: the `Endpoint =` value actually produced vs. the host expected. @MHSanaei for visibility regardless: **Share address strategy** lives in the generic Basics tab, not the WireGuard-specific settings, so it doesn't read as "the WireGuard endpoint setting" — even if no code defect turns up here, this may be worth a UI hint or docs note scoped to WireGuard inbounds. *This reply was generated automatically; a maintainer may follow up.*
Author
Owner

@MHSanaei commented on GitHub (Jul 23, 2026):

The WireGuard endpoint is configurable via the inbound's Share Address Strategy (set it to Custom or Listen); the default 'node' strategy intentionally uses the subscription/panel host. Closing.

<!-- gh-comment-id:5059131043 --> @MHSanaei commented on GitHub (Jul 23, 2026): The WireGuard endpoint is configurable via the inbound's Share Address Strategy (set it to Custom or Listen); the default 'node' strategy intentionally uses the subscription/panel host. Closing.
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#4161
No description provided.