mirror of
https://github.com/andrey271192/amnezia_web-PRO.git
synced 2026-09-20 14:42:00 +00:00
feat: deploy AmneziaWG instances from the panel (no Amnezia app)
Add a "Протоколы / инстансы" section that spins up AmneziaWG server containers straight from the panel, with port + variant selection — no need to run the Amnezia desktop app to set up the server. Core (scripts/awg-instance.sh): - create <awg2|awg|legacy> <port> [name]: pulls the public image (amneziavpn/amneziawg-go:2.0.0 / :0.2.18 / amneziavpn/amnezia-wg), generates server keys + psk, writes awg0.conf/wg0.conf with a free 10.8.<N>.0/24 subnet (scans running containers to avoid clashes), random AmneziaWG obfuscation (Jc/Jmin/Jmax/S1..S4/H1..H4 as single uint32 values — ranges break awg setconf), and a start.sh that brings the iface up via userspace amneziawg-go + NAT MASQUERADE. remove <name>, list. Backend (server.js): - Profiles are now dynamic: env AWG_PROFILES merged with managed instances persisted in /data/instances.json (getProfiles()), so a new instance is usable immediately without restarting the panel. - /api/instances (list with running/peers), /api/instances/create, /delete, /stop, /start. create runs the script then registers the profile; delete tears down container + data + profile. Infra: - Dockerfile: add bash iproute2 coreutils, COPY scripts. - install.sh: mkdir /opt/amnezia-instances and bind-mount it into the panel so docker-in-docker bind paths line up. UI (index.html/app.js/styles.css): - Cards per instance (icon, NEW badge, description, РАБОТАЕТ/ОСТАНОВЛЕН, port, connections) with Стоп/Старт, Подключения (switches the active instance), Удалить; plus a create form (variant + port). Verified end to end on a live VPS: create awg2/awg/legacy instances, interfaces come up, a client created on a new instance gets the right subnet (10.8.20.2) and Endpoint (host:51850).
This commit is contained in:
@@ -183,6 +183,35 @@
|
||||
</div>
|
||||
</details>
|
||||
|
||||
<details class="panel-fold" id="instances-panel" open>
|
||||
<summary class="fold-summary">
|
||||
<span class="fold-arrow" aria-hidden="true"></span>
|
||||
<span class="fold-titles">
|
||||
<span class="fold-h">Протоколы / инстансы</span>
|
||||
<span class="muted fold-meta">Разверните AmneziaWG прямо из панели — без приложения Amnezia, с выбором порта</span>
|
||||
</span>
|
||||
</summary>
|
||||
<div class="panel-fold-body">
|
||||
<div id="instances-grid" class="instances-grid"></div>
|
||||
<form id="instance-form" class="instance-form">
|
||||
<div class="instance-form-row">
|
||||
<label for="instance-variant">Протокол</label>
|
||||
<select id="instance-variant" class="form-select">
|
||||
<option value="awg2">AmneziaWG 2.0 (рекомендуется)</option>
|
||||
<option value="awg">AmneziaWG</option>
|
||||
<option value="legacy">AmneziaWG Legacy</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="instance-form-row">
|
||||
<label for="instance-port">Порт (UDP)</label>
|
||||
<input id="instance-port" type="number" min="1" max="65535" placeholder="напр. 51820" autocomplete="off">
|
||||
</div>
|
||||
<button type="submit" class="btn primary">+ Развернуть инстанс</button>
|
||||
</form>
|
||||
<p class="muted instance-hint">Создаёт серверный контейнер AmneziaWG из публичного образа, генерирует ключи и NAT. Затем в «Пользователях» выберите инстанс и создавайте клиентов.</p>
|
||||
</div>
|
||||
</details>
|
||||
|
||||
<details class="panel-fold" id="direct-panel" open>
|
||||
<summary class="fold-summary">
|
||||
<span class="fold-arrow" aria-hidden="true"></span>
|
||||
|
||||
Reference in New Issue
Block a user