mirror of
https://github.com/2dust/v2rayN.git
synced 2026-11-02 18:45:00 +03:00
customizable packet fragmentation settings (#9597)
* first changes * fix: use ItemsSource for fragment packets ComboBox so value saves correctly * feat: add customizable packet fragmentation for Xray-core - Add fragment settings in Core tab: Packets (dropdown), Length (range), Interval (range), MaxSplit (0-10000) - Support both 'from-to' (e.g., 50-100) and single value (e.g., 50) formats for Length, Interval, and MaxSplit - Validation with shortened error message: 'Invalid range format. Use from-to (e.g., 50-100).' - UI in PopupBox (materialDesign) visible only when EnableFragment is checked - Only Xray-core supported (Mihomo/sing-box fragment code removed) - Localization updated for 8 languages * fix: address 2dust review feedback - Move FragmentPacketsOptions to Global class - Remove default values from Fragment4RayItem model (set in ConfigHandler) - Fix Avalonia bindings: move ItemsSource and SelectedItem to code-behind - Update ViewModel to use Global.FragmentPacketsOptions - Remove defaults from model properties * Adjust ui --------- Co-authored-by: 2dust <31833384+2dust@users.noreply.github.com>
This commit is contained in:
@@ -896,9 +896,17 @@ public partial class CoreConfigV2rayService
|
||||
|
||||
private (Mask4Ray tcpFragment, Mask4Ray udpNoise) BuildFragmentsMasks()
|
||||
{
|
||||
var configPackets = _config.Fragment4RayItem?.Packets ?? "tlshello";
|
||||
var configLength = _config.Fragment4RayItem?.Length ?? "50-100";
|
||||
var configDelay = _config.Fragment4RayItem?.Interval ?? "10-20";
|
||||
var configPackets = _config.Fragment4RayItem?.Packets.NullIfEmpty() ?? "tlshello";
|
||||
var configLength = _config.Fragment4RayItem?.Length.NullIfEmpty() ?? "50-100";
|
||||
var configDelay = _config.Fragment4RayItem?.Interval.NullIfEmpty() ?? "10-20";
|
||||
var configMaxSplit = _config.Fragment4RayItem?.MaxSplit.NullIfEmpty() ?? "0";
|
||||
|
||||
var maxSplit = 0;
|
||||
var parts = configMaxSplit.Split('-');
|
||||
if (parts.Length > 0 && int.TryParse(parts[0], out var ms))
|
||||
{
|
||||
maxSplit = ms;
|
||||
}
|
||||
|
||||
var fragmentMask = new Mask4Ray
|
||||
{
|
||||
@@ -908,6 +916,7 @@ public partial class CoreConfigV2rayService
|
||||
packets = configPackets,
|
||||
length = configLength,
|
||||
delay = configDelay,
|
||||
maxSplit = maxSplit,
|
||||
}
|
||||
};
|
||||
var noiseMask = new Mask4Ray
|
||||
|
||||
Reference in New Issue
Block a user