feat(amneziawg): remove the vestigial routeThroughXray toggle from the UI

Hard cutover, part 4: the embedded path has no opt-in gate for Xray
routing at all (every peer's traffic already goes through Xray's own
SOCKS5 relay unconditionally -- see xray.go's injectAmneziawgnetSocks), so
a toggle that no longer does anything would just confuse admins. Removed
from the form (amneziawg.tsx), the per-protocol Zod schema and its
new-inbound default, and the routeThroughXray/routeThroughXrayHint i18n
strings across all 13 locales.

The Go-side field stays (see internal/amneziawg's ServerSettings/Instance,
already annotated as vestigial in the previous commit) for backward
compatibility with existing stored settings -- z.object's default
unknown-key stripping means the form simply drops it from an existing
inbound's settings on its next save, no migration needed.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Kuzz007
2026-08-02 20:20:42 +03:00
parent e4fc9d5031
commit 7550072c7b
16 changed files with 10 additions and 39 deletions
@@ -298,7 +298,6 @@ export function createDefaultAmneziawgInboundSettings(): AmneziawgInboundSetting
ipv6Enabled: false,
ipv6Subnet: '',
ipv6ExternalInterface: '',
routeThroughXray: false,
jc: 5,
jmin: 10,
jmax: 50,
@@ -68,14 +68,6 @@ export default function AmneziawgFields({ awgPubKey, regenInboundAwg, regenInbou
>
<Input placeholder="eth0" />
</FormField>
<FormField
name={['settings', 'server', 'routeThroughXray']}
label={t('pages.xray.amneziawg.routeThroughXray')}
extra={t('pages.xray.amneziawg.routeThroughXrayHint')}
valueProp="checked"
>
<Switch />
</FormField>
<Form.Item label={t('pages.xray.amneziawg.obfuscation')}>
<Button icon={<ReloadOutlined />} onClick={regenInboundAwgObfuscation}>
{t('pages.xray.amneziawg.regenerateObfuscation')}
@@ -35,11 +35,18 @@ export const AmneziawgClientSchema = z.object({
export type AmneziawgClient = z.infer<typeof AmneziawgClientSchema>;
// Server-wide AmneziaWG 2.0 obfuscation parameters and tunnel identity,
// mirroring internal/amneziawg.ServerSettings on the Go side exactly (same
// field names) — the listen port is not duplicated here, it's the inbound's
// own port like every other protocol. H1-H4 blank falls back to the classic
// mirroring internal/amneziawg.ServerSettings on the Go side (same field
// names) — the listen port is not duplicated here, it's the inbound's own
// port like every other protocol. H1-H4 blank falls back to the classic
// 1/2/3/4 magic header on save; I1 blank omits the 2.0-only CPS signature
// packet (a 1.x-compatible config).
//
// Deliberately missing routeThroughXray: that field is vestigial on the Go
// side too, as of the hard cutover to the embedded (amneziawg-go) path --
// see ServerSettings' own doc comment. Omitting it here means z.object's
// default unknown-key stripping quietly drops it from an existing stored
// settings blob on the next save, rather than the form round-tripping a
// value nothing reads anymore.
export const AmneziawgServerSchema = z.object({
privateKey: z.string().optional(),
publicKey: z.string().optional(),
@@ -52,7 +59,6 @@ export const AmneziawgServerSchema = z.object({
ipv6Enabled: z.boolean().default(false),
ipv6Subnet: z.string().default(''),
ipv6ExternalInterface: z.string().default(''),
routeThroughXray: z.boolean().default(false),
jc: z.number().int().min(0).default(5),
jmin: z.number().int().min(0).default(10),
jmax: z.number().int().min(0).default(50),