mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #6310] [Bug]: Clash subscription omits AmneziaWG entries #4282
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#4282
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 @xiaoxiyao on GitHub (Aug 25, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6310
Describe the bug
Clash subscription generated by 3x-ui omits AmneziaWG (amneziawg) proxy entries for enabled AmneziaWG clients.
How to reproduce the problem
Expected behavior
No response
Actual behavior
No response
Relevant logs
Screenshots
No response
3x-ui version
3.7.0
Xray-core version
26.7.28
How did you install 3x-ui?
install.sh script
Operating system
Unknown
Which parts of the panel are affected?
Subscription (share links / Clash / JSON)
Browser (only if it is a UI bug)
No response
Is the panel behind a reverse proxy or CDN?
No — direct access
Before submitting
@github-actions[bot] commented on GitHub (Aug 25, 2026):
Confirmed — the Clash generator has no
amneziawgbranch at all, so every AmneziaWG client is silently dropped from the/clash/YAML. This is still true on the default branch (v3.7.0, the version you reported).Where the client is dropped
The inbound is selected for the subscription —
getInboundsBySubIdlists the protocol explicitly:and the raw
/sub/body builds a working link for it (internal/sub/service.go:638-639→genAmneziaWGLink, emittingvpn://<base64url .conf>).The Clash path then throws it away.
SubClashService.buildProxyspecial-cases Hysteria and WireGuard, handles the four Xray protocols in aswitch, and returnsnilfor everything else:model.AmneziaWGreaches thatdefault(the earlierapplyTransportcall returnstruefor the empty network,internal/sub/clash_service.go:583),getProxiesappends nothing, and if the sub contains only AmneziaWG clientsGetClashreturns an empty body atinternal/sub/clash_service.go:71-73. The external-link Clash path has the same gap —clashProxyFromExternalswitches onvmess/vless/trojan/shadowsocks/hysteria/wireguardonly (internal/sub/clash_external.go:31-87).The JSON subscription is affected too, and worse
Since you ticked "Subscription (share links / Clash / JSON)":
SubJsonService.getConfighas the same missing branch (internal/sub/json_service.go:517-541), but unlike the WireGuard case it does notcontinue— it falls through tonewOutbounds = append(newOutbounds, s.defaultOutbounds...)(internal/sub/json_service.go:543). The default outbounds are onlydirect(freedom) andblock(blackhole) (internal/sub/default.json:45-63), while the routing rule sends all traffic to a tag that no longer exists:So an AmneziaWG client gets a named config entry in
/json/that contains no proxy outbound at all.Workaround until this is addressed
Use the raw subscription (
/sub/) or the per-client export in the panel — both already produce a correct AmneziaWG payload. From the client list you can copy thevpn://…share link or download the.confand import it into the AmneziaVPN/AmneziaWG app; see Configuration → AmneziaWG.Verdict: Confirmed bug
Severity: Medium
Confidence: High
Root cause:
SubClashService.buildProxy,internal/sub/clash_service.go:248-287— the protocolswitchhas nomodel.AmneziaWGcase, so an AmneziaWG inbound falls todefault: return nil(line 285-287) and its clients never become Clash proxies. Triggering condition: any enabledamneziawginbound whose clients carry the requestedsubId, fetched over/clash/. Same omission inSubJsonService.getConfig,internal/sub/json_service.go:517-541, and inclashProxyFromExternal,internal/sub/clash_external.go:31-87. Not a regression — AmneziaWG was never wired into these two generators; the raw-link path was (internal/sub/service.go:638).Already fixed: Still present on the default branch (
f727d04f, v3.7.0). The directly analogous defect for native WireGuard was fixed ind2efe9b0"fix(sub): include native WireGuard clients in Clash and JSON subscriptions (#5676)" (released in v3.5.0), which added exactly the branches AmneziaWG is still missing.Duplicate of: None. Related: #6302 (AmneziaWG as an outbound) and #6306 (AWG inbound clone/deploy) are separate root causes.
Evidence:
internal/sub/service.go:487(inbound is selected:'wireguard','amneziawg','mtproto');internal/sub/service.go:638-639(case "amneziawg": return s.genAmneziaWGLink(...)— raw links work);internal/sub/clash_service.go:232-234(WireGuard branch) vs:285-287(default: return nil);internal/sub/clash_external.go:31-87;internal/sub/json_service.go:517-541+:543;internal/sub/default.json:85("outboundTag": "proxy"); testTestGetInboundsBySubIdIncludesAmneziaWG(internal/sub/service_amneziawg_test.go:165) pins only the DB selection, and no test ininternal/sub/clash_service_test.gocovers AmneziaWG — so nothing asserts the current omission as intended.Not determined: Whether mihomo can faithfully represent an AmneziaWG peer — its
wireguardproxy would have to carry the obfuscation parameters the panel emits (Jc/Jmin/Jmax/S1/S2/H1-H4, and for 3.1 alsoI1-I5,HeaderProtectionKey,RandomTrailers, …;internal/sub/service.go:729-768). I could not verify mihomo's field names from this checkout, and a plainwireguardentry without them would never complete a handshake against an AmneziaWG server. Checking the mihomoWireGuardOptionstruct for an AmneziaWG option block settles it, and also settles whether the AmneziaWG 3.1 fields can be carried at all. Xray-core has noamneziawgoutbound (the panel runs it itself ininternal/amneziawgnet/), so the/json/format most likely cannot carry it either.Suggested fix: Mirror
d2efe9b0— add amodel.AmneziaWGbranch tobuildProxythat emits a mihomowireguardproxy plus its AmneziaWG option block, with the field names verified against mihomo's own source the way that commit did for the base WireGuard fields. If mihomo (or Xray, for/json/) cannot carry the obfuscation parameters, the client must be skipped explicitly instead — ingetConfigthat means acontinue, so/json/stops emitting an entry whose only outbounds aredirectandblock.This reply was generated automatically; a maintainer may follow up.
@VibeProgramm commented on GitHub (Aug 25, 2026):
Confirmed on another instance:
Reproduction:
https://<panel>/clash/{subId}amneziawgappears inproxy-groupsbut has no proxy definition inproxiessectionClash output (redacted):
The subscription endpoint also generates a
vpn://link for AmneziaWG in the/clients/links/API response, but the Clash YAML conversion is missing. This breaks Clash/mihomo clients as they cannot resolve theamneziawgproxy reference.@VibeProgramm commented on GitHub (Aug 25, 2026):
PR with fix: https://github.com/MHSanaei/3x-ui/pull/6326
Adds
buildAmneziaWGProxyto generate mihomo-compatible Clash proxy entries withamnezia-wg-optionsub-block for AmneziaWG inbounds. Supports v1.0, v1.5, and v3 (header protection, content padding, timing, random-trailers, disable-cookies) obfuscation fields.