feat(amneziawg): add frontend support and fix a Go->Zod generator gap

Wires the amneziawg protocol through the panel UI the same way every
other protocol is registered: a Zod settings schema (nested
{server, clients}, matching the Go JSON exactly), the protocol enum,
the inbound-form's per-protocol fields component and its
tab-visibility allowlist, the default-settings factory, the client
schema dispatcher, and the sniffing-capability exclusion (no Xray
inbound exists for amneziawg, same as mtproto).

Client key/allowedIPs fields are reused rather than duplicated: since
AmneziaWG clients are wire-identical to WireGuard clients (same
model.Client fields), ClientFormModal renders one shared field block
for both, switching only the visible label by which protocol is
active. The private-key input also gets a live public-key sync via a
new useEffect, because unlike WireGuard's Xray-native inbound (which
re-derives its public key at runtime and never stores one),
AmneziaWG's server.publicKey is a real persisted field the Go backend
reads directly — free-typing a new private key without this would
silently save a mismatched keypair.

Adds a downloadable per-client .conf (amneziawgConfig.ts, mirroring
wireguardConfig.ts) with the obfuscation lines, and an
InboundOption.AwgServer field on the Go side so the config builder
gets the full server block in one round trip.

Along the way, running tools/openapigen surfaced a real bug: it
doesn't flatten anonymously-embedded Go structs the way encoding/json
does, so ServerSettings embedding Obfuscation20 produced a Zod schema
with a nested `obfuscation20` key that never matches the real wire
JSON. Fixed by un-embedding (flat fields + an accessor method) and
registering internal/amneziawg in the generator's own package list,
which had been silently emitting a dangling schema reference.

English and Russian translations are complete; the other 10 locale
files still fall back to English for the new keys.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Kuzz007
2026-07-25 01:33:18 +03:00
parent 83cc545953
commit 19082fdfe9
24 changed files with 684 additions and 28 deletions
+31
View File
@@ -915,6 +915,12 @@
"wireguardPreSharedKey": "Общий ключ WireGuard",
"wireguardAllowedIPs": "Разрешённые IP WireGuard",
"wireguardAllowedIPsHint": "Оставьте пустым для автоназначения; разделяйте записи запятыми",
"amneziaWgPrivateKey": "Приватный ключ AmneziaWG",
"amneziaWgPublicKey": "Публичный ключ AmneziaWG",
"amneziaWgPreSharedKey": "Общий ключ AmneziaWG",
"amneziaWgAllowedIPs": "Разрешённые IP AmneziaWG",
"amneziaWgAllowedIPsHint": "Оставьте пустым для автоназначения; разделяйте записи запятыми",
"amneziaWgConfig": "Конфиг AmneziaWG",
"mtprotoSecret": "Секрет MTProto",
"mtprotoSecretHint": "Секрет FakeTLS клиента. Перегенерируйте, чтобы сменить.",
"mtprotoAdTag": "Рекламный тег (спонсорский канал)",
@@ -1800,6 +1806,31 @@
"psk": "Общий ключ",
"domainStrategy": "Стратегия домена"
},
"amneziawg": {
"privateKey": "Приватный ключ",
"publicKey": "Публичный ключ",
"subnetIp": "Подсеть",
"subnetCidr": "Маска подсети (CIDR)",
"mtu": "MTU",
"primaryDns": "Основной DNS",
"secondaryDns": "Резервный DNS",
"externalInterface": "Внешний интерфейс",
"externalInterfaceHint": "Сетевой интерфейс хоста для NAT (PostUp/PostDown). Оставьте пустым для автоопределения.",
"jc": "Jc (кол-во мусорных пакетов)",
"jmin": "Jmin (мин. размер мусорного пакета)",
"jmax": "Jmax (макс. размер мусорного пакета)",
"s1": "S1 (мусор init-пакета)",
"s2": "S2 (мусор response-пакета)",
"s3": "S3 (паддинг cookie reply, 2.0)",
"s4": "S4 (паддинг transport-пакета, 2.0)",
"h1": "H1 (магический заголовок)",
"h2": "H2 (магический заголовок)",
"h3": "H3 (магический заголовок)",
"h4": "H4 (магический заголовок)",
"hHint": "Целое число или диапазон low-high. Оставьте пустым для классических значений 1/2/3/4.",
"i1": "I1 (сигнатурный пакет, 2.0)",
"i1Hint": "Только для AmneziaWG 2.0. Оставьте пустым для совместимости с 1.x."
},
"tun": {
"nameDesc": "Имя интерфейса TUN. Значение по умолчанию - 'xray0'",
"mtuDesc": "Максимальная единица передачи. Максимальный размер пакетов данных. Значение по умолчанию - 1500",