diff --git a/Netch/Forms/SettingForm.Designer.cs b/Netch/Forms/SettingForm.Designer.cs index 0c6f2a3479..3e63cfec79 100644 --- a/Netch/Forms/SettingForm.Designer.cs +++ b/Netch/Forms/SettingForm.Designer.cs @@ -39,7 +39,6 @@ private void InitializeComponent() this.HTTPPortLabel = new System.Windows.Forms.Label(); this.HTTPPortTextBox = new System.Windows.Forms.TextBox(); this.AllowDevicesCheckBox = new System.Windows.Forms.CheckBox(); - this.ResolveServerHostnameCheckBox = new System.Windows.Forms.CheckBox(); this.ServerPingTypeLabel = new System.Windows.Forms.Label(); this.ICMPingRadioBtn = new System.Windows.Forms.RadioButton(); this.TCPingRadioBtn = new System.Windows.Forms.RadioButton(); @@ -144,7 +143,6 @@ private void InitializeComponent() // this.GeneralTabPage.BackColor = System.Drawing.SystemColors.ButtonFace; this.GeneralTabPage.Controls.Add(this.PortGroupBox); - this.GeneralTabPage.Controls.Add(this.ResolveServerHostnameCheckBox); this.GeneralTabPage.Controls.Add(this.ServerPingTypeLabel); this.GeneralTabPage.Controls.Add(this.ICMPingRadioBtn); this.GeneralTabPage.Controls.Add(this.TCPingRadioBtn); @@ -224,20 +222,10 @@ private void InitializeComponent() this.AllowDevicesCheckBox.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.AllowDevicesCheckBox.UseVisualStyleBackColor = true; // - // ResolveServerHostnameCheckBox - // - this.ResolveServerHostnameCheckBox.AutoSize = true; - this.ResolveServerHostnameCheckBox.Location = new System.Drawing.Point(267, 15); - this.ResolveServerHostnameCheckBox.Name = "ResolveServerHostnameCheckBox"; - this.ResolveServerHostnameCheckBox.Size = new System.Drawing.Size(176, 21); - this.ResolveServerHostnameCheckBox.TabIndex = 1; - this.ResolveServerHostnameCheckBox.Text = "Resolve Server Hostname"; - this.ResolveServerHostnameCheckBox.UseVisualStyleBackColor = true; - // // ServerPingTypeLabel // this.ServerPingTypeLabel.AutoSize = true; - this.ServerPingTypeLabel.Location = new System.Drawing.Point(267, 44); + this.ServerPingTypeLabel.Location = new System.Drawing.Point(267, 15); this.ServerPingTypeLabel.Name = "ServerPingTypeLabel"; this.ServerPingTypeLabel.Size = new System.Drawing.Size(86, 17); this.ServerPingTypeLabel.TabIndex = 2; @@ -246,7 +234,7 @@ private void InitializeComponent() // ICMPingRadioBtn // this.ICMPingRadioBtn.AutoSize = true; - this.ICMPingRadioBtn.Location = new System.Drawing.Point(268, 63); + this.ICMPingRadioBtn.Location = new System.Drawing.Point(268, 34); this.ICMPingRadioBtn.Name = "ICMPingRadioBtn"; this.ICMPingRadioBtn.Size = new System.Drawing.Size(75, 21); this.ICMPingRadioBtn.TabIndex = 3; @@ -257,7 +245,7 @@ private void InitializeComponent() // TCPingRadioBtn // this.TCPingRadioBtn.AutoSize = true; - this.TCPingRadioBtn.Location = new System.Drawing.Point(366, 64); + this.TCPingRadioBtn.Location = new System.Drawing.Point(366, 35); this.TCPingRadioBtn.Name = "TCPingRadioBtn"; this.TCPingRadioBtn.Size = new System.Drawing.Size(66, 21); this.TCPingRadioBtn.TabIndex = 4; @@ -1012,7 +1000,6 @@ private void InitializeComponent() private System.Windows.Forms.TextBox HTTPPortTextBox; private System.Windows.Forms.Label Socks5PortLabel; private System.Windows.Forms.TextBox Socks5PortTextBox; - private System.Windows.Forms.CheckBox ResolveServerHostnameCheckBox; private System.Windows.Forms.GroupBox WinTUNGroupBox; private System.Windows.Forms.CheckBox ProxyDNSCheckBox; private System.Windows.Forms.CheckBox UseCustomDNSCheckBox; diff --git a/Netch/Forms/SettingForm.cs b/Netch/Forms/SettingForm.cs index 821e2640b3..483d682428 100644 --- a/Netch/Forms/SettingForm.cs +++ b/Netch/Forms/SettingForm.cs @@ -40,8 +40,6 @@ public SettingForm() c => Global.Settings.LocalAddress = AllowDevicesCheckBox.Checked ? "0.0.0.0" : "127.0.0.1", Global.Settings.LocalAddress switch { "127.0.0.1" => false, "0.0.0.0" => true, _ => false }); - BindCheckBox(ResolveServerHostnameCheckBox, c => Global.Settings.ResolveServerHostname = c, Global.Settings.ResolveServerHostname); - BindRadioBox(ICMPingRadioBtn, _ => { }, !Global.Settings.ServerTCPing); BindRadioBox(TCPingRadioBtn, c => Global.Settings.ServerTCPing = c, Global.Settings.ServerTCPing); diff --git a/Netch/Models/Server.cs b/Netch/Models/Server.cs index 386d5e13e4..7454002ad9 100644 --- a/Netch/Models/Server.cs +++ b/Netch/Models/Server.cs @@ -111,7 +111,8 @@ public static class ServerExtension { public static async Task AutoResolveHostnameAsync(this Server server, AddressFamily inet = AddressFamily.Unspecified) { - return Global.Settings.ResolveServerHostname ? (await DnsUtils.LookupAsync(server.Hostname, inet))!.ToString() : server.Hostname; + // ! MainController cached + return (await DnsUtils.LookupAsync(server.Hostname, inet))!.ToString(); } public static bool IsInGroup(this Server server) diff --git a/Netch/Models/Setting.cs b/Netch/Models/Setting.cs index f83e5dcb4a..23557c941a 100644 --- a/Netch/Models/Setting.cs +++ b/Netch/Models/Setting.cs @@ -192,11 +192,6 @@ public class Setting /// public int RequestTimeout { get; set; } = 10000; - /// - /// 解析服务器主机名 - /// - public bool ResolveServerHostname { get; set; } = true; - /// /// 是否开机启动软件 /// diff --git a/Netch/Resources/zh-CN b/Netch/Resources/zh-CN index 3b42f7e0b7..14c9b40782 100644 --- a/Netch/Resources/zh-CN +++ b/Netch/Resources/zh-CN @@ -103,6 +103,7 @@ "Please select a mode first": "请先选择一个模式", "Please enter a profile name first": "请先为该配置设置一个名称", "No saved profile here. Save a profile first by Ctrl+Click on the button": "当前按钮下没有保存配置,请先使用 CTRL + 左键 点击该按钮保存一个配置", + "Lookup Server hostname failed": "解析服务器主机名失败", "Used": "已使用", "Testing": "测试中", @@ -154,14 +155,12 @@ "Handle process's DNS Hijack": "被代理进程 DNS 劫持", "Child Process Handle": "子进程代理", "ICMP Delay(ms)": "ICMP 延迟(毫秒)", - "Redirector built-in Shadowsocks support": "Redirector 内建 Shadowsocks 支持", "Profile Count": "快捷配置数量", "Delay test after start(sec)": "启动后延迟测试(秒)", "Ping Protocol": "延迟测试协议", "Detection Tick(sec)": "检测心跳(秒)", "STUN Server": "STUN 服务器", "Language": "语言", - "Resolve Server Hostname": "解析服务器主机名", "FullCone Support (Required Server Xray-core v1.3.0+)": "FullCone 支持(需服务端 Xray-core v1.3.0+)", "Disable Support Warning": "停用支持警告", diff --git a/Netch/Servers/Trojan/TrojanController.cs b/Netch/Servers/Trojan/TrojanController.cs index e575ef2bfb..fcb3194204 100644 --- a/Netch/Servers/Trojan/TrojanController.cs +++ b/Netch/Servers/Trojan/TrojanController.cs @@ -41,7 +41,7 @@ public async Task StartAsync(Server s) }, ssl = new TrojanSSL { - sni = server.Host.ValueOrDefault() ?? (Global.Settings.ResolveServerHostname ? server.Hostname : "") + sni = server.Host.ValueOrDefault() ?? server.Hostname } };