From 32f96298f8debe87bd817ce5c91661a74b4c9aa2 Mon Sep 17 00:00:00 2001 From: MHSanaei Date: Mon, 1 Jun 2026 10:12:51 +0200 Subject: [PATCH] feat(finalmask): sync transport with upstream Xray core changes Consolidate the eight legacy mKCP/header UDP mask types into a single mkcp-legacy type ({header, value}), simplify xicmp to {dgram, ips}, and add the new realm UDP mask type, matching the updated Xray-core wire format. Update the FinalMask schema enum, the transport form, the mKCP seeding default, and the backend KCP share-link translation. Refresh golden fixtures/snapshots and add backend coverage for the mapping. --- .../xray/forms/transport/FinalMaskForm.tsx | 66 ++++++++++++------- .../pages/inbounds/form/InboundFormModal.tsx | 6 +- .../pages/inbounds/list/useInboundColumns.tsx | 2 +- .../src/schemas/protocols/stream/finalmask.ts | 12 +--- .../test/__snapshots__/finalmask.test.ts.snap | 36 +++++++--- .../golden/fixtures/finalmask/combined.json | 2 +- .../golden/fixtures/finalmask/udp-mask.json | 15 +++-- sub/subService.go | 54 +++++++-------- sub/subService_test.go | 40 +++++++++++ 9 files changed, 154 insertions(+), 79 deletions(-) diff --git a/frontend/src/lib/xray/forms/transport/FinalMaskForm.tsx b/frontend/src/lib/xray/forms/transport/FinalMaskForm.tsx index d8973f64..f400620f 100644 --- a/frontend/src/lib/xray/forms/transport/FinalMaskForm.tsx +++ b/frontend/src/lib/xray/forms/transport/FinalMaskForm.tsx @@ -48,14 +48,15 @@ function defaultTcpMaskSettings(type: string): Record { function defaultUdpMaskSettings(type: string): Record { switch (type) { case 'salamander': - case 'mkcp-aes128gcm': return { password: '' }; - case 'header-dns': - return { domain: '' }; + case 'mkcp-legacy': + return { header: '', value: '' }; case 'xdns': return { domains: [] }; case 'xicmp': - return { ip: '0.0.0.0', id: 0 }; + return { dgram: false, ips: [] }; + case 'realm': + return { url: '', stunServers: [] }; case 'header-custom': return { client: [], server: [] }; case 'noise': @@ -344,7 +345,7 @@ function UdpMasksList({ size="small" icon={} onClick={() => { - const def = isHysteria ? 'salamander' : 'mkcp-aes128gcm'; + const def = isHysteria ? 'salamander' : 'mkcp-legacy'; add({ type: def, settings: defaultUdpMaskSettings(def) }); }} /> @@ -391,16 +392,10 @@ function UdpMaskItem({ const options = isHysteria ? [{ value: 'salamander', label: 'Salamander (Hysteria2)' }] : [ - { value: 'mkcp-aes128gcm', label: 'mKCP AES-128-GCM' }, - { value: 'header-dns', label: 'Header DNS' }, - { value: 'header-dtls', label: 'Header DTLS 1.2' }, - { value: 'header-srtp', label: 'Header SRTP' }, - { value: 'header-utp', label: 'Header uTP' }, - { value: 'header-wechat', label: 'Header WeChat Video' }, - { value: 'header-wireguard', label: 'Header WireGuard' }, - { value: 'mkcp-original', label: 'mKCP Original' }, + { value: 'mkcp-legacy', label: 'mKCP Legacy' }, { value: 'xdns', label: 'xDNS' }, { value: 'xicmp', label: 'xICMP' }, + { value: 'realm', label: 'Realm' }, { value: 'header-custom', label: 'Header Custom' }, { value: 'noise', label: 'Noise' }, ]; @@ -422,7 +417,7 @@ function UdpMaskItem({ > {({ getFieldValue }) => { const type = getFieldValue([...absolutePath, 'type']) as string | undefined; - if (type === 'mkcp-aes128gcm' || type === 'salamander') { + if (type === 'salamander') { return ( @@ -440,11 +435,26 @@ function UdpMaskItem({ ); } - if (type === 'header-dns') { + if (type === 'mkcp-legacy') { return ( - - - + <> + + + + ); } if (type === 'xdns') { @@ -457,11 +467,23 @@ function UdpMaskItem({ if (type === 'xicmp') { return ( <> - - + + - - + + + + +