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
+40
View File
@@ -665,6 +665,46 @@ func TestExtractKcpShareFields_ReadsAllFields(t *testing.T) {
}
}
func TestExtractKcpShareFields_FinalMaskLegacyHeader(t *testing.T) {
stream := map[string]any{
"finalmask": map[string]any{
"udp": []any{
map[string]any{
"type": "mkcp-legacy",
"settings": map[string]any{"header": "wechat", "value": ""},
},
},
},
}
got := extractKcpShareFields(stream)
if got.headerType != "wechat-video" {
t.Fatalf("headerType = %q, want wechat-video", got.headerType)
}
if got.seed != "" {
t.Fatalf("seed = %q, want empty for header mask", got.seed)
}
}
func TestExtractKcpShareFields_FinalMaskLegacySeed(t *testing.T) {
stream := map[string]any{
"finalmask": map[string]any{
"udp": []any{
map[string]any{
"type": "mkcp-legacy",
"settings": map[string]any{"header": "", "value": "obfs-pass"},
},
},
},
}
got := extractKcpShareFields(stream)
if got.headerType != "none" {
t.Fatalf("headerType = %q, want none for empty-header legacy mask", got.headerType)
}
if got.seed != "obfs-pass" {
t.Fatalf("seed = %q, want obfs-pass", got.seed)
}
}
func TestKcpShareFields_ApplyToParams(t *testing.T) {
params := map[string]string{}
kcpShareFields{headerType: "wechat-video", seed: "s", mtu: 1350, tti: 50}.applyToParams(params)