[GH-ISSUE #6681] [Bug]: #4464

Closed
opened 2026-10-31 20:39:50 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @Rockst4r4 on GitHub (Sep 29, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6681

Describe the bug

i added some hosts for wireguard inbound, but non of them apply on Wireguard config

How to reproduce the problem

1-created wireguard inbound
2-added some hosts as external proxy for endpoints
3-get wireguard config and non of hosts applied on that

Expected behavior

No response

Actual behavior

No response

Relevant logs


Screenshots

No response

3x-ui version

3.8.5

Xray-core version

26

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?

None

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 @Rockst4r4 on GitHub (Sep 29, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6681 ### Describe the bug i added some hosts for wireguard inbound, but non of them apply on Wireguard config ### How to reproduce the problem 1-created wireguard inbound 2-added some hosts as external proxy for endpoints 3-get wireguard config and non of hosts applied on that ### Expected behavior _No response_ ### Actual behavior _No response_ ### Relevant logs ```shell ``` ### Screenshots _No response_ ### 3x-ui version 3.8.5 ### Xray-core version 26 ### 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? None ### 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:39:50 +07:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@github-actions[bot] commented on GitHub (Sep 29, 2026):

This is a real bug, and it is still present on the default branch. The generators for the plain wireguard:// link and the WireGuard .conf text never read Hosts. They always use the inbound's own share address and port. Only the JSON and Clash subscription formats apply a Host's address and port to a WireGuard inbound.

Workaround until this is fixed: there is only one endpoint, so you can set it on the inbound itself. Edit the inbound → Basics → set Share address strategy to Custom and put the host in Custom share address. That address is what resolveInboundAddress (subscription) and resolveShareHost (panel) use. This gives you one endpoint and the inbound's own port. It cannot produce one config per Host. If you need a separate endpoint per Host, the JSON and Clash subscription formats already produce one per Host.

How the Host is lost. For the raw subscription and "Export all inbound links", getSubs / inboundLinks call linkFromHosts whenever the inbound has enabled Hosts (internal/sub/service.go:503-504, :576-577). That function places the Hosts into the stream's externalProxy and then calls GetLink (internal/sub/host_sub.go:237-239). Every other link generator iterates over externalProxy, but the WireGuard one ignores it:

// internal/sub/service.go:939  genWireguardLink
link := fmt.Sprintf("wireguard://%s@%s", encodeUserinfo(client.PrivateKey), joinHostPort(s.resolveInboundAddress(inbound), inbound.Port))

For contrast, TUIC loops over stream["externalProxy"] at internal/sub/service.go:888-914. AmneziaWG has the same gap: internal/sub/service.go:1087 passes s.resolveInboundAddress(inbound), inbound.Port.

The panel's own WireGuard config (Clients → QR / Info) never looks at Hosts at all. frontend/src/pages/clients/wireguardConfig.ts:32-38 builds Endpoint from resolveShareHost(...) and inbound?.port.

By contrast, the JSON and Clash paths overwrite inbound.Listen / Port per Host before they build the WireGuard outbound (internal/sub/json_service.go:616-619 → genWireguard "endpoint": joinHostPort(inbound.Listen, inbound.Port) at :1006; internal/sub/clash_service.go:365-368 → buildWireguardProxy "server": inbound.Listen at :626). The Hosts page also lists WireGuard inbounds (frontend/src/pages/hosts/HostList.tsx:41). So Hosts are clearly meant to apply to WireGuard, but only some output formats honour them.

I changed the title from [Bug]: to describe the problem.

Verdict:        Confirmed bug
Severity:       Medium
Confidence:     High
Root cause:     internal/sub/service.go:939 genWireguardLink (and :1087 genAmneziaWGLink) build
                the endpoint from resolveInboundAddress(inbound)/inbound.Port and never read the
                stream "externalProxy" that linkFromHosts (host_sub.go:237-239) injects, so every
                Host renders to the same unchanged link. The panel-side .conf builder
                frontend/src/pages/clients/wireguardConfig.ts:32-38 has no Host input at all.
                Triggered for any wireguard/amneziawg inbound with >=1 enabled Host, in raw
                subscriptions, "Export all inbound links", and the client QR/Info configs.
                Hosts were introduced in 709b332d "feat(hosts): managed Hosts for per-host
                subscription link overrides (#5409)"; the WG raw generator was never wired in.
Already fixed:  Still present on the default branch (823db059, after v3.8.5).
Duplicate of:   Related: #6007 (WireGuard endpoint host, but about Share address strategy, not Hosts)
Evidence:       service.go:503-504, :576-577 (host path taken); host_sub.go:237-239 (externalProxy
                injected, GetLink called); service.go:939 and :1087 (externalProxy ignored);
                service.go:888-914 (TUIC honours it); json_service.go:616-619 + :1006 and
                clash_service.go:365-368 + :626 (JSON/Clash honour Host dest/port);
                wireguardConfig.ts:32-38 (panel .conf ignores Hosts).
Not determined: Which surface the reporter used ("get wireguard config" could be the client
                QR/Info modal or the raw subscription). Both are affected, so the verdict holds.

Suggested fix: make genWireguardLink / genAmneziaWGLink produce one link per externalProxy entry, taking dest/port and the Host remark from it, the same way genTuicLink does. Also decide whether the panel's client QR/Info WireGuard config should show Host endpoints (for example, by fetching the server-rendered links). Keep frontend/src/lib/xray/ and docs/lib/xray/ in step with the Go change.

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

<!-- gh-comment-id:5891362871 --> @github-actions[bot] commented on GitHub (Sep 29, 2026): This is a real bug, and it is still present on the default branch. The generators for the plain `wireguard://` link and the WireGuard `.conf` text never read Hosts. They always use the inbound's own share address and port. Only the **JSON** and **Clash** subscription formats apply a Host's address and port to a WireGuard inbound. **Workaround until this is fixed:** there is only one endpoint, so you can set it on the inbound itself. Edit the inbound → Basics → set **Share address strategy** to `Custom` and put the host in **Custom share address**. That address is what `resolveInboundAddress` (subscription) and `resolveShareHost` (panel) use. This gives you one endpoint and the inbound's own port. It cannot produce one config per Host. If you need a separate endpoint per Host, the JSON and Clash subscription formats already produce one per Host. **How the Host is lost.** For the raw subscription and "Export all inbound links", `getSubs` / `inboundLinks` call `linkFromHosts` whenever the inbound has enabled Hosts (`internal/sub/service.go:503-504`, `:576-577`). That function places the Hosts into the stream's `externalProxy` and then calls `GetLink` (`internal/sub/host_sub.go:237-239`). Every other link generator iterates over `externalProxy`, but the WireGuard one ignores it: ```go // internal/sub/service.go:939 genWireguardLink link := fmt.Sprintf("wireguard://%s@%s", encodeUserinfo(client.PrivateKey), joinHostPort(s.resolveInboundAddress(inbound), inbound.Port)) ``` For contrast, TUIC loops over `stream["externalProxy"]` at `internal/sub/service.go:888-914`. AmneziaWG has the same gap: `internal/sub/service.go:1087` passes `s.resolveInboundAddress(inbound), inbound.Port`. The panel's own WireGuard config (Clients → QR / Info) never looks at Hosts at all. `frontend/src/pages/clients/wireguardConfig.ts:32-38` builds `Endpoint` from `resolveShareHost(...)` and `inbound?.port`. By contrast, the JSON and Clash paths overwrite `inbound.Listen` / `Port` per Host before they build the WireGuard outbound (`internal/sub/json_service.go:616-619` → `genWireguard` `"endpoint": joinHostPort(inbound.Listen, inbound.Port)` at `:1006`; `internal/sub/clash_service.go:365-368` → `buildWireguardProxy` `"server": inbound.Listen` at `:626`). The Hosts page also lists WireGuard inbounds (`frontend/src/pages/hosts/HostList.tsx:41`). So Hosts are clearly meant to apply to WireGuard, but only some output formats honour them. I changed the title from `[Bug]:` to describe the problem. ``` Verdict: Confirmed bug Severity: Medium Confidence: High Root cause: internal/sub/service.go:939 genWireguardLink (and :1087 genAmneziaWGLink) build the endpoint from resolveInboundAddress(inbound)/inbound.Port and never read the stream "externalProxy" that linkFromHosts (host_sub.go:237-239) injects, so every Host renders to the same unchanged link. The panel-side .conf builder frontend/src/pages/clients/wireguardConfig.ts:32-38 has no Host input at all. Triggered for any wireguard/amneziawg inbound with >=1 enabled Host, in raw subscriptions, "Export all inbound links", and the client QR/Info configs. Hosts were introduced in 709b332d "feat(hosts): managed Hosts for per-host subscription link overrides (#5409)"; the WG raw generator was never wired in. Already fixed: Still present on the default branch (823db059, after v3.8.5). Duplicate of: Related: #6007 (WireGuard endpoint host, but about Share address strategy, not Hosts) Evidence: service.go:503-504, :576-577 (host path taken); host_sub.go:237-239 (externalProxy injected, GetLink called); service.go:939 and :1087 (externalProxy ignored); service.go:888-914 (TUIC honours it); json_service.go:616-619 + :1006 and clash_service.go:365-368 + :626 (JSON/Clash honour Host dest/port); wireguardConfig.ts:32-38 (panel .conf ignores Hosts). Not determined: Which surface the reporter used ("get wireguard config" could be the client QR/Info modal or the raw subscription). Both are affected, so the verdict holds. ``` Suggested fix: make `genWireguardLink` / `genAmneziaWGLink` produce one link per `externalProxy` entry, taking `dest`/`port` and the Host remark from it, the same way `genTuicLink` does. Also decide whether the panel's client QR/Info WireGuard config should show Host endpoints (for example, by fetching the server-rendered links). Keep `frontend/src/lib/xray/` and `docs/lib/xray/` in step with the Go change. *This reply was generated automatically; a maintainer may follow up.* <!-- claude-issue:analyst -->
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#4464
No description provided.