mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #6774] [Feature]: Option to serve AmneziaWG in raw subscription as plain .conf or wireguard:// instead of vpn:// #4511
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#4511
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 @agevlakh on GitHub (Oct 8, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6774
Describe the bug
When an AmneziaWG client is exposed through the built-in subscription server, the raw (base64) endpoint emits a single line:
vpn://is Amnezia's own container scheme. It is understood by AmneziaVPN/AmneziaWG apps and by some third-party clients on Android, but a large share of subscription clients — in particular on iOS/macOS — do not implement it and silently skip the entry. When a subscription contains only AmneziaWG entries, the result is an apparently empty subscription with no diagnostic shown to the user.The other endpoints are not a workaround:
docs/content/docs/en/config/subscription.mdx, see also #6410).allowed-ipsis not emitted at all, although the.confcontainsAllowedIPs = 0.0.0.0/0, ::/0.The exact same configuration, delivered as a plain
[Interface]/[Peer]text file over the very same HTTPS host, imports and connects on every client tested — including those that fail onvpn://.There is currently no panel option to serve AmneziaWG as a plain
.confor as awireguard://URI, so operators have to put a converting reverse proxy in front of the panel.How to reproduce the problem
Jc/Jmin/Jmax,S1–S4,H1–H4,I1,HeaderProtectionKey,RandomTrailers,ContentPaddingAddition,RekeyAfterTime,RekeyTimeout,RejectAfterTime,KeepaliveTimeout,MaxHandshakeAttempts,DisableCookies).vpn://line:vpn://support (reproduced with an iOS client; the Android build of the same app works) → the entry is dropped and the subscription appears empty..confand serve it astext/plainfrom the same host:Subscription-Userinfois displayed correctly.Expected behavior
The subscription server should be able to deliver AmneziaWG in a format that generic subscription clients can consume, without an external converting proxy.
Suggested options:
A per-panel (or per-inbound) setting controlling how AmneziaWG/WireGuard clients are serialised in the raw subscription:
vpn://conf[Interface]/[Peer]text, identical to the downloadable.confwireguard://wireguard://<key>@host:port/?address=…&jc=…&h1=…), already understood by several clientsOr a dedicated endpoint such as
/<subPath>/<subId>.confthat always returns the plain configuration, so operators can hand platform-specific links to users.Optionally, User-Agent-aware selection, consistent with how raw/JSON/Clash are already auto-selected.
Additionally,
allowed-ipsshould be emitted in the Clash/Mihomo output to match the.conf.Actual behavior
Same server, same client configuration, three delivery methods:
vpn://type: wireguard+amnezia-wg-option: version: 3.conf(local file or HTTPS URL)The panel returns byte-identical responses regardless of User-Agent (same status, same
Content-Length, same body), so the transport and the panel-side generation are consistent; the problem is the serialisation format.Two observations about the Clash/Mihomo output:
allowed-ipsis not emitted, although the.confcontainsAllowedIPs = 0.0.0.0/0, ::/0. Clients that expect it explicitly may end up without routes.header-protection-key,random-trailers,content-padding-addition,reject-after-time,rekey-after-time,rekey-timeout,keepalive-timeout,max-handshake-attempts,i1) are emitted, but a client that ignores unknown keys falls back to plain WireGuard / AWG 2.0 and is then dropped by a server with header protection enabled. Related: #6310.Related issues: #6410 (AmneziaWG not handled in JSON subscription), #6310 (Clash subscription omits AmneziaWG entries), #5113 (AWG 2.0 support).
Relevant logs
Screenshots
Not applicable — this is not a UI bug. All relevant data is provided as text above.
3x-ui version
3.9.0
Xray-core version
26.9.30
How did you install 3x-ui?
install.sh script
Operating system
Alpine Linux 3.24.2 (x86_64)
Which parts of the panel are affected?
Subscription (share links / Clash / JSON)
Browser (only if it is a UI bug)
N/A
Is the panel behind a reverse proxy or CDN?
Yes — Nginx
Before submitting
@github-actions[bot] commented on GitHub (Oct 8, 2026):
This is a feature request, not a bug. The raw subscription wraps AmneziaWG in
vpn://on purpose, and the panel has no setting for another format. Adding a plain.conforwireguard://mode would be new functionality, so I have relabelled the issueenhancement. I also retitled it from "[Bug]: AmneziaWG in raw subscription is wrapped in vpn://, which many clients cannot parse — no option to serve plain .conf" so the title names the request.Why
vpn://is the current outputgenAmneziaWGLinkininternal/sub/service.go:1072-1101builds the.conftext and always wraps it:The UI builder it mirrors gives the reason, at
frontend/src/lib/xray/inbound-link.ts:1062-1067: "Confirmed against the app's own source (importController.cpp's checkConfigFormat/extractWireGuardConfig)". The testsinternal/sub/service_amneziawg_test.go:17-45(TestGenAmneziaWGLinkFields) andinternal/sub/export_all_links_test.go:206fail on any link without thevpn://prefix. Nothing in the code selects a different scheme. The controller's User-Agent switching (internal/sub/controller.go:311-313) only chooses between raw, Clash and JSON. It never changes how an AmneziaWG link is written inside the raw output.Plain WireGuard inbounds already get a
wireguard://URI (internal/sub/service.go:963), so a URI form exists in the code, but only for plain WireGuard. Any alternative mode for AmneziaWG would also need a matching change in the UI builder (frontend/src/lib/xray/inbound-link.ts) and indocs/lib/xray/, or the three link generators would start producing different output.The two Clash/Mihomo points
allowed-ips: you are right thatbuildAmneziaWGProxy(internal/sub/clash_service.go:755-903) never sets it. It emitsip/ipv6,mtu,dnsandamnezia-wg-option, and nothing else for routing. Whether that matters depends on what the client does when the key is missing. I believe mihomo then routes everything (0.0.0.0/0, ::/0), but that is an inference: mihomo's source is not in this repository, so I could not check it. If a specific client actually loses its routes without the key, please post that client's name and version as text.version: 3whenever one of them is present (clash_service.go:857-896). A client that drops keys it does not know is a limitation of that client, not something the panel generates wrongly. I could not confirm which client you used, because the report does not name it.Until something like this exists, your current approach (a reverse proxy that decodes the
vpn://payload and serves it as plain text) is the only way to do it without changing code. The decoded text is exactly whatamneziaWGConfigText(internal/sub/service.go:983) produces.Related: #6310 (closed, Clash omitting AmneziaWG) and #6410 (closed, JSON subscription). Neither is a duplicate; this request is about the raw scheme.
Verdict: Feature request
This reply was generated automatically; a maintainer may follow up.
@agevlakh commented on GitHub (Oct 9, 2026):
Thanks for the triage — agreed, "enhancement" is the right label.
Client details (omitted in the original report, sorry):
INCY/2.6.2/ios CFNetwork/3860.300.31 Darwin/25.2.0, iPhone/iPad on iOS/iPadOS 18.7INCY/3.7.0/android Dalvik/2.1.0Same subscription URL, same server, same AmneziaWG 3.1 inbound:
vpn://.conf(file or HTTPS URL)On the handshake: agreed that a client silently dropping unknown keys is a client-side limitation. I have filed it separately with the INCY developers: . This request is only about the raw scheme.
On scope: thanks for pointing at
service.go:963— plain WireGuard already gets awireguard://URI, so the URI path exists. From an operator's point of view the smallest useful change would be either:AmneziaWG link format: vpn:// (default) | conf | wireguard://, or/<subPath>/<subId>.conf, always returningamneziaWGConfigTextoutput unchanged.Option 2 looks the least invasive: it would not touch
genAmneziaWGLink, would not breakTestGenAmneziaWGLinkFields/export_all_links_test.go, and would not require matching changes infrontend/src/lib/xray/inbound-link.tsordocs/lib/xray/, since the existing three generators keep producing identical output.For reference, my current workaround is exactly what you described: a reverse proxy that matches
^INCY/[0-9.]+/(ios|ipados|mac)on the User-Agent, fetches the raw subscription from the panel, decodes thevpn://payload and serves it astext/plain, forwardingProfile-Title,Profile-Update-IntervalandSubscription-Userinfo. It works and traffic accounting is unaffected, but it only handles subscriptions containing a single AmneziaWG entry, since a.confcannot express multiple servers. Happy to test a branch if one appears.