diff --git a/v2rayN/ServiceLib/Handler/ConfigHandler.cs b/v2rayN/ServiceLib/Handler/ConfigHandler.cs index 78229e6c..55c66fc1 100644 --- a/v2rayN/ServiceLib/Handler/ConfigHandler.cs +++ b/v2rayN/ServiceLib/Handler/ConfigHandler.cs @@ -77,10 +77,11 @@ public static class ConfigHandler Tti = 50, UplinkCapacity = 12, DownlinkCapacity = 100, - ReadBufferSize = 2, - WriteBufferSize = 2, - Congestion = false + CwndMultiplier = 1, + MaxSendingWindow = 2 * 1024 * 1024, }; + config.KcpItem.CwndMultiplier = config.KcpItem.CwndMultiplier <= 0 ? 1 : config.KcpItem.CwndMultiplier; + config.KcpItem.MaxSendingWindow = config.KcpItem.MaxSendingWindow <= 0 ? (2 * 1024 * 1024) : config.KcpItem.MaxSendingWindow; config.GrpcItem ??= new GrpcItem { IdleTimeout = 60, diff --git a/v2rayN/ServiceLib/Models/ConfigItems.cs b/v2rayN/ServiceLib/Models/ConfigItems.cs index fa766f0d..438e700f 100644 --- a/v2rayN/ServiceLib/Models/ConfigItems.cs +++ b/v2rayN/ServiceLib/Models/ConfigItems.cs @@ -49,11 +49,9 @@ public class KcpItem public int DownlinkCapacity { get; set; } - public bool Congestion { get; set; } + public int CwndMultiplier { get; set; } - public int ReadBufferSize { get; set; } - - public int WriteBufferSize { get; set; } + public int MaxSendingWindow { get; set; } } [Serializable] diff --git a/v2rayN/ServiceLib/Models/V2rayConfig.cs b/v2rayN/ServiceLib/Models/V2rayConfig.cs index 1bde2dc2..eeed86cf 100644 --- a/v2rayN/ServiceLib/Models/V2rayConfig.cs +++ b/v2rayN/ServiceLib/Models/V2rayConfig.cs @@ -397,11 +397,9 @@ public class KcpSettings4Ray public int downlinkCapacity { get; set; } - public bool congestion { get; set; } + public int cwndMultiplier { get; set; } - public int readBufferSize { get; set; } - - public int writeBufferSize { get; set; } + public int maxSendingWindow { get; set; } } public class WsSettings4Ray diff --git a/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayOutboundService.cs b/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayOutboundService.cs index b04f777f..264dab59 100644 --- a/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayOutboundService.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayOutboundService.cs @@ -432,9 +432,8 @@ public partial class CoreConfigV2rayService kcpSettings.uplinkCapacity = _config.KcpItem.UplinkCapacity; kcpSettings.downlinkCapacity = _config.KcpItem.DownlinkCapacity; - kcpSettings.congestion = _config.KcpItem.Congestion; - kcpSettings.readBufferSize = _config.KcpItem.ReadBufferSize; - kcpSettings.writeBufferSize = _config.KcpItem.WriteBufferSize; + kcpSettings.cwndMultiplier = _config.KcpItem.CwndMultiplier; + kcpSettings.maxSendingWindow = _config.KcpItem.MaxSendingWindow; var kcpFinalmask = new Finalmask4Ray(); if (Global.KcpHeaderMaskMap.TryGetValue(_node.HeaderType, out var header)) {