mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #6306] [Bug]: AWG inbounds can't be cloned / deployed to remote #4281
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#4281
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?
Originally created by @rlex on GitHub (Aug 24, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6306
Describe the bug
AWG inbounds can't be cloned and created on remote nodes. Node selector disappears when amneziawg is selected
How to reproduce the problem
Add remote node
Try to deploy awg to remote node
Try to clone local to remote
Both fail
Expected behavior
No response
Actual behavior
No response
Relevant logs
Screenshots
No response
3x-ui version
3.7.0
Xray-core version
No response
How did you install 3x-ui?
Docker / Docker Compose
Operating system
Ubuntu 26.04
Which parts of the panel are affected?
Multi-node (sub-nodes)
Browser (only if it is a UI bug)
No response
Is the panel behind a reverse proxy or CDN?
None
Before submitting
@rlex commented on GitHub (Aug 24, 2026):
Since remote cloning was my work i'll check it out - nodes probably doesn't advertise awg capability (yes, all are updated to 3.7.0)
If root case is same might be able to fix both.
@github-actions[bot] commented on GitHub (Aug 24, 2026):
This is intentional, not a regression: AmneziaWG is deliberately excluded from the protocols that may live on a sub-node, so the Deploy To selector is hidden when you pick
amneziawg, and Clone falls back to the local-only one-click clone. The restriction shipped together with AmneziaWG itself in v3.7.0 and is enforced in three places — so what is being asked for here is an enhancement (extend node deployment to AmneziaWG), not a bug fix.On the hypothesis in your comment: there is no per-protocol capability negotiation between master and node to be missing. The only capability token that exists is
zstd—internal/util/wirecodec/wirecodec.go:18-22(CapsHeader = "X-3x-Node-Caps",CapZstd = "zstd"), consumed byRemote.recordCaps(internal/web/runtime/remote.go:132), which sets nothing butsupportsZstd. The gate is a static protocol list plus a server-side guard.Where the behaviour comes from
The node-eligible set simply does not contain
amneziawg—frontend/src/lib/xray/node-protocols.ts:9:WIREGUARDis in that list, but AmneziaWG is a distinct protocol value (amneziawg,internal/database/model/model.go:35), so it does not inherit WireGuard's eligibility.frontend/src/pages/inbounds/form/InboundFormModal.tsx:252and:617:frontend/src/pages/inbounds/InboundsPage.tsx:556: the multi-target dialog only opens forNODE_ELIGIBLE_PROTOCOLS[dbInbound.protocol]; everything else takes the "original one-click local clone" branch.internal/web/service/inbound.go:962: (the same guard is repeated on update atinternal/web/service/inbound.go:1500).The intent is stated in the source and pinned by a test, so this is not an oversight:
TestIsNodeEligibleProtocol(internal/web/service/inbound_protocol_test.go:95) assertsmodel.AmneziaWGis ineligible. The underlying constraint is real: the desired-state query for the embedded AmneziaWG runtime is local-only —internal/web/service/inbound_amneziawg.go:31,Where("protocol = ? AND enable = ? AND node_id IS NULL", model.AmneziaWG, true)— so a row with anode_idwould never be reconciled by the master'samneziawg_job.Workaround today
Create the AmneziaWG inbound directly in the sub-node's own panel UI, where it is a local inbound: every 3x-ui instance schedules the reconcile job unconditionally (
internal/web/web.go:338,awgJob := job.NewAmneziaWGJob()), master or node. The trade-off is ownership — the master panel will not list that inbound, manage its clients, or aggregate its traffic. I read this from the code; I cannot run a panel here to demonstrate it.Documentation is misleading here and is worth correcting regardless of whether the restriction is lifted —
docs/content/docs/en/config/amneziawg.mdx:171says multi-node paths "likely work (the reconciler runs the same way regardless of how the panel itself is deployed)", while the code hard-blocks node assignment.Verdict: Not a bug (expected behaviour)
Severity: N/A
Confidence: High
Root cause: No defect.
amneziawgis absent fromNODE_ELIGIBLE_PROTOCOLS(frontend/src/lib/xray/node-protocols.ts:9) and fromnodeEligibleProtocols(internal/web/service/inbound_protocol.go:60), which hides the Deploy To field (InboundFormModal.tsx:617), routes Clone to the local branch (InboundsPage.tsx:556) and makes the add/update API reject a node-assigned AmneziaWG inbound (inbound.go:962,inbound.go:1500). Both lists were introduced by the AmneziaWG feature commit itself,effcccce feat(amneziawg): add native AmneziaWG protocol support (#6105).Already fixed: Not applicable — the restriction is present and deliberate on the default branch (
git tag --contains effcccce→v3.7.0, the reporter's version).Duplicate of: None. Related: #6302 (AmneziaWG for outbounds) — different surface, not the same root cause.
Evidence:
frontend/src/lib/xray/node-protocols.ts:9-16(list withoutamneziawg);frontend/src/pages/inbounds/form/InboundFormModal.tsx:252,617;frontend/src/pages/inbounds/InboundsPage.tsx:556-563;internal/web/service/inbound_protocol.go:56-67;internal/web/service/inbound.go:962-964and:1500-1502;internal/web/service/inbound_protocol_test.go:95-107(TestIsNodeEligibleProtocol, ineligible set includesmodel.AmneziaWG);internal/web/service/inbound_amneziawg.go:31(node_id IS NULL);internal/web/web.go:338-340(job scheduled in every instance);internal/util/wirecodec/wirecodec.go:18-22(zstdis the only node capability token);docs/content/docs/en/config/amneziawg.mdx:167-177.Not determined: Whether lifting the restriction is wanted — a node push would go out via
Remote.AddInbound(internal/web/runtime/remote.go:412) to the child panel's/panel/api/inbounds/add, where the row would be local and reconcilable, so the block may be conservative rather than structural. Only the maintainer can settle that; it is a design decision, not something the source answers.Note: the
buglabel and the[Bug]:title prefix are unchanged — the label and title edits this analysis would have made (swapbug→enhancement) were refused by this environment's permissions, so a maintainer needs to apply them by hand.This reply was generated automatically; a maintainer may follow up.
@rlex commented on GitHub (Aug 24, 2026):
Will wait for Sanaei input then
@rlex commented on GitHub (Sep 3, 2026):
Sorry for ping @MHSanaei but what do you think about it?
@ChesterFishmansWork commented on GitHub (Oct 2, 2026):
Looked into what a fix would actually cost here, since the selector gate is only the visible part. Beyond adding
amneziawgtonodeEligibleProtocols/NODE_ELIGIBLE_PROTOCOLS, two structural pieces have to move:InboundService.DesiredAmneziaWGInstancesselectsprotocol = amneziawg AND enable = 1 AND node_id IS NULL(internal/web/service/inbound_amneziawg.go:30), and the interface is materialised by the embedded sidecar (internal/amneziawg) on the panel that owns the row. A node-assigned AWG inbound is therefore invisible to every reconcile loop — the node's own panel would have to run the same sidecar for its own rows, with the master keeping metadata and pushing the inbound like the Xray protocols do today.ClientService.otherTunnelAllowedIPs,internal/web/service/client_inbound_apply.go:272) and the port checks (internal/web/service/port_conflict.go) look across all inbounds regardless ofnode_id. Two nodes may legitimately reuse the same subnet/port — they are separate hosts — but on a single node they must not, so those queries become node-scoped.wireInboundalready shipssettingsverbatim, so the per-node push is mostly plumbing plus tests (inbound_protocol_test.gomirrors the frontend list).So the shape of the patch is: extend both protocol lists, make the desired-state query node-aware, scope the AWG/WG subnet + port checks per node, mirror it in the tests.
Three decisions change the size of that patch, and I'd rather not guess them:
If that direction is right I'm happy to prepare it as a PR.
@rlex commented on GitHub (Oct 2, 2026):
also affects TUIC
@ChesterFishmansWork commented on GitHub (Oct 2, 2026):
Re TUIC: same shape of problem, so it should be decided once rather than twice. TUIC (see #6704) is also materialised by state that lives on the panel owning the row, so enabling the protocol in the deploy path alone leaves a node-assigned TUIC inbound invisible to the reconcile loop — exactly the convergence piece described above.
If the direction is "the node's own panel runs the sidecar for its own rows and the master keeps metadata + pushes", AWG and TUIC can both be enabled on nodes in one series of changes; if instead the master drives the interfaces over the API, both need that API path. The two remaining questions (node-scoped vs globally unique subnet/port checks, and capability advertisement for older nodes) apply to both protocols unchanged.
So the plan above is meant to cover TUIC as well — happy to shape the PR around whichever direction the maintainers pick.