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 Pre-Shared Key",
"wireguardAllowedIPs": "WireGuard Allowed IPs",
"wireguardAllowedIPsHint": "Leave empty to auto-assign; separate entries with commas",
"amneziaWgPrivateKey": "AmneziaWG Private Key",
"amneziaWgPublicKey": "AmneziaWG Public Key",
"amneziaWgPreSharedKey": "AmneziaWG Pre-Shared Key",
"amneziaWgAllowedIPs": "AmneziaWG Allowed IPs",
"amneziaWgAllowedIPsHint": "Leave empty to auto-assign; separate entries with commas",
"amneziaWgConfig": "AmneziaWG config",
"mtprotoSecret": "MTProto secret",
"mtprotoSecretHint": "The client's FakeTLS secret. Regenerate to rotate it.",
"mtprotoAdTag": "Ad-tag (sponsored channel)",
@@ -1917,6 +1923,31 @@
"psk": "PreShared Key",
"domainStrategy": "Domain Strategy"
},
"amneziawg": {
"privateKey": "Private Key",
"publicKey": "Public Key",
"subnetIp": "Subnet",
"subnetCidr": "Subnet CIDR",
"mtu": "MTU",
"primaryDns": "Primary DNS",
"secondaryDns": "Secondary DNS",
"externalInterface": "External Interface",
"externalInterfaceHint": "Host NIC for NAT (PostUp/PostDown). Leave empty to auto-detect.",
"jc": "Jc (junk packet count)",
"jmin": "Jmin (junk packet min size)",
"jmax": "Jmax (junk packet max size)",
"s1": "S1 (init packet junk size)",
"s2": "S2 (response packet junk size)",
"s3": "S3 (cookie reply padding, 2.0)",
"s4": "S4 (transport packet padding, 2.0)",
"h1": "H1 (magic header)",
"h2": "H2 (magic header)",
"h3": "H3 (magic header)",
"h4": "H4 (magic header)",
"hHint": "A single integer or a low-high range. Leave empty for the classic 1/2/3/4 default.",
"i1": "I1 (signature packet, 2.0)",
"i1Hint": "AmneziaWG 2.0 only. Leave empty for a 1.x-compatible config."
},
"tun": {
"nameDesc": "The name of the TUN interface. Default is 'xray0'",
"mtuDesc": "Maximum Transmission Unit. The maximum size of data packets. Default is 1500",