[PR #6086] [CLOSED] feat(amneziawg): add amneziawg protocol via docker #6078

Closed
opened 2026-11-02 04:06:12 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/6086
Author: @Petrprogs
Created: 7/23/2026
Status: ❌ Closed

Base: main ← Head: feat/amneziawg


📝 Commits (5)

  • 2d0aeb2 feat: add AmneziaWG protocol support with Docker-based WireGuard sidecar
  • 7b0a766 fix(amneziawg): remove dead code, fix fake key defaults, add tests
  • 940c78d docs(readme): add AmneziaWG to supported protocols and note Docker requirement
  • dbb80db fix(protocols): merge new set of MULTI_USER_PROTOCOLS with amneziwg
  • ab4951c Merge branch 'main' into feat/amneziawg

📊 Changes

48 files changed (+2167 additions, -16 deletions)

View changed files

📝 README.md (+3 -1)
📝 frontend/public/openapi.json (+2 -1)
📝 frontend/src/generated/schemas.ts (+2 -1)
📝 frontend/src/generated/zod.ts (+1 -1)
📝 frontend/src/lib/xray/inbound-defaults.ts (+46 -1)
📝 frontend/src/lib/xray/inbound-form-adapter.ts (+2 -0)
📝 frontend/src/lib/xray/protocol-capabilities.ts (+1 -1)
📝 frontend/src/pages/clients/BulkAttachInboundsModal.tsx (+1 -1)
📝 frontend/src/pages/clients/BulkDetachInboundsModal.tsx (+1 -1)
📝 frontend/src/pages/clients/ClientBulkAddModal.tsx (+1 -1)
📝 frontend/src/pages/clients/ClientFormModal.tsx (+1 -1)
📝 frontend/src/pages/clients/ClientQrModal.tsx (+22 -2)
➕ frontend/src/pages/clients/amneziawgConfig.ts (+57 -0)
📝 frontend/src/pages/inbounds/form/InboundFormModal.tsx (+6 -2)
➕ frontend/src/pages/inbounds/form/protocols/amneziawg.tsx (+91 -0)
📝 frontend/src/pages/inbounds/form/protocols/index.ts (+1 -0)
📝 frontend/src/schemas/client.ts (+20 -0)
📝 frontend/src/schemas/primitives/protocol.ts (+2 -0)
➕ frontend/src/schemas/protocols/inbound/amneziawg.ts (+49 -0)
📝 frontend/src/schemas/protocols/inbound/index.ts (+3 -0)

...and 28 more files

📄 Description

Summary

Add AmneziaWG (AWG) protocol support using a Docker-based WireGuard sidecar, with full panel management, config generation, and client lifecycle.

Why

AmneziaWG extends WireGuard with packet obfuscation (junk packets, random padding, magic headers) to bypass DPI. This implementation runs AWG as a Docker sidecar outside Xray, one container per inbound, with hot-add/remove of peers and real Curve25519 key generation.

Type of change

  • Bug fix
  • New feature
  • Refactoring (no behavior change)
  • Documentation
  • Tests only
  • Build / CI / tooling
  • Other

Areas affected

  • Frontend (UI / panel pages)
  • Backend (API endpoints, login, settings)
  • Xray config generation
  • Subscription (share links / Clash / JSON)
  • Statistics / traffic counters
  • Database / migrations
  • Install / upgrade script
  • Docker image
  • Multi-node (sub-nodes)
  • Telegram bot

How was this tested?

New tests (22):

  • internal/amneziawg/keys_test.go (6): key generation, base64 validity, Curve25519 clamping, non-determinism
  • internal/amneziawg/params_test.go (10): Jc range, S1-S4 distinctness and ranges, header format and non-overlap, IP allocation with used addresses, subnet exhaustion, invalid input
  • internal/web/service/client_amneziawg_test.go (6): keypair generation on create, existing key preservation, sequential IP allocation, missing server error, invalid settings, interface map updates
    Manual verification:
  • Created AWG inbound via panel - server keys generated by backend, container starts
  • Added clients - IPs allocated sequentially, keys generated
  • Viewed client config download - .conf generated with obfuscation params
  • Edited server obfuscation params - container updated
  • Removed inbound - container stopped and removed
  • Verified go test -shuffle=on -count=1 ./... and npm run typecheck && npm run lint && npm run build pass

Screenshots / recordings

image image image

Breaking changes

None. New protocol addition; existing inbounds and configs unaffected.

Checklist

  • I tested the change locally and confirmed the described behavior.
  • I added or updated tests for the new behavior (when applicable).
  • go build ./... and the test suite pass locally.
  • For frontend changes: npm run lint, npm run typecheck, and npm run build pass.
  • I updated the Wiki / README / API docs if user-facing behavior changed.
  • My commits follow the project's existing message style.
  • I have no unrelated changes mixed into this PR.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/MHSanaei/3x-ui/pull/6086 **Author:** [@Petrprogs](https://github.com/Petrprogs) **Created:** 7/23/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `feat/amneziawg` --- ### 📝 Commits (5) - [`2d0aeb2`](https://github.com/MHSanaei/3x-ui/commit/2d0aeb2b35138b32c1e5952f5570500b71d3cd43) feat: add AmneziaWG protocol support with Docker-based WireGuard sidecar - [`7b0a766`](https://github.com/MHSanaei/3x-ui/commit/7b0a766dcdc0483ffca3b2ad4e5479697f1750d7) fix(amneziawg): remove dead code, fix fake key defaults, add tests - [`940c78d`](https://github.com/MHSanaei/3x-ui/commit/940c78d4f964e8b0baffd781d009a25ff1fb56ce) docs(readme): add AmneziaWG to supported protocols and note Docker requirement - [`dbb80db`](https://github.com/MHSanaei/3x-ui/commit/dbb80db9f84b3d8c37ff3105214eff3480ce7e5e) fix(protocols): merge new set of MULTI_USER_PROTOCOLS with amneziwg - [`ab4951c`](https://github.com/MHSanaei/3x-ui/commit/ab4951ce2bdd6dbfcc7365e3b3bec70b9e7381b1) Merge branch 'main' into feat/amneziawg ### 📊 Changes **48 files changed** (+2167 additions, -16 deletions) <details> <summary>View changed files</summary> 📝 `README.md` (+3 -1) 📝 `frontend/public/openapi.json` (+2 -1) 📝 `frontend/src/generated/schemas.ts` (+2 -1) 📝 `frontend/src/generated/zod.ts` (+1 -1) 📝 `frontend/src/lib/xray/inbound-defaults.ts` (+46 -1) 📝 `frontend/src/lib/xray/inbound-form-adapter.ts` (+2 -0) 📝 `frontend/src/lib/xray/protocol-capabilities.ts` (+1 -1) 📝 `frontend/src/pages/clients/BulkAttachInboundsModal.tsx` (+1 -1) 📝 `frontend/src/pages/clients/BulkDetachInboundsModal.tsx` (+1 -1) 📝 `frontend/src/pages/clients/ClientBulkAddModal.tsx` (+1 -1) 📝 `frontend/src/pages/clients/ClientFormModal.tsx` (+1 -1) 📝 `frontend/src/pages/clients/ClientQrModal.tsx` (+22 -2) ➕ `frontend/src/pages/clients/amneziawgConfig.ts` (+57 -0) 📝 `frontend/src/pages/inbounds/form/InboundFormModal.tsx` (+6 -2) ➕ `frontend/src/pages/inbounds/form/protocols/amneziawg.tsx` (+91 -0) 📝 `frontend/src/pages/inbounds/form/protocols/index.ts` (+1 -0) 📝 `frontend/src/schemas/client.ts` (+20 -0) 📝 `frontend/src/schemas/primitives/protocol.ts` (+2 -0) ➕ `frontend/src/schemas/protocols/inbound/amneziawg.ts` (+49 -0) 📝 `frontend/src/schemas/protocols/inbound/index.ts` (+3 -0) _...and 28 more files_ </details> ### 📄 Description ## Summary Add AmneziaWG (AWG) protocol support using a Docker-based WireGuard sidecar, with full panel management, config generation, and client lifecycle. ## Why AmneziaWG extends WireGuard with packet obfuscation (junk packets, random padding, magic headers) to bypass DPI. This implementation runs AWG as a Docker sidecar outside Xray, one container per inbound, with hot-add/remove of peers and real Curve25519 key generation. ## Type of change - [ ] Bug fix - [x] New feature - [ ] Refactoring (no behavior change) - [x] Documentation - [ ] Tests only - [ ] Build / CI / tooling - [ ] Other ## Areas affected - [x] Frontend (UI / panel pages) - [x] Backend (API endpoints, login, settings) - [ ] Xray config generation - [ ] Subscription (share links / Clash / JSON) - [ ] Statistics / traffic counters - [ ] Database / migrations - [ ] Install / upgrade script - [ ] Docker image - [ ] Multi-node (sub-nodes) - [ ] Telegram bot ## How was this tested? New tests (22): - internal/amneziawg/keys_test.go (6): key generation, base64 validity, Curve25519 clamping, non-determinism - internal/amneziawg/params_test.go (10): Jc range, S1-S4 distinctness and ranges, header format and non-overlap, IP allocation with used addresses, subnet exhaustion, invalid input - internal/web/service/client_amneziawg_test.go (6): keypair generation on create, existing key preservation, sequential IP allocation, missing server error, invalid settings, interface map updates Manual verification: - Created AWG inbound via panel - server keys generated by backend, container starts - Added clients - IPs allocated sequentially, keys generated - Viewed client config download - .conf generated with obfuscation params - Edited server obfuscation params - container updated - Removed inbound - container stopped and removed - Verified go test -shuffle=on -count=1 ./... and npm run typecheck && npm run lint && npm run build pass ## Screenshots / recordings <img width="783" height="742" alt="image" src="https://github.com/user-attachments/assets/a35402fd-8856-43f0-b112-8eb889b6d794" /> <img width="783" height="742" alt="image" src="https://github.com/user-attachments/assets/8fc29734-8920-4baf-b730-dcd82bf5552a" /> <img width="512" height="639" alt="image" src="https://github.com/user-attachments/assets/c78215c6-229b-4e2e-a091-0024e8221974" /> ## Breaking changes None. New protocol addition; existing inbounds and configs unaffected. ## Checklist - [x] I tested the change locally and confirmed the described behavior. - [x] I added or updated tests for the new behavior (when applicable). - [x] `go build ./...` and the test suite pass locally. - [x] For frontend changes: `npm run lint`, `npm run typecheck`, and `npm run build` pass. - [x] I updated the Wiki / README / API docs if user-facing behavior changed. - [x] My commits follow the project's existing message style. - [x] I have no unrelated changes mixed into this PR. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 04:06:12 +07:00
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#6078
No description provided.