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.
This commit is contained in:
MHSanaei
2026-06-01 10:12:51 +02:00
parent c5ff166056
commit 32f96298f8
9 changed files with 154 additions and 79 deletions
+23 -31
View File
@@ -1465,28 +1465,22 @@ func applyXhttpExtraParams(xhttp map[string]any, params map[string]string) {
}
var kcpMaskToHeaderType = map[string]string{
"header-dns": "dns",
"header-dtls": "dtls",
"header-srtp": "srtp",
"header-utp": "utp",
"header-wechat": "wechat-video",
"header-wireguard": "wireguard",
"dns": "dns",
"dtls": "dtls",
"srtp": "srtp",
"utp": "utp",
"wechat": "wechat-video",
"wireguard": "wireguard",
}
var validFinalMaskUDPTypes = map[string]struct{}{
"salamander": {},
"mkcp-aes128gcm": {},
"header-dns": {},
"header-dtls": {},
"header-srtp": {},
"header-utp": {},
"header-wechat": {},
"header-wireguard": {},
"mkcp-original": {},
"xdns": {},
"xicmp": {},
"noise": {},
"header-custom": {},
"salamander": {},
"mkcp-legacy": {},
"xdns": {},
"xicmp": {},
"noise": {},
"header-custom": {},
"realm": {},
}
var validFinalMaskTCPTypes = map[string]struct{}{
@@ -1557,21 +1551,19 @@ func extractKcpShareFields(stream map[string]any) kcpShareFields {
if mask == nil {
continue
}
maskType, _ := mask["type"].(string)
if mapped, ok := kcpMaskToHeaderType[maskType]; ok {
fields.headerType = mapped
if maskType, _ := mask["type"].(string); maskType != "mkcp-legacy" {
continue
}
switch maskType {
case "mkcp-original":
fields.seed = ""
case "mkcp-aes128gcm":
fields.seed = ""
settings, _ := mask["settings"].(map[string]any)
if value, ok := settings["password"].(string); ok && value != "" {
fields.seed = value
}
settings, _ := mask["settings"].(map[string]any)
header, _ := settings["header"].(string)
value, _ := settings["value"].(string)
if header == "" {
fields.seed = value
continue
}
if mapped, ok := kcpMaskToHeaderType[header]; ok {
fields.headerType = mapped
}
}