From d93c12b354cdf8a4cb310269eb7fb3b989e22feb Mon Sep 17 00:00:00 2001 From: 2dust <31833384+2dust@users.noreply.github.com> Date: Wed, 8 Jan 2025 13:52:21 +0800 Subject: [PATCH] Add more options to xray fragment --- v2rayN/ServiceLib/Handler/ConfigHandler.cs | 6 ++++++ v2rayN/ServiceLib/Models/Config.cs | 1 + v2rayN/ServiceLib/Models/ConfigItems.cs | 8 ++++++++ .../Services/CoreConfig/CoreConfigV2rayService.cs | 6 +++--- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/v2rayN/ServiceLib/Handler/ConfigHandler.cs b/v2rayN/ServiceLib/Handler/ConfigHandler.cs index a3fa8513c3d..14ed35c83e6 100644 --- a/v2rayN/ServiceLib/Handler/ConfigHandler.cs +++ b/v2rayN/ServiceLib/Handler/ConfigHandler.cs @@ -156,6 +156,12 @@ public class ConfigHandler config.SystemProxyItem ??= new(); config.WebDavItem ??= new(); config.CheckUpdateItem ??= new(); + config.Fragment4RayItem ??= new() + { + Packets = "tlshello", + Length = "100-200", + Interval = "10-20" + }; if (Utils.IsNotEmpty(config.ConstItem.DefIEProxyExceptions)) { diff --git a/v2rayN/ServiceLib/Models/Config.cs b/v2rayN/ServiceLib/Models/Config.cs index c0abe5c2db3..a74f58d64eb 100644 --- a/v2rayN/ServiceLib/Models/Config.cs +++ b/v2rayN/ServiceLib/Models/Config.cs @@ -47,6 +47,7 @@ public bool IsRunningCore(ECoreType type) public SystemProxyItem SystemProxyItem { get; set; } public WebDavItem WebDavItem { get; set; } public CheckUpdateItem CheckUpdateItem { get; set; } + public Fragment4RayItem? Fragment4RayItem { get; set; } public List Inbound { get; set; } public List GlobalHotkeys { get; set; } public List CoreTypeItem { get; set; } diff --git a/v2rayN/ServiceLib/Models/ConfigItems.cs b/v2rayN/ServiceLib/Models/ConfigItems.cs index 9465277eaea..f7642df3001 100644 --- a/v2rayN/ServiceLib/Models/ConfigItems.cs +++ b/v2rayN/ServiceLib/Models/ConfigItems.cs @@ -246,4 +246,12 @@ public class CheckUpdateItem public bool CheckPreReleaseUpdate { get; set; } public List? SelectedCoreTypes { get; set; } } + + [Serializable] + public class Fragment4RayItem + { + public string? Packets { get; set; } + public string? Length { get; set; } + public string? Interval { get; set; } + } } \ No newline at end of file diff --git a/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigV2rayService.cs b/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigV2rayService.cs index 5f3a816e191..7a139a65509 100644 --- a/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigV2rayService.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigV2rayService.cs @@ -1167,9 +1167,9 @@ private async Task GenMoreOutbounds(ProfileItem node, V2rayConfig v2rayConf { fragment = new() { - packets = "tlshello", - length = "100-200", - interval = "10-20" + packets = _config.Fragment4RayItem?.Packets, + length = _config.Fragment4RayItem?.Length, + interval = _config.Fragment4RayItem?.Interval } } };