From b6641439d46eccd074cc83abb8ba8e4b2e5586d9 Mon Sep 17 00:00:00 2001 From: MHSanaei Date: Mon, 1 Jun 2026 18:21:37 +0200 Subject: [PATCH] fix(sockopt): rename interfaceName to interface so xray honors it xray-core reads the bind-interface sockopt as json:"interface", but the schema and forms used interfaceName. Go's JSON unmarshal is case-insensitive, yet interfacename != interface, so the value never reached xray and interface binding silently did nothing. Rename the field across the schema, the inbound/outbound forms, and the golden fixture to match xray-core and the official docs. --- frontend/src/pages/inbounds/form/transport/sockopt.tsx | 2 +- frontend/src/pages/xray/outbounds/transport/sockopt.tsx | 2 +- frontend/src/schemas/protocols/stream/sockopt.ts | 2 +- frontend/src/test/__snapshots__/sockopt.test.ts.snap | 8 ++++---- frontend/src/test/golden/fixtures/sockopt/full.json | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/frontend/src/pages/inbounds/form/transport/sockopt.tsx b/frontend/src/pages/inbounds/form/transport/sockopt.tsx index f139f1ee..7adca1f3 100644 --- a/frontend/src/pages/inbounds/form/transport/sockopt.tsx +++ b/frontend/src/pages/inbounds/form/transport/sockopt.tsx @@ -130,7 +130,7 @@ export default function SockoptForm({ diff --git a/frontend/src/pages/xray/outbounds/transport/sockopt.tsx b/frontend/src/pages/xray/outbounds/transport/sockopt.tsx index fc869cdd..9bd885f6 100644 --- a/frontend/src/pages/xray/outbounds/transport/sockopt.tsx +++ b/frontend/src/pages/xray/outbounds/transport/sockopt.tsx @@ -89,7 +89,7 @@ export default function SockoptForm({ form }: { form: FormInstance diff --git a/frontend/src/schemas/protocols/stream/sockopt.ts b/frontend/src/schemas/protocols/stream/sockopt.ts index 1268ab43..7242bc97 100644 --- a/frontend/src/schemas/protocols/stream/sockopt.ts +++ b/frontend/src/schemas/protocols/stream/sockopt.ts @@ -65,7 +65,7 @@ export const SockoptStreamSettingsSchema = z.object({ tcpcongestion: TcpCongestionSchema.default('bbr'), V6Only: z.boolean().default(false), tcpWindowClamp: z.number().int().min(0).default(600), - interfaceName: z.string().default(''), + interface: z.string().default(''), trustedXForwardedFor: z.array(z.string()).default([]), addressPortStrategy: AddressPortStrategySchema.default('none'), happyEyeballs: HappyEyeballsSchema.optional(), diff --git a/frontend/src/test/__snapshots__/sockopt.test.ts.snap b/frontend/src/test/__snapshots__/sockopt.test.ts.snap index 3c83f8e7..1d47990d 100644 --- a/frontend/src/test/__snapshots__/sockopt.test.ts.snap +++ b/frontend/src/test/__snapshots__/sockopt.test.ts.snap @@ -8,7 +8,7 @@ exports[`SockoptStreamSettingsSchema fixtures > parses defaults byte-stably 1`] "customSockopt": [], "dialerProxy": "", "domainStrategy": "AsIs", - "interfaceName": "", + "interface": "", "mark": 0, "penetrate": false, "tcpFastOpen": false, @@ -32,7 +32,7 @@ exports[`SockoptStreamSettingsSchema fixtures > parses full byte-stably 1`] = ` "customSockopt": [], "dialerProxy": "out-proxy-tag", "domainStrategy": "UseIP", - "interfaceName": "eth0", + "interface": "eth0", "mark": 100, "penetrate": false, "tcpFastOpen": true, @@ -59,7 +59,7 @@ exports[`SockoptStreamSettingsSchema fixtures > parses tcp-tuning byte-stably 1` "customSockopt": [], "dialerProxy": "", "domainStrategy": "AsIs", - "interfaceName": "", + "interface": "", "mark": 0, "penetrate": false, "tcpFastOpen": true, @@ -83,7 +83,7 @@ exports[`SockoptStreamSettingsSchema fixtures > parses tproxy byte-stably 1`] = "customSockopt": [], "dialerProxy": "", "domainStrategy": "ForceIPv4", - "interfaceName": "", + "interface": "", "mark": 255, "penetrate": true, "tcpFastOpen": false, diff --git a/frontend/src/test/golden/fixtures/sockopt/full.json b/frontend/src/test/golden/fixtures/sockopt/full.json index a1b3c93a..25b0d451 100644 --- a/frontend/src/test/golden/fixtures/sockopt/full.json +++ b/frontend/src/test/golden/fixtures/sockopt/full.json @@ -14,6 +14,6 @@ "tcpcongestion": "cubic", "V6Only": false, "tcpWindowClamp": 600, - "interfaceName": "eth0", + "interface": "eth0", "trustedXForwardedFor": ["10.0.0.0/8", "192.168.0.0/16"] }