mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 19:11:53 +07:00
[PR #6309] [CLOSED] feat(amneziawg): add AmneziaWG as an outbound protocol #6215
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#6215
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?
📋 Pull Request Information
Original PR: https://github.com/MHSanaei/3x-ui/pull/6309
Author: @rqzbeh
Created: 8/25/2026
Status: ❌ Closed
Base:
main← Head:feat/amneziawg-outbound📝 Commits (1)
beb8cb7feat(amneziawg): add AmneziaWG as an outbound protocol📊 Changes
34 files changed (+2005 additions, -15 deletions)
View changed files
📝
frontend/src/lib/xray/outbound-form-adapter.ts(+104 -0)📝
frontend/src/pages/xray/outbounds/OutboundFormModal.tsx(+2 -0)➕
frontend/src/pages/xray/outbounds/protocols/amneziawg.tsx(+228 -0)📝
frontend/src/pages/xray/outbounds/protocols/index.ts(+1 -0)📝
frontend/src/schemas/forms/outbound-form.ts(+7 -0)📝
frontend/src/schemas/primitives/outbound-protocol.ts(+1 -0)➕
frontend/src/schemas/protocols/outbound/amneziawg.ts(+49 -0)📝
frontend/src/schemas/protocols/outbound/index.ts(+3 -0)➕
frontend/src/test/amneziawg-outbound-adapter.test.ts(+89 -0)➕
internal/amneziawg/outbound.go(+273 -0)➕
internal/amneziawg/outbound_test.go(+201 -0)➕
internal/amneziawgnet/client_device.go(+145 -0)📝
internal/amneziawgnet/device.go(+11 -1)➕
internal/amneziawgnet/egress.go(+386 -0)➕
internal/amneziawgnet/outbound_manager.go(+170 -0)📝
internal/web/job/amneziawg_job.go(+59 -0)📝
internal/web/service/xray.go(+4 -0)➕
internal/web/service/xray_amneziawg_outbound.go(+66 -0)➕
internal/web/service/xray_amneziawg_outbound_test.go(+138 -0)📝
internal/web/service/xray_setting.go(+14 -0)...and 14 more files
📄 Description
Summary
Adds AmneziaWG (AWG) as an outbound option, the outbound counterpart of the existing embedded AmneziaWG inbound support. An admin can now declare an
amneziawgoutbound in the Xray settings; the panel runs an amneziawg-go client device for it and routes Xray's traffic through that tunnel.Why
Closes #6302. Hardened cascading panel-to-panel tunnels need AmneziaWG on the egress side; today AWG is inbound-only (#6105), and hanging the obfuscation fields off the stock WireGuard outbound cannot work because Xray-core has no AWG proxy — outbound JSON is handed to the core verbatim.
The design mirrors the inbound engine one-for-one: an embedded amneziawg-go device over a gVisor netstack inside the panel process (no kernel module, nothing new to install).
Type of change
Areas affected
How was this tested?
Backend (
go test ./...— 41 packages green):internal/amneziawg/outbound_test.go: instance derivation + validation accept/reject matrix (bad endpoints, control chars, empty allowedIPs, no peers, bad obfuscation).internal/web/service/xray_amneziawg_outbound_test.go: the generated-config swap preserves tag/order and is a byte-level no-op without AWG outbounds;CheckXrayConfigaccepts a valid AWG outbound and rejects broken ones.go vet ./...clean on a separate machine (Go 1.27 toolchain per go.mod).Frontend (
npm run typecheck,npm run lint,npm run test,npm run buildall green — 127 files / 1215 tests):src/test/amneziawg-outbound-adapter.test.ts: wire → form → wire round-trip losslessness, default hydration, optional-field omission.Manual flow exercised: add an
amneziawgoutbound via Outbound form → save template → generated config shows the socks bridge with the same tag pointing at 127.0.0.1:64900 → reconcile job brings up the client device (visible at AMNEZIAWGNET_DEBUG=1) → routing rules targeting the outbound's tag carry traffic through the tunnel.Screenshots / recordings
N/A (form follows the existing Wireguard/AWG field layout; no new page).
Breaking changes
None. Templates without an
amneziawgoutbound are unaffected (the transform is a verified no-op there); existing inbound AWG behavior and stored settings are untouched.Checklist
go build ./...and the test suite pass locally.npm run lint,npm run typecheck, andnpm run buildpass.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.