From 0d5169e4cdcde601a2c57f85cac464c06148a713 Mon Sep 17 00:00:00 2001 From: DHR60 Date: Fri, 5 Jun 2026 07:31:23 +0000 Subject: [PATCH] Remove global AllowInsecure and MuxEnabled (#9473) * Remove global AllowInsecure * Remove global MuxEnabled * Fix core config * Centralize AllowInsecure handling * Warn insecure configuration --------- Co-authored-by: 2dust <31833384+2dust@users.noreply.github.com> --- .../CoreConfig/CoreConfigTestFactory.cs | 2 +- v2rayN/ServiceLib/Global.cs | 9 +- .../Handler/Builder/NodeValidator.cs | 86 ++++++++++++------- v2rayN/ServiceLib/Handler/ConfigHandler.cs | 7 +- v2rayN/ServiceLib/Handler/Fmt/BaseFmt.cs | 6 +- v2rayN/ServiceLib/Handler/Fmt/VmessFmt.cs | 4 +- .../ServiceLib/Models/Configs/ConfigItems.cs | 4 - .../ServiceLib/Models/Entities/ProfileItem.cs | 5 ++ v2rayN/ServiceLib/Resx/ResUI.Designer.cs | 9 ++ v2rayN/ServiceLib/Resx/ResUI.resx | 3 + v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx | 3 + .../Singbox/SingboxOutboundService.cs | 15 ++-- .../CoreConfig/V2ray/V2rayOutboundService.cs | 4 +- .../ViewModels/AddServerViewModel.cs | 16 +++- .../ViewModels/OptionSettingViewModel.cs | 6 -- .../Views/AddServerWindow.axaml | 8 +- .../Views/AddServerWindow.axaml.cs | 13 ++- .../Views/OptionSettingWindow.axaml | 26 ------ .../Views/OptionSettingWindow.axaml.cs | 2 - v2rayN/v2rayN/Views/AddServerWindow.xaml | 7 +- v2rayN/v2rayN/Views/AddServerWindow.xaml.cs | 13 ++- v2rayN/v2rayN/Views/OptionSettingWindow.xaml | 28 ------ .../v2rayN/Views/OptionSettingWindow.xaml.cs | 2 - 23 files changed, 127 insertions(+), 151 deletions(-) diff --git a/v2rayN/ServiceLib.Tests/CoreConfig/CoreConfigTestFactory.cs b/v2rayN/ServiceLib.Tests/CoreConfig/CoreConfigTestFactory.cs index 63bc45ca..91fb5c6a 100644 --- a/v2rayN/ServiceLib.Tests/CoreConfig/CoreConfigTestFactory.cs +++ b/v2rayN/ServiceLib.Tests/CoreConfig/CoreConfigTestFactory.cs @@ -17,7 +17,7 @@ internal static class CoreConfigTestFactory { return new Config { - CoreBasicItem = new CoreBasicItem { Loglevel = "warning", MuxEnabled = false }, + CoreBasicItem = new CoreBasicItem { Loglevel = "warning" }, TunModeItem = new TunModeItem { EnableTun = false, IcmpRouting = "default" }, KcpItem = new KcpItem(), GrpcItem = new GrpcItem(), diff --git a/v2rayN/ServiceLib/Global.cs b/v2rayN/ServiceLib/Global.cs index 0a35f774..c5386097 100644 --- a/v2rayN/ServiceLib/Global.cs +++ b/v2rayN/ServiceLib/Global.cs @@ -90,6 +90,8 @@ public class Global public const string XrayLocalCert = "XRAY_LOCATION_CERT"; public const int SpeedTestPageSize = 1000; public const string LinuxBash = "/bin/bash"; + public const string StringTrue = "true"; + public const string StringFalse = "false"; public const string SingboxDirectDNSTag = "direct_dns"; public const string SingboxRemoteDNSTag = "remote_dns"; @@ -421,13 +423,6 @@ public class Global "stream-one" ]; - public static readonly List AllowInsecure = - [ - "true", - "false", - "" - ]; - public static readonly List DomainStrategy = [ "AsIs", diff --git a/v2rayN/ServiceLib/Handler/Builder/NodeValidator.cs b/v2rayN/ServiceLib/Handler/Builder/NodeValidator.cs index 2b819940..9665144d 100644 --- a/v2rayN/ServiceLib/Handler/Builder/NodeValidator.cs +++ b/v2rayN/ServiceLib/Handler/Builder/NodeValidator.cs @@ -29,35 +29,6 @@ public class NodeValidator return v.ToResult(); } - private class ValidationContext - { - public List Errors { get; } = []; - public List Warnings { get; } = []; - - public void Error(string message) - { - Errors.Add(message); - } - - public void Warning(string message) - { - Warnings.Add(message); - } - - public void Assert(bool condition, string errorMsg) - { - if (!condition) - { - Error(errorMsg); - } - } - - public NodeValidatorResult ToResult() - { - return new NodeValidatorResult(Errors, Warnings); - } - } - private static void ValidateNodeAndCoreSupport(ProfileItem item, ECoreType coreType, ValidationContext v) { if (item.ConfigType is EConfigType.Custom) @@ -126,6 +97,21 @@ public class NodeValidator break; } + if (coreType is ECoreType.Xray + && (protocolExtra.Flow ?? string.Empty).StartsWith("xtls", StringComparison.OrdinalIgnoreCase) + && item.MuxEnabled == true) + { + v.Warning(string.Format(ResUI.MsgOptionsConflict, "XTLS", "Mux.Cool")); + } + + if (item.GetNetwork() is nameof(ETransport.ws) + && item.EchConfigList.IsNullOrEmpty() + && item.GetAlpn()?.FirstOrDefault() == "h3") + { + v.Warning( + "WebSocket but ALPN is set to h3, the core may ignore the ALPN setting or cause unexpected issues."); + } + // TLS & Security if (item.StreamSecurity == Global.StreamSecurity) { @@ -136,12 +122,23 @@ public class NodeValidator } // Check for deprecated allowInsecure property when TLS is enabled - if (item.AllowInsecure == "true" + if (item.GetAllowInsecure() && item.Cert.IsNullOrEmpty() && item.CertSha.IsNullOrEmpty()) { v.Warning(ResUI.MsgAllowInsecureDeprecated); } + + if ((coreType == ECoreType.Xray + && item.GetAllowInsecure() + && item.Cert.IsNullOrEmpty() + && item.CertSha.IsNullOrEmpty()) + || (coreType == ECoreType.sing_box + && item.GetAllowInsecure() + && item.Cert.IsNullOrEmpty())) + { + v.Warning("Insecure configuration detected: AllowInsecure is enabled but no certificate is provided. This may cause MITM attacks."); + } } if (item.StreamSecurity == Global.StreamSecurityReality) @@ -191,4 +188,33 @@ public class NodeValidator return null; } + + private class ValidationContext + { + public List Errors { get; } = []; + public List Warnings { get; } = []; + + public void Error(string message) + { + Errors.Add(message); + } + + public void Warning(string message) + { + Warnings.Add(message); + } + + public void Assert(bool condition, string errorMsg) + { + if (!condition) + { + Error(errorMsg); + } + } + + public NodeValidatorResult ToResult() + { + return new NodeValidatorResult(Errors, Warnings); + } + } } diff --git a/v2rayN/ServiceLib/Handler/ConfigHandler.cs b/v2rayN/ServiceLib/Handler/ConfigHandler.cs index 22fe0ab2..23286f30 100644 --- a/v2rayN/ServiceLib/Handler/ConfigHandler.cs +++ b/v2rayN/ServiceLib/Handler/ConfigHandler.cs @@ -39,7 +39,6 @@ public static class ConfigHandler { LogEnabled = false, Loglevel = "warning", - MuxEnabled = false, }; if (config.Inbound == null) @@ -875,7 +874,7 @@ public static class ConfigHandler profileItem.Fingerprint = string.Empty; profileItem.Alpn = string.Empty; profileItem.Network = string.Empty; - profileItem.AllowInsecure = "false"; + profileItem.AllowInsecure = string.Empty; if (profileItem.StreamSecurity.IsNullOrEmpty()) { profileItem.StreamSecurity = Global.StreamSecurity; @@ -1107,10 +1106,6 @@ public static class ConfigHandler } else { - if (profileItem.AllowInsecure.IsNullOrEmpty()) - { - profileItem.AllowInsecure = config.CoreBasicItem.DefAllowInsecure.ToString().ToLower(); - } if (profileItem.Fingerprint.IsNullOrEmpty() && profileItem.StreamSecurity == Global.StreamSecurityReality) { profileItem.Fingerprint = config.CoreBasicItem.DefFingerprint; diff --git a/v2rayN/ServiceLib/Handler/Fmt/BaseFmt.cs b/v2rayN/ServiceLib/Handler/Fmt/BaseFmt.cs index 0f822427..1427581e 100644 --- a/v2rayN/ServiceLib/Handler/Fmt/BaseFmt.cs +++ b/v2rayN/ServiceLib/Handler/Fmt/BaseFmt.cs @@ -203,7 +203,7 @@ public class BaseFmt private static int ToUriQueryAllowInsecure(ProfileItem item, ref Dictionary dicQuery) { - if (item.AllowInsecure.Equals(Global.AllowInsecure.First())) + if (item.GetAllowInsecure()) { // Add two for compatibility dicQuery.Add("insecure", "1"); @@ -254,11 +254,11 @@ public class BaseFmt if (_allowInsecureArray.Any(k => GetQueryDecoded(query, k) == "1")) { - item.AllowInsecure = Global.AllowInsecure.First(); + item.AllowInsecure = Global.StringTrue; } else if (_allowInsecureArray.Any(k => GetQueryDecoded(query, k) == "0")) { - item.AllowInsecure = Global.AllowInsecure.Skip(1).First(); + item.AllowInsecure = Global.StringFalse; } else { diff --git a/v2rayN/ServiceLib/Handler/Fmt/VmessFmt.cs b/v2rayN/ServiceLib/Handler/Fmt/VmessFmt.cs index 7abe08a8..95e1e152 100644 --- a/v2rayN/ServiceLib/Handler/Fmt/VmessFmt.cs +++ b/v2rayN/ServiceLib/Handler/Fmt/VmessFmt.cs @@ -66,7 +66,7 @@ public class VmessFmt : BaseFmt sni = item.Sni, alpn = item.Alpn, fp = item.Fingerprint, - insecure = item.AllowInsecure.Equals(Global.AllowInsecure.First()) ? "1" : "0" + insecure = item.GetAllowInsecure() ? "1" : "0" }; var url = JsonUtils.Serialize(vmessQRCode); @@ -140,7 +140,7 @@ public class VmessFmt : BaseFmt item.Sni = Utils.ToString(vmessQRCode.sni); item.Alpn = Utils.ToString(vmessQRCode.alpn); item.Fingerprint = Utils.ToString(vmessQRCode.fp); - item.AllowInsecure = vmessQRCode.insecure == "1" ? Global.AllowInsecure.First() : string.Empty; + item.AllowInsecure = vmessQRCode.insecure == "1" ? Global.StringTrue : string.Empty; return item; } diff --git a/v2rayN/ServiceLib/Models/Configs/ConfigItems.cs b/v2rayN/ServiceLib/Models/Configs/ConfigItems.cs index e3026184..7a0f2d87 100644 --- a/v2rayN/ServiceLib/Models/Configs/ConfigItems.cs +++ b/v2rayN/ServiceLib/Models/Configs/ConfigItems.cs @@ -7,10 +7,6 @@ public class CoreBasicItem public string Loglevel { get; set; } - public bool MuxEnabled { get; set; } - - public bool DefAllowInsecure { get; set; } - public string DefFingerprint { get; set; } public string DefUserAgent { get; set; } diff --git a/v2rayN/ServiceLib/Models/Entities/ProfileItem.cs b/v2rayN/ServiceLib/Models/Entities/ProfileItem.cs index 94dd3a69..5daca988 100644 --- a/v2rayN/ServiceLib/Models/Entities/ProfileItem.cs +++ b/v2rayN/ServiceLib/Models/Entities/ProfileItem.cs @@ -146,6 +146,11 @@ public class ProfileItem TransportExtra = JsonUtils.Serialize(transportExtra, false); } + public bool GetAllowInsecure() + { + return AllowInsecure == Global.StringTrue; + } + #endregion function [PrimaryKey] diff --git a/v2rayN/ServiceLib/Resx/ResUI.Designer.cs b/v2rayN/ServiceLib/Resx/ResUI.Designer.cs index b7cf06da..6880de14 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.Designer.cs +++ b/v2rayN/ServiceLib/Resx/ResUI.Designer.cs @@ -2112,6 +2112,15 @@ namespace ServiceLib.Resx { } } + /// + /// 查找类似 Conflict between {0} and {1} 的本地化字符串。 + /// + public static string MsgOptionsConflict { + get { + return ResourceManager.GetString("MsgOptionsConflict", resourceCulture); + } + } + /// /// 查找类似 Resolved {0} successfully 的本地化字符串。 /// diff --git a/v2rayN/ServiceLib/Resx/ResUI.resx b/v2rayN/ServiceLib/Resx/ResUI.resx index ec97d10a..f049ef98 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.resx @@ -1761,4 +1761,7 @@ The "Get Certificate" action may fail if a self-signed certificate is used or if Invalid address in TUN route exclude list: {0} + + Conflict between {0} and {1} + \ No newline at end of file diff --git a/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx b/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx index 4654b723..28337430 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx @@ -1758,4 +1758,7 @@ TUN 路由排除列表包含无效地址:{0} + + {0} 与 {1} 冲突 + \ No newline at end of file diff --git a/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxOutboundService.cs b/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxOutboundService.cs index 8d36b353..31c02a81 100644 --- a/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxOutboundService.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxOutboundService.cs @@ -190,15 +190,16 @@ public partial class CoreConfigSingboxService outbound.packet_encoding = "xudp"; - if (!protocolExtra.Flow.IsNullOrEmpty()) + if (protocolExtra.Flow is "xtls-rprx-vision" or "xtls-rprx-vision-udp443") + { + outbound.flow = "xtls-rprx-vision"; + } + else if (!protocolExtra.Flow.IsNullOrEmpty()) { outbound.flow = protocolExtra.Flow; } - else - { - FillOutboundMux(outbound); - } + FillOutboundMux(outbound); FillOutboundTransport(outbound); break; } @@ -342,7 +343,7 @@ public partial class CoreConfigSingboxService { try { - var muxEnabled = _node.MuxEnabled ?? _config.CoreBasicItem.MuxEnabled; + var muxEnabled = _node.MuxEnabled ?? false; if (muxEnabled && _config.Mux4SboxItem.Protocol.IsNotEmpty()) { var mux = new Multiplex4Sbox() @@ -396,7 +397,7 @@ public partial class CoreConfigSingboxService enabled = true, record_fragment = _config.CoreBasicItem.EnableFragment ? true : null, server_name = serverName, - insecure = Utils.ToBool(_node.AllowInsecure.IsNullOrEmpty() ? _config.CoreBasicItem.DefAllowInsecure.ToString().ToLower() : _node.AllowInsecure), + insecure = _node.GetAllowInsecure(), alpn = _node.GetAlpn(), }; if (_node.Fingerprint.IsNotEmpty()) diff --git a/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayOutboundService.cs b/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayOutboundService.cs index d558f22f..458b86bb 100644 --- a/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayOutboundService.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayOutboundService.cs @@ -62,7 +62,7 @@ public partial class CoreConfigV2rayService try { var protocolExtra = _node.GetProtocolExtra(); - var muxEnabled = _node.MuxEnabled ?? _config.CoreBasicItem.MuxEnabled; + var muxEnabled = _node.MuxEnabled ?? false; switch (_node.ConfigType) { case EConfigType.VMess: @@ -380,7 +380,7 @@ public partial class CoreConfigV2rayService TlsSettings4Ray tlsSettings = new() { - allowInsecure = Utils.ToBool(_node.AllowInsecure.IsNullOrEmpty() ? _config.CoreBasicItem.DefAllowInsecure.ToString().ToLower() : _node.AllowInsecure), + allowInsecure = _node.GetAllowInsecure(), alpn = _node.GetAlpn(), fingerprint = _node.Fingerprint.IsNullOrEmpty() ? _config.CoreBasicItem.DefFingerprint : _node.Fingerprint, echConfigList = _node.EchConfigList.NullIfEmpty(), diff --git a/v2rayN/ServiceLib/ViewModels/AddServerViewModel.cs b/v2rayN/ServiceLib/ViewModels/AddServerViewModel.cs index f5906f21..d25f5b5f 100644 --- a/v2rayN/ServiceLib/ViewModels/AddServerViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/AddServerViewModel.cs @@ -8,6 +8,12 @@ public class AddServerViewModel : MyReactiveObject [Reactive] public string? CoreType { get; set; } + [Reactive] + public bool AllowInsecure { get; set; } + + [Reactive] + public bool MuxEnabled { get; set; } + [Reactive] public string Cert { get; set; } @@ -273,8 +279,10 @@ public class AddServerViewModel : MyReactiveObject SelectedSource = JsonUtils.DeepCopy(profileItem); } CoreType = SelectedSource?.CoreType?.ToString(); - Cert = SelectedSource?.Cert?.ToString() ?? string.Empty; - CertSha = SelectedSource?.CertSha?.ToString() ?? string.Empty; + AllowInsecure = SelectedSource?.GetAllowInsecure() == true; + MuxEnabled = SelectedSource?.MuxEnabled == true; + Cert = SelectedSource?.Cert ?? string.Empty; + CertSha = SelectedSource?.CertSha ?? string.Empty; var protocolExtra = SelectedSource?.GetProtocolExtra() ?? new(); var transport = SelectedSource?.GetTransportExtra() ?? new(); @@ -352,7 +360,9 @@ public class AddServerViewModel : MyReactiveObject return; } } - SelectedSource.CoreType = CoreType.IsNullOrEmpty() ? null : (ECoreType)Enum.Parse(typeof(ECoreType), CoreType); + SelectedSource.CoreType = CoreType.IsNullOrEmpty() ? null : Enum.Parse(CoreType); + SelectedSource.AllowInsecure = AllowInsecure ? Global.StringTrue : Global.StringFalse; + SelectedSource.MuxEnabled = MuxEnabled; SelectedSource.Cert = Cert.IsNullOrEmpty() ? string.Empty : Cert; SelectedSource.CertSha = CertSha.IsNullOrEmpty() ? string.Empty : CertSha; if (!Global.Networks.Contains(SelectedSource.Network)) diff --git a/v2rayN/ServiceLib/ViewModels/OptionSettingViewModel.cs b/v2rayN/ServiceLib/ViewModels/OptionSettingViewModel.cs index 583502c8..85af3d02 100644 --- a/v2rayN/ServiceLib/ViewModels/OptionSettingViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/OptionSettingViewModel.cs @@ -14,10 +14,8 @@ public class OptionSettingViewModel : MyReactiveObject [Reactive] public bool NewPort4LAN { get; set; } [Reactive] public string User { get; set; } [Reactive] public string Pass { get; set; } - [Reactive] public bool MuxEnabled { get; set; } [Reactive] public bool LogEnabled { get; set; } [Reactive] public string Loglevel { get; set; } - [Reactive] public bool DefAllowInsecure { get; set; } [Reactive] public string DefFingerprint { get; set; } [Reactive] public string DefUserAgent { get; set; } [Reactive] public string SendThrough { get; set; } @@ -152,10 +150,8 @@ public class OptionSettingViewModel : MyReactiveObject NewPort4LAN = inbound.NewPort4LAN; User = inbound.User; Pass = inbound.Pass; - MuxEnabled = _config.CoreBasicItem.MuxEnabled; LogEnabled = _config.CoreBasicItem.LogEnabled; Loglevel = _config.CoreBasicItem.Loglevel; - DefAllowInsecure = _config.CoreBasicItem.DefAllowInsecure; DefFingerprint = _config.CoreBasicItem.DefFingerprint; DefUserAgent = _config.CoreBasicItem.DefUserAgent; SendThrough = _config.CoreBasicItem.SendThrough ?? string.Empty; @@ -346,8 +342,6 @@ public class OptionSettingViewModel : MyReactiveObject } _config.CoreBasicItem.LogEnabled = LogEnabled; _config.CoreBasicItem.Loglevel = Loglevel; - _config.CoreBasicItem.MuxEnabled = MuxEnabled; - _config.CoreBasicItem.DefAllowInsecure = DefAllowInsecure; _config.CoreBasicItem.DefFingerprint = DefFingerprint; _config.CoreBasicItem.DefUserAgent = DefUserAgent; _config.CoreBasicItem.SendThrough = SendThrough.TrimEx(); diff --git a/v2rayN/v2rayN.Desktop/Views/AddServerWindow.axaml b/v2rayN/v2rayN.Desktop/Views/AddServerWindow.axaml index 574d4716..35260183 100644 --- a/v2rayN/v2rayN.Desktop/Views/AddServerWindow.axaml +++ b/v2rayN/v2rayN.Desktop/Views/AddServerWindow.axaml @@ -1108,12 +1108,12 @@ Margin="{StaticResource Margin4}" VerticalAlignment="Center" Text="{x:Static resx:ResUI.TbAllowInsecure}" /> - + Margin="{StaticResource Margin4}" + HorizontalAlignment="Left" /> cmbFingerprint.ItemsSource = Global.Fingerprints; cmbFingerprint2.ItemsSource = Global.Fingerprints; - cmbAllowInsecure.ItemsSource = Global.AllowInsecure; cmbAlpn.ItemsSource = Global.Alpns; var lstStreamSecurity = new List { string.Empty, Global.StreamSecurity }; @@ -116,7 +115,7 @@ public partial class AddServerWindow : WindowBase gridFinalmask.IsVisible = false; cmbFingerprint.IsEnabled = false; cmbAlpn.IsEnabled = false; - cmbAllowInsecure.IsEnabled = false; + togAllowInsecure.IsEnabled = false; cmbCongestionControl12.ItemsSource = Global.NaiveCongestionControls; break; @@ -138,14 +137,14 @@ public partial class AddServerWindow : WindowBase this.Bind(ViewModel, vm => vm.SelectedSource.Password, v => v.txtId.Text).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.AlterId, v => v.txtAlterId.Text).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.VmessSecurity, v => v.cmbSecurity.SelectedValue).DisposeWith(disposables); - this.Bind(ViewModel, vm => vm.SelectedSource.MuxEnabled, v => v.togmuxEnabled.IsChecked).DisposeWith(disposables); + this.Bind(ViewModel, vm => vm.MuxEnabled, v => v.togmuxEnabled.IsChecked).DisposeWith(disposables); break; case EConfigType.Shadowsocks: this.Bind(ViewModel, vm => vm.SelectedSource.Password, v => v.txtId3.Text).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.SsMethod, v => v.cmbSecurity3.SelectedValue).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.Uot, v => v.togUotEnabled3.IsChecked).DisposeWith(disposables); - this.Bind(ViewModel, vm => vm.SelectedSource.MuxEnabled, v => v.togmuxEnabled3.IsChecked).DisposeWith(disposables); + this.Bind(ViewModel, vm => vm.MuxEnabled, v => v.togmuxEnabled3.IsChecked).DisposeWith(disposables); break; case EConfigType.SOCKS: @@ -158,13 +157,13 @@ public partial class AddServerWindow : WindowBase this.Bind(ViewModel, vm => vm.SelectedSource.Password, v => v.txtId5.Text).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.Flow, v => v.cmbFlow5.SelectedValue).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.VlessEncryption, v => v.txtSecurity5.Text).DisposeWith(disposables); - this.Bind(ViewModel, vm => vm.SelectedSource.MuxEnabled, v => v.togmuxEnabled5.IsChecked).DisposeWith(disposables); + this.Bind(ViewModel, vm => vm.MuxEnabled, v => v.togmuxEnabled5.IsChecked).DisposeWith(disposables); break; case EConfigType.Trojan: this.Bind(ViewModel, vm => vm.SelectedSource.Password, v => v.txtId6.Text).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.Flow, v => v.cmbFlow6.SelectedValue).DisposeWith(disposables); - this.Bind(ViewModel, vm => vm.SelectedSource.MuxEnabled, v => v.togmuxEnabled6.IsChecked).DisposeWith(disposables); + this.Bind(ViewModel, vm => vm.MuxEnabled, v => v.togmuxEnabled6.IsChecked).DisposeWith(disposables); break; case EConfigType.Hysteria2: @@ -231,7 +230,7 @@ public partial class AddServerWindow : WindowBase this.Bind(ViewModel, vm => vm.SelectedSource.StreamSecurity, v => v.cmbStreamSecurity.SelectedValue).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.SelectedSource.Sni, v => v.txtSNI.Text).DisposeWith(disposables); - this.Bind(ViewModel, vm => vm.SelectedSource.AllowInsecure, v => v.cmbAllowInsecure.SelectedValue).DisposeWith(disposables); + this.Bind(ViewModel, vm => vm.AllowInsecure, v => v.togAllowInsecure.IsChecked).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.SelectedSource.Fingerprint, v => v.cmbFingerprint.SelectedValue).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.SelectedSource.Alpn, v => v.cmbAlpn.SelectedValue).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.CertSha, v => v.txtCertSha256Pinning.Text).DisposeWith(disposables); diff --git a/v2rayN/v2rayN.Desktop/Views/OptionSettingWindow.axaml b/v2rayN/v2rayN.Desktop/Views/OptionSettingWindow.axaml index 2038c702..aa187d47 100644 --- a/v2rayN/v2rayN.Desktop/Views/OptionSettingWindow.axaml +++ b/v2rayN/v2rayN.Desktop/Views/OptionSettingWindow.axaml @@ -180,19 +180,6 @@ Width="200" Margin="{StaticResource Margin4}" /> - - - - - - this.Bind(ViewModel, vm => vm.NewPort4LAN, v => v.txtpass.IsEnabled).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.User, v => v.txtuser.Text).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.Pass, v => v.txtpass.Text).DisposeWith(disposables); - this.Bind(ViewModel, vm => vm.MuxEnabled, v => v.togmuxEnabled.IsChecked).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.LogEnabled, v => v.toglogEnabled.IsChecked).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.Loglevel, v => v.cmbloglevel.SelectedValue).DisposeWith(disposables); - this.Bind(ViewModel, vm => vm.DefAllowInsecure, v => v.togdefAllowInsecure.IsChecked).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.DefFingerprint, v => v.cmbdefFingerprint.SelectedValue).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.DefUserAgent, v => v.cmbdefUserAgent.SelectedValue).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.BindInterface, v => v.txtbindInterface.Text).DisposeWith(disposables); diff --git a/v2rayN/v2rayN/Views/AddServerWindow.xaml b/v2rayN/v2rayN/Views/AddServerWindow.xaml index 4a8ef291..b42138bf 100644 --- a/v2rayN/v2rayN/Views/AddServerWindow.xaml +++ b/v2rayN/v2rayN/Views/AddServerWindow.xaml @@ -1438,13 +1438,12 @@ VerticalAlignment="Center" Style="{StaticResource ToolbarTextBlock}" Text="{x:Static resx:ResUI.TbAllowInsecure}" /> - + HorizontalAlignment="Left" /> { string.Empty, Global.StreamSecurity }; @@ -115,7 +114,7 @@ public partial class AddServerWindow gridFinalmask.Visibility = Visibility.Collapsed; cmbFingerprint.IsEnabled = false; cmbAlpn.IsEnabled = false; - cmbAllowInsecure.IsEnabled = false; + togAllowInsecure.IsEnabled = false; cmbCongestionControl12.ItemsSource = Global.NaiveCongestionControls; break; @@ -137,14 +136,14 @@ public partial class AddServerWindow this.Bind(ViewModel, vm => vm.SelectedSource.Password, v => v.txtId.Text).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.AlterId, v => v.txtAlterId.Text).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.VmessSecurity, v => v.cmbSecurity.Text).DisposeWith(disposables); - this.Bind(ViewModel, vm => vm.SelectedSource.MuxEnabled, v => v.togmuxEnabled.IsChecked).DisposeWith(disposables); + this.Bind(ViewModel, vm => vm.MuxEnabled, v => v.togmuxEnabled.IsChecked).DisposeWith(disposables); break; case EConfigType.Shadowsocks: this.Bind(ViewModel, vm => vm.SelectedSource.Password, v => v.txtId3.Text).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.SsMethod, v => v.cmbSecurity3.Text).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.Uot, v => v.togUotEnabled3.IsChecked).DisposeWith(disposables); - this.Bind(ViewModel, vm => vm.SelectedSource.MuxEnabled, v => v.togmuxEnabled3.IsChecked).DisposeWith(disposables); + this.Bind(ViewModel, vm => vm.MuxEnabled, v => v.togmuxEnabled3.IsChecked).DisposeWith(disposables); break; case EConfigType.SOCKS: @@ -157,13 +156,13 @@ public partial class AddServerWindow this.Bind(ViewModel, vm => vm.SelectedSource.Password, v => v.txtId5.Text).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.Flow, v => v.cmbFlow5.Text).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.VlessEncryption, v => v.txtSecurity5.Text).DisposeWith(disposables); - this.Bind(ViewModel, vm => vm.SelectedSource.MuxEnabled, v => v.togmuxEnabled5.IsChecked).DisposeWith(disposables); + this.Bind(ViewModel, vm => vm.MuxEnabled, v => v.togmuxEnabled5.IsChecked).DisposeWith(disposables); break; case EConfigType.Trojan: this.Bind(ViewModel, vm => vm.SelectedSource.Password, v => v.txtId6.Text).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.Flow, v => v.cmbFlow6.Text).DisposeWith(disposables); - this.Bind(ViewModel, vm => vm.SelectedSource.MuxEnabled, v => v.togmuxEnabled6.IsChecked).DisposeWith(disposables); + this.Bind(ViewModel, vm => vm.MuxEnabled, v => v.togmuxEnabled6.IsChecked).DisposeWith(disposables); break; case EConfigType.Hysteria2: @@ -229,7 +228,7 @@ public partial class AddServerWindow this.Bind(ViewModel, vm => vm.SelectedSource.StreamSecurity, v => v.cmbStreamSecurity.Text).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.SelectedSource.Sni, v => v.txtSNI.Text).DisposeWith(disposables); - this.Bind(ViewModel, vm => vm.SelectedSource.AllowInsecure, v => v.cmbAllowInsecure.Text).DisposeWith(disposables); + this.Bind(ViewModel, vm => vm.AllowInsecure, v => v.togAllowInsecure.IsChecked).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.SelectedSource.Fingerprint, v => v.cmbFingerprint.Text).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.SelectedSource.Alpn, v => v.cmbAlpn.Text).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.CertSha, v => v.txtCertSha256Pinning.Text).DisposeWith(disposables); diff --git a/v2rayN/v2rayN/Views/OptionSettingWindow.xaml b/v2rayN/v2rayN/Views/OptionSettingWindow.xaml index 2e972f31..e1e7e988 100644 --- a/v2rayN/v2rayN/Views/OptionSettingWindow.xaml +++ b/v2rayN/v2rayN/Views/OptionSettingWindow.xaml @@ -227,20 +227,6 @@ Margin="{StaticResource Margin8}" Style="{StaticResource DefTextBox}" /> - - - - - - vm.NewPort4LAN, v => v.txtpass.IsEnabled).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.User, v => v.txtuser.Text).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.Pass, v => v.txtpass.Text).DisposeWith(disposables); - this.Bind(ViewModel, vm => vm.MuxEnabled, v => v.togmuxEnabled.IsChecked).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.LogEnabled, v => v.toglogEnabled.IsChecked).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.Loglevel, v => v.cmbloglevel.Text).DisposeWith(disposables); - this.Bind(ViewModel, vm => vm.DefAllowInsecure, v => v.togdefAllowInsecure.IsChecked).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.DefFingerprint, v => v.cmbdefFingerprint.Text).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.DefUserAgent, v => v.cmbdefUserAgent.Text).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.SendThrough, v => v.txtsendThrough.Text).DisposeWith(disposables);