From abcdd9497c02ab0960f3c98cc606e3d5b3d897b1 Mon Sep 17 00:00:00 2001 From: DHR60 Date: Fri, 5 Jun 2026 07:08:57 +0000 Subject: [PATCH] Support new kcp config (#9477) --- v2rayN/ServiceLib/Global.cs | 12 ++++++------ v2rayN/ServiceLib/Models/CoreConfigs/V2rayConfig.cs | 4 +++- .../CoreConfig/V2ray/V2rayOutboundService.cs | 10 +++++----- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/v2rayN/ServiceLib/Global.cs b/v2rayN/ServiceLib/Global.cs index cadd0c53..0a35f774 100644 --- a/v2rayN/ServiceLib/Global.cs +++ b/v2rayN/ServiceLib/Global.cs @@ -330,12 +330,12 @@ public class Global public static readonly Dictionary KcpHeaderMaskMap = new() { - { "srtp", "header-srtp" }, - { "utp", "header-utp" }, - { "wechat-video", "header-wechat" }, - { "dtls", "header-dtls" }, - { "wireguard", "header-wireguard" }, - { "dns", "header-dns" } + { "srtp", "srtp" }, + { "utp", "utp" }, + { "wechat-video", "wechat" }, + { "dtls", "dtls" }, + { "wireguard", "wireguard" }, + { "dns", "dns" } }; public static readonly List CoreTypes = diff --git a/v2rayN/ServiceLib/Models/CoreConfigs/V2rayConfig.cs b/v2rayN/ServiceLib/Models/CoreConfigs/V2rayConfig.cs index c2dd39fe..52cab623 100644 --- a/v2rayN/ServiceLib/Models/CoreConfigs/V2rayConfig.cs +++ b/v2rayN/ServiceLib/Models/CoreConfigs/V2rayConfig.cs @@ -501,8 +501,10 @@ public class Mask4Ray public class MaskSettings4Ray { + public string? header { get; set; } + public string? value { get; set; } + public string? password { get; set; } - public string? domain { get; set; } // fragment public string? packets { get; set; } diff --git a/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayOutboundService.cs b/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayOutboundService.cs index beb0aa5b..d558f22f 100644 --- a/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayOutboundService.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayOutboundService.cs @@ -465,8 +465,8 @@ public partial class CoreConfigV2rayService [ new Mask4Ray { - type = header, - settings = null + type = "mkcp-legacy", + settings = new MaskSettings4Ray { header = header }, } ]; } @@ -475,15 +475,15 @@ public partial class CoreConfigV2rayService { kcpFinalmask.udp.Add(new Mask4Ray { - type = "mkcp-original" + type = "mkcp-legacy", }); } else { kcpFinalmask.udp.Add(new Mask4Ray { - type = "mkcp-aes128gcm", - settings = new MaskSettings4Ray { password = kcpSeed } + type = "mkcp-legacy", + settings = new MaskSettings4Ray { value = kcpSeed }, }); } streamSettings.kcpSettings = kcpSettings;