diff --git a/v2rayN/v2rayN/App.xaml b/v2rayN/v2rayN/App.xaml index a5bafb0d..ad8f5d4a 100644 --- a/v2rayN/v2rayN/App.xaml +++ b/v2rayN/v2rayN/App.xaml @@ -1,9 +1,9 @@  diff --git a/v2rayN/v2rayN/Global.cs b/v2rayN/v2rayN/Global.cs index c689e6d2..c23542c8 100644 --- a/v2rayN/v2rayN/Global.cs +++ b/v2rayN/v2rayN/Global.cs @@ -158,6 +158,7 @@ public static readonly List TunMtus = new() { "9000", "1500" }; public static readonly List TunStacks = new() { "gvisor", "system" }; public static readonly List PresetMsgFilters = new() { "proxy", "direct", "block", "" }; + public static readonly List SingboxMuxs = new() { "h2mux", "smux", "yamux", "" }; #endregion const diff --git a/v2rayN/v2rayN/Handler/ConfigHandler.cs b/v2rayN/v2rayN/Handler/ConfigHandler.cs index 1f7e6598..b5eaf3d0 100644 --- a/v2rayN/v2rayN/Handler/ConfigHandler.cs +++ b/v2rayN/v2rayN/Handler/ConfigHandler.cs @@ -191,6 +191,18 @@ namespace v2rayN.Handler config.guiItem.statisticsFreshRate = 1; } + if (config.mux4Sbox == null) + { + config.mux4Sbox = new() + { + protocol = Global.SingboxMuxs[0], + max_connections = 4, + min_streams = 4, + max_streams = 0, + padding = true + }; + } + LazyConfig.Instance.SetConfig(config); return 0; } diff --git a/v2rayN/v2rayN/Handler/CoreConfigSingbox.cs b/v2rayN/v2rayN/Handler/CoreConfigSingbox.cs index 0916cd7b..2b7bb575 100644 --- a/v2rayN/v2rayN/Handler/CoreConfigSingbox.cs +++ b/v2rayN/v2rayN/Handler/CoreConfigSingbox.cs @@ -288,10 +288,11 @@ namespace v2rayN.Handler var mux = new Multiplex4Sbox() { enabled = true, - protocol = "smux", - max_connections = 4, - min_streams = 4, - max_streams = 0, + protocol = _config.mux4Sbox.protocol, + max_connections = _config.mux4Sbox.max_connections, + min_streams = _config.mux4Sbox.min_streams, + max_streams = _config.mux4Sbox.max_streams, + padding = _config.mux4Sbox.padding }; outbound.multiplex = mux; } diff --git a/v2rayN/v2rayN/Handler/CoreHandler.cs b/v2rayN/v2rayN/Handler/CoreHandler.cs index d10e129a..3f9f496a 100644 --- a/v2rayN/v2rayN/Handler/CoreHandler.cs +++ b/v2rayN/v2rayN/Handler/CoreHandler.cs @@ -74,7 +74,7 @@ namespace v2rayN.Handler KillProcess(_process); _process.Dispose(); _process = null; - hasProc =true; + hasProc = true; } if (_processPre != null) diff --git a/v2rayN/v2rayN/Handler/MainFormHandler.cs b/v2rayN/v2rayN/Handler/MainFormHandler.cs index bae28515..4390a6a9 100644 --- a/v2rayN/v2rayN/Handler/MainFormHandler.cs +++ b/v2rayN/v2rayN/Handler/MainFormHandler.cs @@ -208,8 +208,8 @@ namespace v2rayN.Handler { updateHandle.UpdateGeoFileAll(config, (bool success, string msg) => { - update(false, msg); - }); + update(false, msg); + }); autoUpdateGeoTime = dtNow; } } diff --git a/v2rayN/v2rayN/Mode/Config.cs b/v2rayN/v2rayN/Mode/Config.cs index 978508e8..f6639b93 100644 --- a/v2rayN/v2rayN/Mode/Config.cs +++ b/v2rayN/v2rayN/Mode/Config.cs @@ -27,6 +27,7 @@ public UIItem uiItem { get; set; } public ConstItem constItem { get; set; } public SpeedTestItem speedTestItem { get; set; } + public Mux4Sbox mux4Sbox { get; set; } public List inbound { get; set; } public List globalHotkeys { get; set; } public List coreTypeItem { get; set; } diff --git a/v2rayN/v2rayN/Mode/ConfigItems.cs b/v2rayN/v2rayN/Mode/ConfigItems.cs index 4ab9d3ce..59df1309 100644 --- a/v2rayN/v2rayN/Mode/ConfigItems.cs +++ b/v2rayN/v2rayN/Mode/ConfigItems.cs @@ -191,6 +191,7 @@ namespace v2rayN.Mode /// 域名解析策略 /// public string domainStrategy { get; set; } + public string domainStrategy4Singbox { get; set; } public string domainMatcher { get; set; } @@ -205,4 +206,14 @@ namespace v2rayN.Mode public int Width { get; set; } public int Index { get; set; } } + + [Serializable] + public class Mux4Sbox + { + public string protocol { get; set; } + public int max_connections { get; set; } + public int min_streams { get; set; } + public int max_streams { get; set; } + public bool padding { get; set; } + } } \ No newline at end of file diff --git a/v2rayN/v2rayN/Mode/SingboxConfig.cs b/v2rayN/v2rayN/Mode/SingboxConfig.cs index fc8a09df..64e06798 100644 --- a/v2rayN/v2rayN/Mode/SingboxConfig.cs +++ b/v2rayN/v2rayN/Mode/SingboxConfig.cs @@ -127,6 +127,7 @@ public int max_connections { get; set; } public int min_streams { get; set; } public int max_streams { get; set; } + public bool padding { get; set; } } public class Utls4Sbox diff --git a/v2rayN/v2rayN/Resx/ResUI.Designer.cs b/v2rayN/v2rayN/Resx/ResUI.Designer.cs index c09993d2..a40b512b 100644 --- a/v2rayN/v2rayN/Resx/ResUI.Designer.cs +++ b/v2rayN/v2rayN/Resx/ResUI.Designer.cs @@ -2572,6 +2572,15 @@ namespace v2rayN.Resx { } } + /// + /// 查找类似 Singbox Mux Protocol 的本地化字符串。 + /// + public static string TbSettingsMux4SboxProtocol { + get { + return ResourceManager.GetString("TbSettingsMux4SboxProtocol", resourceCulture); + } + } + /// /// 查找类似 Turn on Mux Multiplexing 的本地化字符串。 /// diff --git a/v2rayN/v2rayN/Resx/ResUI.resx b/v2rayN/v2rayN/Resx/ResUI.resx index d4c2f302..42d25a66 100644 --- a/v2rayN/v2rayN/Resx/ResUI.resx +++ b/v2rayN/v2rayN/Resx/ResUI.resx @@ -1129,4 +1129,7 @@ Sing-box domain strategy + + Singbox Mux Protocol + \ No newline at end of file diff --git a/v2rayN/v2rayN/Resx/ResUI.zh-Hans.resx b/v2rayN/v2rayN/Resx/ResUI.zh-Hans.resx index da34e169..778d3cae 100644 --- a/v2rayN/v2rayN/Resx/ResUI.zh-Hans.resx +++ b/v2rayN/v2rayN/Resx/ResUI.zh-Hans.resx @@ -1126,4 +1126,7 @@ Sing-box域名解析策略 + + Singbox Mux 多路复用协议 + \ No newline at end of file diff --git a/v2rayN/v2rayN/ViewModels/OptionSettingViewModel.cs b/v2rayN/v2rayN/ViewModels/OptionSettingViewModel.cs index 3f74de06..2607a847 100644 --- a/v2rayN/v2rayN/ViewModels/OptionSettingViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/OptionSettingViewModel.cs @@ -31,6 +31,7 @@ namespace v2rayN.ViewModels [Reactive] public bool defAllowInsecure { get; set; } [Reactive] public string defFingerprint { get; set; } [Reactive] public string defUserAgent { get; set; } + [Reactive] public string mux4SboxProtocol { get; set; } #endregion Core @@ -131,6 +132,7 @@ namespace v2rayN.ViewModels defAllowInsecure = _config.coreBasicItem.defAllowInsecure; defFingerprint = _config.coreBasicItem.defFingerprint; defUserAgent = _config.coreBasicItem.defUserAgent; + mux4SboxProtocol = _config.mux4Sbox.protocol; #endregion Core @@ -298,6 +300,7 @@ namespace v2rayN.ViewModels _config.coreBasicItem.defAllowInsecure = defAllowInsecure; _config.coreBasicItem.defFingerprint = defFingerprint; _config.coreBasicItem.defUserAgent = defUserAgent; + _config.mux4Sbox.protocol = mux4SboxProtocol; //Kcp //_config.kcpItem.mtu = Kcpmtu; diff --git a/v2rayN/v2rayN/Views/DNSSettingWindow.xaml b/v2rayN/v2rayN/Views/DNSSettingWindow.xaml index c19509ef..5f4caf4b 100644 --- a/v2rayN/v2rayN/Views/DNSSettingWindow.xaml +++ b/v2rayN/v2rayN/Views/DNSSettingWindow.xaml @@ -126,7 +126,6 @@ VerticalScrollBarVisibility="Auto" /> - \ No newline at end of file diff --git a/v2rayN/v2rayN/Views/OptionSettingWindow.xaml b/v2rayN/v2rayN/Views/OptionSettingWindow.xaml index becc1e84..3b568f8b 100644 --- a/v2rayN/v2rayN/Views/OptionSettingWindow.xaml +++ b/v2rayN/v2rayN/Views/OptionSettingWindow.xaml @@ -67,6 +67,7 @@ + @@ -291,6 +292,21 @@ Margin="{StaticResource SettingItemMargin}" Style="{StaticResource ToolbarTextBlock}" Text="{x:Static resx:ResUI.TbSettingsDefUserAgentTips}" /> + + + @@ -790,34 +806,6 @@ - - - - - - - - -