From fec84a495244286d15c6f1a28f20ca0fcee5645c Mon Sep 17 00:00:00 2001 From: ChsBuffer <33744752+chsbuffer@users.noreply.github.com> Date: Fri, 1 Oct 2021 12:11:45 +0800 Subject: [PATCH] Update NFController Update ICMPDelay setting Update WebUtil Default UserAgent Hide unimplemented features' settings Remove unused HTTP Port setting --- Netch/Controllers/NFController.cs | 79 ++++++++---------------- Netch/Forms/SettingForm.Designer.cs | 96 ++++++++++++----------------- Netch/Forms/SettingForm.cs | 12 +--- Netch/Interops/Redirector.cs | 46 +++++--------- Netch/Models/Setting.cs | 3 +- Netch/Resources/zh-CN | 4 ++ Netch/Utils/WebUtil.cs | 3 +- scripts/download.ps1 | 2 +- 8 files changed, 87 insertions(+), 158 deletions(-) diff --git a/Netch/Controllers/NFController.cs b/Netch/Controllers/NFController.cs index d1f924ed..7f274f2d 100644 --- a/Netch/Controllers/NFController.cs +++ b/Netch/Controllers/NFController.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Diagnostics; using System.IO; using System.Linq; using System.ServiceProcess; @@ -33,24 +32,26 @@ namespace Netch.Controllers _mode = mode; _rdrConfig = Global.Settings.Redirector; CheckDriver(); - CheckCore(); - Dial(NameList.TYPE_FILTERLOOPBACK, "false"); - Dial(NameList.TYPE_FILTERICMP, "true"); - var p = PortHelper.GetAvailablePort(); - Dial(NameList.TYPE_TCPLISN, p.ToString()); - Dial(NameList.TYPE_UDPLISN, p.ToString()); + Dial(NameList.AIO_FILTERLOOPBACK, "false"); + Dial(NameList.AIO_FILTERINTRANET, "false"); + Dial(NameList.AIO_FILTERICMP, _rdrConfig.FilterICMP.ToString().ToLower()); + Dial(NameList.AIO_ICMPING, _rdrConfig.ICMPDelay.ToString()); // Server - Dial(NameList.TYPE_FILTERUDP, _rdrConfig.FilterProtocol.HasFlag(PortType.UDP).ToString().ToLower()); - Dial(NameList.TYPE_FILTERTCP, _rdrConfig.FilterProtocol.HasFlag(PortType.TCP).ToString().ToLower()); - await DialServerAsync(_rdrConfig.FilterProtocol, _server); + Dial(NameList.AIO_FILTERUDP, _rdrConfig.FilterProtocol.HasFlag(PortType.UDP).ToString().ToLower()); + Dial(NameList.AIO_FILTERTCP, _rdrConfig.FilterProtocol.HasFlag(PortType.TCP).ToString().ToLower()); + + Dial(NameList.AIO_TGTHOST, await server.AutoResolveHostnameAsync()); + Dial(NameList.AIO_TGTPORT, server.Port.ToString()); + Dial(NameList.AIO_TGTUSER, server.Username ?? string.Empty); + Dial(NameList.AIO_TGTPASS, server.Password ?? string.Empty); // Mode Rule - dial_Name(_mode); + DialRule(_mode); - // Features - Dial(NameList.TYPE_DNSHOST, _rdrConfig.DNSHijack ? _rdrConfig.DNSHijackHost : ""); + // Features TODO + // Dial(NameList.AIO_DNSHOST, _rdrConfig.DNSHijack ? _rdrConfig.DNSHijackHost : ""); if (!await InitAsync()) throw new MessageException("Redirector start failed."); @@ -73,14 +74,14 @@ namespace Netch.Controllers try { if (r.StartsWith("!")) - return Dial(NameList.TYPE_ADDNAME, r.Substring(1)); + return Dial(NameList.AIO_ADDNAME, r.Substring(1)); - return Dial(NameList.TYPE_ADDNAME, r); + return Dial(NameList.AIO_ADDNAME, r); } finally { if (clear) - Dial(NameList.TYPE_CLRNAME, ""); + Dial(NameList.AIO_CLRNAME, ""); } } @@ -92,70 +93,40 @@ namespace Netch.Controllers public static bool CheckRules(IEnumerable rules, out IEnumerable results) { results = rules.Where(r => !CheckCppRegex(r, false)); - Dial(NameList.TYPE_CLRNAME, ""); + Dial(NameList.AIO_CLRNAME, ""); return !results.Any(); } public static string GenerateInvalidRulesMessage(IEnumerable rules) { - return $"{string.Join("\n", rules)}\nAbove rules does not conform to C++ regular expression syntax"; + return $"{string.Join("\n", rules)}\n" + i18N.Translate("Above rules does not conform to C++ regular expression syntax"); } #endregion - private async Task DialServerAsync(PortType portType, Server server) + private void DialRule(Mode mode) { - if (portType == PortType.Both) - { - await DialServerAsync(PortType.TCP, server); - await DialServerAsync(PortType.UDP, server); - return; - } - - var offset = portType == PortType.UDP ? UdpNameListOffset : 0; - - if (server is Socks5Server socks5) - { - Dial(NameList.TYPE_TCPTYPE + offset, "Socks5"); - Dial(NameList.TYPE_TCPHOST + offset, $"{await socks5.AutoResolveHostnameAsync()}:{socks5.Port}"); - Dial(NameList.TYPE_TCPUSER + offset, socks5.Username ?? string.Empty); - Dial(NameList.TYPE_TCPPASS + offset, socks5.Password ?? string.Empty); - Dial(NameList.TYPE_TCPMETH + offset, string.Empty); - } - else - { - Trace.Assert(false); - } - } - - private void dial_Name(Mode mode) - { - Dial(NameList.TYPE_CLRNAME, ""); + Dial(NameList.AIO_CLRNAME, ""); var invalidList = new List(); foreach (var s in mode.GetRules()) { if (s.StartsWith("!")) { - if (!Dial(NameList.TYPE_BYPNAME, s.Substring(1))) + if (!Dial(NameList.AIO_BYPNAME, s.Substring(1))) invalidList.Add(s); continue; } - if (!Dial(NameList.TYPE_ADDNAME, s)) + if (!Dial(NameList.AIO_ADDNAME, s)) invalidList.Add(s); } if (invalidList.Any()) throw new MessageException(GenerateInvalidRulesMessage(invalidList)); - Dial(NameList.TYPE_BYPNAME, "^" + Global.NetchDir.ToRegexString()); - } - - private void CheckCore() - { - if (!File.Exists(Constants.NFCore)) - throw new MessageException(i18N.Translate("\"Core.bin\" is missing. Please check your Antivirus software")); + // Bypass Self + Dial(NameList.AIO_BYPNAME, "^" + Global.NetchDir.ToRegexString()); } #region DriverUtil diff --git a/Netch/Forms/SettingForm.Designer.cs b/Netch/Forms/SettingForm.Designer.cs index 3e63cfec..e968740e 100644 --- a/Netch/Forms/SettingForm.Designer.cs +++ b/Netch/Forms/SettingForm.Designer.cs @@ -36,8 +36,6 @@ namespace Netch.Forms this.PortGroupBox = new System.Windows.Forms.GroupBox(); this.Socks5PortLabel = new System.Windows.Forms.Label(); this.Socks5PortTextBox = new System.Windows.Forms.TextBox(); - this.HTTPPortLabel = new System.Windows.Forms.Label(); - this.HTTPPortTextBox = new System.Windows.Forms.TextBox(); this.AllowDevicesCheckBox = new System.Windows.Forms.CheckBox(); this.ServerPingTypeLabel = new System.Windows.Forms.Label(); this.ICMPingRadioBtn = new System.Windows.Forms.RadioButton(); @@ -55,11 +53,11 @@ namespace Netch.Forms this.NFTabPage = new System.Windows.Forms.TabPage(); this.ProcessFilterProtocolLabel = new System.Windows.Forms.Label(); this.ProcessFilterProtocolComboBox = new System.Windows.Forms.ComboBox(); - this.DNSHijackCheckBox = new System.Windows.Forms.CheckBox(); - this.DNSHijackHostTextBox = new System.Windows.Forms.TextBox(); this.FilterICMPCheckBox = new System.Windows.Forms.CheckBox(); this.ICMPDelayLabel = new System.Windows.Forms.Label(); this.ICMPDelayTextBox = new System.Windows.Forms.TextBox(); + this.DNSHijackCheckBox = new System.Windows.Forms.CheckBox(); + this.DNSHijackHostTextBox = new System.Windows.Forms.TextBox(); this.ChildProcessHandleCheckBox = new System.Windows.Forms.CheckBox(); this.WinTUNTabPage = new System.Windows.Forms.TabPage(); this.WinTUNGroupBox = new System.Windows.Forms.GroupBox(); @@ -167,8 +165,6 @@ namespace Netch.Forms // this.PortGroupBox.Controls.Add(this.Socks5PortLabel); this.PortGroupBox.Controls.Add(this.Socks5PortTextBox); - this.PortGroupBox.Controls.Add(this.HTTPPortLabel); - this.PortGroupBox.Controls.Add(this.HTTPPortTextBox); this.PortGroupBox.Controls.Add(this.AllowDevicesCheckBox); this.PortGroupBox.Location = new System.Drawing.Point(8, 6); this.PortGroupBox.Name = "PortGroupBox"; @@ -194,23 +190,6 @@ namespace Netch.Forms this.Socks5PortTextBox.TabIndex = 1; this.Socks5PortTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; // - // HTTPPortLabel - // - this.HTTPPortLabel.AutoSize = true; - this.HTTPPortLabel.Location = new System.Drawing.Point(9, 54); - this.HTTPPortLabel.Name = "HTTPPortLabel"; - this.HTTPPortLabel.Size = new System.Drawing.Size(38, 17); - this.HTTPPortLabel.TabIndex = 2; - this.HTTPPortLabel.Text = "HTTP"; - // - // HTTPPortTextBox - // - this.HTTPPortTextBox.Location = new System.Drawing.Point(120, 51); - this.HTTPPortTextBox.Name = "HTTPPortTextBox"; - this.HTTPPortTextBox.Size = new System.Drawing.Size(90, 23); - this.HTTPPortTextBox.TabIndex = 3; - this.HTTPPortTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; - // // AllowDevicesCheckBox // this.AllowDevicesCheckBox.AutoSize = true; @@ -344,11 +323,11 @@ namespace Netch.Forms this.NFTabPage.BackColor = System.Drawing.SystemColors.ButtonFace; this.NFTabPage.Controls.Add(this.ProcessFilterProtocolLabel); this.NFTabPage.Controls.Add(this.ProcessFilterProtocolComboBox); - this.NFTabPage.Controls.Add(this.DNSHijackCheckBox); - this.NFTabPage.Controls.Add(this.DNSHijackHostTextBox); this.NFTabPage.Controls.Add(this.FilterICMPCheckBox); this.NFTabPage.Controls.Add(this.ICMPDelayLabel); this.NFTabPage.Controls.Add(this.ICMPDelayTextBox); + this.NFTabPage.Controls.Add(this.DNSHijackCheckBox); + this.NFTabPage.Controls.Add(this.DNSHijackHostTextBox); this.NFTabPage.Controls.Add(this.ChildProcessHandleCheckBox); this.NFTabPage.Location = new System.Drawing.Point(4, 29); this.NFTabPage.Name = "NFTabPage"; @@ -375,53 +354,55 @@ namespace Netch.Forms this.ProcessFilterProtocolComboBox.Size = new System.Drawing.Size(98, 25); this.ProcessFilterProtocolComboBox.TabIndex = 1; // - // DNSHijackCheckBox - // - this.DNSHijackCheckBox.AutoSize = true; - this.DNSHijackCheckBox.Location = new System.Drawing.Point(15, 50); - this.DNSHijackCheckBox.Name = "DNSHijackCheckBox"; - this.DNSHijackCheckBox.Size = new System.Drawing.Size(196, 21); - this.DNSHijackCheckBox.TabIndex = 2; - this.DNSHijackCheckBox.Text = "Handle process\'s DNS Hijack"; - this.DNSHijackCheckBox.UseVisualStyleBackColor = true; - // - // DNSHijackHostTextBox - // - this.DNSHijackHostTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Enabled", this.DNSHijackCheckBox, "Checked", true)); - this.DNSHijackHostTextBox.Location = new System.Drawing.Point(237, 48); - this.DNSHijackHostTextBox.Name = "DNSHijackHostTextBox"; - this.DNSHijackHostTextBox.Size = new System.Drawing.Size(191, 23); - this.DNSHijackHostTextBox.TabIndex = 3; - this.DNSHijackHostTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; - // // FilterICMPCheckBox // this.FilterICMPCheckBox.AutoSize = true; - this.FilterICMPCheckBox.Location = new System.Drawing.Point(13, 80); + this.FilterICMPCheckBox.Location = new System.Drawing.Point(15, 50); this.FilterICMPCheckBox.Name = "FilterICMPCheckBox"; this.FilterICMPCheckBox.Size = new System.Drawing.Size(90, 21); - this.FilterICMPCheckBox.TabIndex = 4; + this.FilterICMPCheckBox.TabIndex = 2; this.FilterICMPCheckBox.Text = "Filter ICMP"; this.FilterICMPCheckBox.UseVisualStyleBackColor = true; // // ICMPDelayLabel // this.ICMPDelayLabel.AutoSize = true; - this.ICMPDelayLabel.Location = new System.Drawing.Point(30, 110); + this.ICMPDelayLabel.Location = new System.Drawing.Point(30, 80); this.ICMPDelayLabel.Name = "ICMPDelayLabel"; this.ICMPDelayLabel.Size = new System.Drawing.Size(100, 17); - this.ICMPDelayLabel.TabIndex = 5; + this.ICMPDelayLabel.TabIndex = 3; this.ICMPDelayLabel.Text = "ICMP Delay(ms)"; // // ICMPDelayTextBox // - this.ICMPDelayTextBox.Location = new System.Drawing.Point(237, 107); + this.ICMPDelayTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Enabled", this.FilterICMPCheckBox, "Checked", true)); + this.ICMPDelayTextBox.Location = new System.Drawing.Point(237, 77); this.ICMPDelayTextBox.Name = "ICMPDelayTextBox"; - this.ICMPDelayTextBox.ReadOnly = true; this.ICMPDelayTextBox.Size = new System.Drawing.Size(98, 23); - this.ICMPDelayTextBox.TabIndex = 6; + this.ICMPDelayTextBox.TabIndex = 4; this.ICMPDelayTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; // + // DNSHijackCheckBox + // + this.DNSHijackCheckBox.AutoSize = true; + this.DNSHijackCheckBox.Location = new System.Drawing.Point(15, 110); + this.DNSHijackCheckBox.Name = "DNSHijackCheckBox"; + this.DNSHijackCheckBox.Size = new System.Drawing.Size(196, 21); + this.DNSHijackCheckBox.TabIndex = 5; + this.DNSHijackCheckBox.Text = "Handle process\'s DNS Hijack"; + this.DNSHijackCheckBox.UseVisualStyleBackColor = true; + this.DNSHijackCheckBox.Visible = false; + // + // DNSHijackHostTextBox + // + this.DNSHijackHostTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Enabled", this.DNSHijackCheckBox, "Checked", true)); + this.DNSHijackHostTextBox.Location = new System.Drawing.Point(237, 108); + this.DNSHijackHostTextBox.Name = "DNSHijackHostTextBox"; + this.DNSHijackHostTextBox.Size = new System.Drawing.Size(191, 23); + this.DNSHijackHostTextBox.TabIndex = 6; + this.DNSHijackHostTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + this.DNSHijackHostTextBox.Visible = false; + // // ChildProcessHandleCheckBox // this.ChildProcessHandleCheckBox.AutoSize = true; @@ -429,9 +410,10 @@ namespace Netch.Forms this.ChildProcessHandleCheckBox.Location = new System.Drawing.Point(15, 140); this.ChildProcessHandleCheckBox.Name = "ChildProcessHandleCheckBox"; this.ChildProcessHandleCheckBox.Size = new System.Drawing.Size(150, 21); - this.ChildProcessHandleCheckBox.TabIndex = 8; + this.ChildProcessHandleCheckBox.TabIndex = 7; this.ChildProcessHandleCheckBox.Text = "Child Process Handle"; this.ChildProcessHandleCheckBox.UseVisualStyleBackColor = true; + this.ChildProcessHandleCheckBox.Visible = false; // // WinTUNTabPage // @@ -748,9 +730,9 @@ namespace Netch.Forms this.OtherTabPage.Controls.Add(this.StopWhenExitedCheckBox); this.OtherTabPage.Controls.Add(this.StartWhenOpenedCheckBox); this.OtherTabPage.Controls.Add(this.MinimizeWhenStartedCheckBox); - this.OtherTabPage.Controls.Add(this.NoSupportDialogCheckBox); this.OtherTabPage.Controls.Add(this.RunAtStartupCheckBox); this.OtherTabPage.Controls.Add(this.CheckUpdateWhenOpenedCheckBox); + this.OtherTabPage.Controls.Add(this.NoSupportDialogCheckBox); this.OtherTabPage.Controls.Add(this.CheckBetaUpdateCheckBox); this.OtherTabPage.Controls.Add(this.UpdateServersWhenOpenedCheckBox); this.OtherTabPage.Location = new System.Drawing.Point(4, 29); @@ -809,7 +791,7 @@ namespace Netch.Forms this.NoSupportDialogCheckBox.Location = new System.Drawing.Point(6, 72); this.NoSupportDialogCheckBox.Name = "NoSupportDialogCheckBox"; this.NoSupportDialogCheckBox.Size = new System.Drawing.Size(174, 21); - this.NoSupportDialogCheckBox.TabIndex = 4; + this.NoSupportDialogCheckBox.TabIndex = 6; this.NoSupportDialogCheckBox.Text = "Disable Support Warning"; this.NoSupportDialogCheckBox.UseVisualStyleBackColor = true; // @@ -840,7 +822,7 @@ namespace Netch.Forms this.CheckBetaUpdateCheckBox.Location = new System.Drawing.Point(200, 72); this.CheckBetaUpdateCheckBox.Name = "CheckBetaUpdateCheckBox"; this.CheckBetaUpdateCheckBox.Size = new System.Drawing.Size(137, 21); - this.CheckBetaUpdateCheckBox.TabIndex = 6; + this.CheckBetaUpdateCheckBox.TabIndex = 7; this.CheckBetaUpdateCheckBox.Text = "Check Beta update"; this.CheckBetaUpdateCheckBox.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.CheckBetaUpdateCheckBox.UseVisualStyleBackColor = true; @@ -851,7 +833,7 @@ namespace Netch.Forms this.UpdateServersWhenOpenedCheckBox.Location = new System.Drawing.Point(200, 94); this.UpdateServersWhenOpenedCheckBox.Name = "UpdateServersWhenOpenedCheckBox"; this.UpdateServersWhenOpenedCheckBox.Size = new System.Drawing.Size(200, 21); - this.UpdateServersWhenOpenedCheckBox.TabIndex = 7; + this.UpdateServersWhenOpenedCheckBox.TabIndex = 8; this.UpdateServersWhenOpenedCheckBox.Text = "Update Servers when opened"; this.UpdateServersWhenOpenedCheckBox.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.UpdateServersWhenOpenedCheckBox.UseVisualStyleBackColor = true; @@ -996,8 +978,6 @@ namespace Netch.Forms private System.Windows.Forms.TabPage v2rayTabPage; private System.Windows.Forms.GroupBox PortGroupBox; private System.Windows.Forms.CheckBox AllowDevicesCheckBox; - private System.Windows.Forms.Label HTTPPortLabel; - private System.Windows.Forms.TextBox HTTPPortTextBox; private System.Windows.Forms.Label Socks5PortLabel; private System.Windows.Forms.TextBox Socks5PortTextBox; private System.Windows.Forms.GroupBox WinTUNGroupBox; diff --git a/Netch/Forms/SettingForm.cs b/Netch/Forms/SettingForm.cs index 483d6824..6041ed57 100644 --- a/Netch/Forms/SettingForm.cs +++ b/Netch/Forms/SettingForm.cs @@ -26,15 +26,7 @@ namespace Netch.Forms #region General - BindTextBox(Socks5PortTextBox, - p => p.ToString() != HTTPPortTextBox.Text, - p => Global.Settings.Socks5LocalPort = p, - Global.Settings.Socks5LocalPort); - - BindTextBox(HTTPPortTextBox, - p => p.ToString() != Socks5PortTextBox.Text, - p => Global.Settings.HTTPLocalPort = p, - Global.Settings.HTTPLocalPort); + BindTextBox(Socks5PortTextBox, p => true, p => Global.Settings.Socks5LocalPort = p, Global.Settings.Socks5LocalPort); BindCheckBox(AllowDevicesCheckBox, c => Global.Settings.LocalAddress = AllowDevicesCheckBox.Checked ? "0.0.0.0" : "127.0.0.1", @@ -108,7 +100,7 @@ namespace Netch.Forms BindCheckBox(FilterICMPCheckBox, b => Global.Settings.Redirector.FilterICMP = b, Global.Settings.Redirector.FilterICMP); - BindTextBox(ICMPDelayTextBox, s => int.TryParse(s, out _), s => { }, Global.Settings.Redirector.ICMPDelay); + BindTextBox(ICMPDelayTextBox, s => true, s => Global.Settings.Redirector.ICMPDelay = s, Global.Settings.Redirector.ICMPDelay); BindCheckBox(ChildProcessHandleCheckBox, s => Global.Settings.Redirector.ChildProcessHandle = s, diff --git a/Netch/Interops/Redirector.cs b/Netch/Interops/Redirector.cs index 63602570..0a79b461 100644 --- a/Netch/Interops/Redirector.cs +++ b/Netch/Interops/Redirector.cs @@ -8,38 +8,22 @@ namespace Netch.Interops { public enum NameList { - TYPE_FILTERLOOPBACK, - TYPE_FILTERICMP, - TYPE_FILTERTCP, - TYPE_FILTERUDP, + AIO_FILTERLOOPBACK, + AIO_FILTERINTRANET, // LAN + AIO_FILTERICMP, + AIO_FILTERTCP, + AIO_FILTERUDP, - TYPE_CLRNAME, - TYPE_ADDNAME, - TYPE_BYPNAME, + AIO_ICMPING, - TYPE_DNSHOST, + AIO_TGTHOST, + AIO_TGTPORT, + AIO_TGTUSER, + AIO_TGTPASS, - TYPE_TCPLISN, - TYPE_TCPTYPE, - TYPE_TCPHOST, - TYPE_TCPUSER, - TYPE_TCPPASS, - TYPE_TCPMETH, - TYPE_TCPPROT, - TYPE_TCPPRPA, - TYPE_TCPOBFS, - TYPE_TCPOBPA, - - TYPE_UDPLISN, - TYPE_UDPTYPE, - TYPE_UDPHOST, - TYPE_UDPUSER, - TYPE_UDPPASS, - TYPE_UDPMETH, - TYPE_UDPPROT, - TYPE_UDPPRPA, - TYPE_UDPOBFS, - TYPE_UDPOBPA + AIO_CLRNAME, + AIO_ADDNAME, + AIO_BYPNAME } public static bool Dial(NameList name, string value) @@ -58,8 +42,6 @@ namespace Netch.Interops return await Task.Run(aio_free).ConfigureAwait(false); } - public const int UdpNameListOffset = (int)NameList.TYPE_UDPLISN - (int)NameList.TYPE_TCPLISN; - private const string Redirector_bin = "Redirector.bin"; [DllImport(Redirector_bin, CallingConvention = CallingConvention.Cdecl)] @@ -71,10 +53,12 @@ namespace Netch.Interops [DllImport(Redirector_bin, CallingConvention = CallingConvention.Cdecl)] private static extern bool aio_free(); + /* [DllImport(Redirector_bin, CallingConvention = CallingConvention.Cdecl)] private static extern ulong aio_getUP(); [DllImport(Redirector_bin, CallingConvention = CallingConvention.Cdecl)] private static extern ulong aio_getDL(); + */ } } \ No newline at end of file diff --git a/Netch/Models/Setting.cs b/Netch/Models/Setting.cs index 3e20370f..670983b2 100644 --- a/Netch/Models/Setting.cs +++ b/Netch/Models/Setting.cs @@ -104,8 +104,7 @@ namespace Netch.Models /// public string DNSHijackHost { get; set; } = "1.1.1.1:53"; - [JsonIgnore] - public int ICMPDelay { get; } = 0; + public int ICMPDelay { get; set; } = 0; public bool FilterICMP { get; set; } = false; diff --git a/Netch/Resources/zh-CN b/Netch/Resources/zh-CN index 8c098ced..33efd1f5 100644 --- a/Netch/Resources/zh-CN +++ b/Netch/Resources/zh-CN @@ -115,6 +115,9 @@ "Scan": "扫描", "Save": "保存", "Modify": "修改", + "Select": "选择", + "Validation": "验证", + "Action": "动作", "Select a folder": "选择一个目录", "Please enter an process name (xxx.exe)": "请输入一个进程名(xxx.exe)", "Rule does not conform to C++ regular expression syntax": "规则不符合 C++ 正则表达式语法", @@ -125,6 +128,7 @@ "Please enter a mode remark": "请输入模式的备注", "File already exists.\n Please Change the filename": "文件名已存在,请修改文件名", "Please enter a mode filename": "请输入模式的文件名", + "Above rules does not conform to C++ regular expression syntax": "以上规则不符合 C++ 正则表达式语法", "Proxy Rule IPs": "代理规则 IP", "Bypass Rule IPs": "绕过规则 IP", diff --git a/Netch/Utils/WebUtil.cs b/Netch/Utils/WebUtil.cs index 91d93a8f..f22fe740 100644 --- a/Netch/Utils/WebUtil.cs +++ b/Netch/Utils/WebUtil.cs @@ -10,7 +10,7 @@ namespace Netch.Utils public static class WebUtil { public const string DefaultUserAgent = - @"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36 Edg/91.0.864.67"; + @"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.61 Safari/537.36 Edg/94.0.992.31"; static WebUtil() { @@ -50,7 +50,6 @@ namespace Netch.Utils /// 异步下载并编码为字符串 /// /// - /// /// 编码,默认UTF-8 /// public static (HttpStatusCode, string) DownloadString(HttpWebRequest req, Encoding? encoding = null) diff --git a/scripts/download.ps1 b/scripts/download.ps1 index 2850edb6..a3a54644 100644 --- a/scripts/download.ps1 +++ b/scripts/download.ps1 @@ -20,7 +20,7 @@ New-Item -ItemType Directory -Name bin | Out-Null New-Item -ItemType Directory -Name mode | Out-Null New-Item -ItemType Directory -Name i18n | Out-Null -Copy-Item -Recurse -Force .\netchdata-master\* .\bin -Exclude @('tap2socks.bin') +Copy-Item -Recurse -Force .\netchdata-master\* .\bin Copy-Item -Recurse -Force .\netchmode-master\mode\* .\mode Copy-Item -Recurse -Force .\netchi18n-master\i18n\* .\i18n