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.
This commit is contained in:
MHSanaei 2026-06-01 18:21:37 +02:00
parent d29a17d333
commit b6641439d4
No known key found for this signature in database
GPG key ID: 7E4060F2FBE5AB7A
5 changed files with 8 additions and 8 deletions

View file

@ -130,7 +130,7 @@ export default function SockoptForm({
<Input /> <Input />
</Form.Item> </Form.Item>
<Form.Item <Form.Item
name={['streamSettings', 'sockopt', 'interfaceName']} name={['streamSettings', 'sockopt', 'interface']}
label={t('pages.inbounds.info.interfaceName')} label={t('pages.inbounds.info.interfaceName')}
> >
<Input /> <Input />

View file

@ -89,7 +89,7 @@ export default function SockoptForm({ form }: { form: FormInstance<OutboundFormV
</Form.Item> </Form.Item>
<Form.Item <Form.Item
label={t('pages.xray.outboundForm.interface')} label={t('pages.xray.outboundForm.interface')}
name={['streamSettings', 'sockopt', 'interfaceName']} name={['streamSettings', 'sockopt', 'interface']}
> >
<Input /> <Input />
</Form.Item> </Form.Item>

View file

@ -65,7 +65,7 @@ export const SockoptStreamSettingsSchema = z.object({
tcpcongestion: TcpCongestionSchema.default('bbr'), tcpcongestion: TcpCongestionSchema.default('bbr'),
V6Only: z.boolean().default(false), V6Only: z.boolean().default(false),
tcpWindowClamp: z.number().int().min(0).default(600), tcpWindowClamp: z.number().int().min(0).default(600),
interfaceName: z.string().default(''), interface: z.string().default(''),
trustedXForwardedFor: z.array(z.string()).default([]), trustedXForwardedFor: z.array(z.string()).default([]),
addressPortStrategy: AddressPortStrategySchema.default('none'), addressPortStrategy: AddressPortStrategySchema.default('none'),
happyEyeballs: HappyEyeballsSchema.optional(), happyEyeballs: HappyEyeballsSchema.optional(),

View file

@ -8,7 +8,7 @@ exports[`SockoptStreamSettingsSchema fixtures > parses defaults byte-stably 1`]
"customSockopt": [], "customSockopt": [],
"dialerProxy": "", "dialerProxy": "",
"domainStrategy": "AsIs", "domainStrategy": "AsIs",
"interfaceName": "", "interface": "",
"mark": 0, "mark": 0,
"penetrate": false, "penetrate": false,
"tcpFastOpen": false, "tcpFastOpen": false,
@ -32,7 +32,7 @@ exports[`SockoptStreamSettingsSchema fixtures > parses full byte-stably 1`] = `
"customSockopt": [], "customSockopt": [],
"dialerProxy": "out-proxy-tag", "dialerProxy": "out-proxy-tag",
"domainStrategy": "UseIP", "domainStrategy": "UseIP",
"interfaceName": "eth0", "interface": "eth0",
"mark": 100, "mark": 100,
"penetrate": false, "penetrate": false,
"tcpFastOpen": true, "tcpFastOpen": true,
@ -59,7 +59,7 @@ exports[`SockoptStreamSettingsSchema fixtures > parses tcp-tuning byte-stably 1`
"customSockopt": [], "customSockopt": [],
"dialerProxy": "", "dialerProxy": "",
"domainStrategy": "AsIs", "domainStrategy": "AsIs",
"interfaceName": "", "interface": "",
"mark": 0, "mark": 0,
"penetrate": false, "penetrate": false,
"tcpFastOpen": true, "tcpFastOpen": true,
@ -83,7 +83,7 @@ exports[`SockoptStreamSettingsSchema fixtures > parses tproxy byte-stably 1`] =
"customSockopt": [], "customSockopt": [],
"dialerProxy": "", "dialerProxy": "",
"domainStrategy": "ForceIPv4", "domainStrategy": "ForceIPv4",
"interfaceName": "", "interface": "",
"mark": 255, "mark": 255,
"penetrate": true, "penetrate": true,
"tcpFastOpen": false, "tcpFastOpen": false,

View file

@ -14,6 +14,6 @@
"tcpcongestion": "cubic", "tcpcongestion": "cubic",
"V6Only": false, "V6Only": false,
"tcpWindowClamp": 600, "tcpWindowClamp": 600,
"interfaceName": "eth0", "interface": "eth0",
"trustedXForwardedFor": ["10.0.0.0/8", "192.168.0.0/16"] "trustedXForwardedFor": ["10.0.0.0/8", "192.168.0.0/16"]
} }