From d2bef312ce87966ccfb1cf2df5e8d990ccc1618b Mon Sep 17 00:00:00 2001 From: 2dust <31833384+2dust@users.noreply.github.com> Date: Wed, 1 Feb 2023 11:24:45 +0800 Subject: [PATCH] Add default fingerprint settings --- v2rayN/v2rayN/Global.cs | 2 +- v2rayN/v2rayN/Handler/CoreConfigHandler.cs | 4 ++-- v2rayN/v2rayN/Mode/Config.cs | 7 +++---- v2rayN/v2rayN/Resx/ResUI.Designer.cs | 9 +++++++++ v2rayN/v2rayN/Resx/ResUI.resx | 3 +++ v2rayN/v2rayN/Resx/ResUI.zh-Hans.resx | 3 +++ .../v2rayN/ViewModels/OptionSettingViewModel.cs | 3 +++ v2rayN/v2rayN/Views/MsgView.xaml.cs | 1 - v2rayN/v2rayN/Views/OptionSettingWindow.xaml | 15 +++++++++++++++ v2rayN/v2rayN/Views/OptionSettingWindow.xaml.cs | 5 +++++ 10 files changed, 44 insertions(+), 8 deletions(-) diff --git a/v2rayN/v2rayN/Global.cs b/v2rayN/v2rayN/Global.cs index 07961134..37604545 100644 --- a/v2rayN/v2rayN/Global.cs +++ b/v2rayN/v2rayN/Global.cs @@ -105,7 +105,7 @@ public static readonly List Protocols = new List { "http", "tls", "bittorrent" }; public static readonly List TunMtus = new List { "9000", "1500" }; public static readonly List TunStacks = new List { "gvisor", "system" }; - public static readonly List PresetMsgFilters = new List { "^(?!.*proxy).*$", "^(?!.*direct).*$" }; + public static readonly List PresetMsgFilters = new List { "^(?!.*proxy).*$", "^(?!.*direct).*$", "" }; #endregion diff --git a/v2rayN/v2rayN/Handler/CoreConfigHandler.cs b/v2rayN/v2rayN/Handler/CoreConfigHandler.cs index 617581cd..454117a3 100644 --- a/v2rayN/v2rayN/Handler/CoreConfigHandler.cs +++ b/v2rayN/v2rayN/Handler/CoreConfigHandler.cs @@ -556,7 +556,7 @@ namespace v2rayN.Handler { allowInsecure = Utils.ToBool(node.allowInsecure.IsNullOrEmpty() ? config.defAllowInsecure.ToString().ToLower() : node.allowInsecure), alpn = node.GetAlpn(), - fingerprint = node.fingerprint + fingerprint = node.fingerprint.IsNullOrEmpty() ? config.defFingerprint : node.fingerprint }; if (!string.IsNullOrWhiteSpace(sni)) { @@ -578,7 +578,7 @@ namespace v2rayN.Handler { allowInsecure = Utils.ToBool(node.allowInsecure.IsNullOrEmpty() ? config.defAllowInsecure.ToString().ToLower() : node.allowInsecure), alpn = node.GetAlpn(), - fingerprint = node.fingerprint + fingerprint = node.fingerprint.IsNullOrEmpty() ? config.defFingerprint : node.fingerprint }; if (!string.IsNullOrWhiteSpace(sni)) { diff --git a/v2rayN/v2rayN/Mode/Config.cs b/v2rayN/v2rayN/Mode/Config.cs index 9abbb797..11ed01fc 100644 --- a/v2rayN/v2rayN/Mode/Config.cs +++ b/v2rayN/v2rayN/Mode/Config.cs @@ -90,10 +90,9 @@ /// /// 是否允许不安全连接 /// - public bool defAllowInsecure - { - get; set; - } + public bool defAllowInsecure { get; set; } + + public string defFingerprint { get; set; } /// /// 域名解析策略 diff --git a/v2rayN/v2rayN/Resx/ResUI.Designer.cs b/v2rayN/v2rayN/Resx/ResUI.Designer.cs index 367b776e..eb4862c3 100644 --- a/v2rayN/v2rayN/Resx/ResUI.Designer.cs +++ b/v2rayN/v2rayN/Resx/ResUI.Designer.cs @@ -2401,6 +2401,15 @@ namespace v2rayN.Resx { } } + /// + /// 查找类似 Default TLS fingerprint 的本地化字符串。 + /// + public static string TbSettingsDefFingerprint { + get { + return ResourceManager.GetString("TbSettingsDefFingerprint", resourceCulture); + } + } + /// /// 查找类似 Outbound Freedom domainStrategy 的本地化字符串。 /// diff --git a/v2rayN/v2rayN/Resx/ResUI.resx b/v2rayN/v2rayN/Resx/ResUI.resx index 84fdb0b9..a96733f4 100644 --- a/v2rayN/v2rayN/Resx/ResUI.resx +++ b/v2rayN/v2rayN/Resx/ResUI.resx @@ -1084,4 +1084,7 @@ Test completed + + Default TLS fingerprint + \ 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 c7ebfca1..bda8b0ce 100644 --- a/v2rayN/v2rayN/Resx/ResUI.zh-Hans.resx +++ b/v2rayN/v2rayN/Resx/ResUI.zh-Hans.resx @@ -1084,4 +1084,7 @@ 测试完成 + + 默认TLS指纹(fingerprint) + \ No newline at end of file diff --git a/v2rayN/v2rayN/ViewModels/OptionSettingViewModel.cs b/v2rayN/v2rayN/ViewModels/OptionSettingViewModel.cs index 96671fda..eb157f6d 100644 --- a/v2rayN/v2rayN/ViewModels/OptionSettingViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/OptionSettingViewModel.cs @@ -28,6 +28,7 @@ namespace v2rayN.ViewModels [Reactive] public bool logEnabled { get; set; } [Reactive] public string loglevel { get; set; } [Reactive] public bool defAllowInsecure { get; set; } + [Reactive] public string defFingerprint { get; set; } #endregion #region Core DNS @@ -110,6 +111,7 @@ namespace v2rayN.ViewModels logEnabled = _config.logEnabled; loglevel = _config.loglevel; defAllowInsecure = _config.defAllowInsecure; + defFingerprint = _config.defFingerprint; #endregion #region Core DNS @@ -269,6 +271,7 @@ namespace v2rayN.ViewModels _config.loglevel = loglevel; _config.muxEnabled = muxEnabled; _config.defAllowInsecure = defAllowInsecure; + _config.defFingerprint = defFingerprint; //DNS diff --git a/v2rayN/v2rayN/Views/MsgView.xaml.cs b/v2rayN/v2rayN/Views/MsgView.xaml.cs index 574db83a..71ad4b5b 100644 --- a/v2rayN/v2rayN/Views/MsgView.xaml.cs +++ b/v2rayN/v2rayN/Views/MsgView.xaml.cs @@ -16,7 +16,6 @@ namespace v2rayN.Views { cmbMsgFilter.Items.Add(it); }); - cmbMsgFilter.Items.Add(string.Empty); } void DelegateAppendText(string msg) diff --git a/v2rayN/v2rayN/Views/OptionSettingWindow.xaml b/v2rayN/v2rayN/Views/OptionSettingWindow.xaml index b70bb023..018214a9 100644 --- a/v2rayN/v2rayN/Views/OptionSettingWindow.xaml +++ b/v2rayN/v2rayN/Views/OptionSettingWindow.xaml @@ -62,6 +62,7 @@ + @@ -235,6 +236,20 @@ Grid.Column="1" Margin="{StaticResource SettingItemMargin}" HorizontalAlignment="Left" /> + + + + diff --git a/v2rayN/v2rayN/Views/OptionSettingWindow.xaml.cs b/v2rayN/v2rayN/Views/OptionSettingWindow.xaml.cs index a26cd5ba..459207a4 100644 --- a/v2rayN/v2rayN/Views/OptionSettingWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/OptionSettingWindow.xaml.cs @@ -21,6 +21,10 @@ namespace v2rayN.Views { cmbloglevel.Items.Add(it); }); + Global.fingerprints.ForEach(it => + { + cmbdefFingerprint.Items.Add(it); + }); Global.domainStrategy4Freedoms.ForEach(it => { cmbdomainStrategy4Freedom.Items.Add(it); @@ -63,6 +67,7 @@ namespace v2rayN.Views 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.domainStrategy4Freedom, v => v.cmbdomainStrategy4Freedom.Text).DisposeWith(disposables);