diff --git a/Netch/Controllers/DNSController.cs b/Netch/Controllers/DNSController.cs index e6313428..ae8fb993 100644 --- a/Netch/Controllers/DNSController.cs +++ b/Netch/Controllers/DNSController.cs @@ -2,8 +2,6 @@ using System; using System.Diagnostics; using System.IO; -using System.Net; -using System.Threading; namespace Netch.Controllers { diff --git a/Netch/Controllers/HTTPController.cs b/Netch/Controllers/HTTPController.cs index 87f8b4eb..8404312d 100644 --- a/Netch/Controllers/HTTPController.cs +++ b/Netch/Controllers/HTTPController.cs @@ -1,5 +1,4 @@ using System; -using Microsoft.Win32; namespace Netch.Controllers { diff --git a/Netch/Controllers/MainController.cs b/Netch/Controllers/MainController.cs index 42617054..e40eb418 100644 --- a/Netch/Controllers/MainController.cs +++ b/Netch/Controllers/MainController.cs @@ -3,7 +3,6 @@ using System; using System.Diagnostics; using System.IO; using System.Runtime.InteropServices; -using System.Threading; using System.Threading.Tasks; namespace Netch.Controllers diff --git a/Netch/Controllers/SSController.cs b/Netch/Controllers/SSController.cs index 665ec450..3d2faa93 100644 --- a/Netch/Controllers/SSController.cs +++ b/Netch/Controllers/SSController.cs @@ -43,7 +43,7 @@ namespace Netch.Controllers { Instance.StartInfo.Arguments = $"-s {server.Hostname} -p {server.Port} -b {Global.Settings.LocalAddress} -l {Global.Settings.Socks5LocalPort} -m {server.EncryptMethod} -k \"{server.Password}\" -u"; } - + if (mode.BypassChina) { Instance.StartInfo.Arguments += " --acl default.acl"; diff --git a/Netch/Controllers/TUNTAPController.cs b/Netch/Controllers/TUNTAPController.cs index a6fed784..b60d9625 100644 --- a/Netch/Controllers/TUNTAPController.cs +++ b/Netch/Controllers/TUNTAPController.cs @@ -1,12 +1,12 @@ -using System; +using Netch.Forms; +using Netch.Utils; +using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Net; using System.Text; using System.Threading; -using Netch.Forms; -using Netch.Utils; namespace Netch.Controllers { diff --git a/Netch/Controllers/UpdateChecker.cs b/Netch/Controllers/UpdateChecker.cs index 3096a0ec..65757503 100644 --- a/Netch/Controllers/UpdateChecker.cs +++ b/Netch/Controllers/UpdateChecker.cs @@ -1,10 +1,10 @@ -using System; +using Netch.Models.GitHubRelease; +using Newtonsoft.Json; +using System; using System.Collections.Generic; using System.Diagnostics; using System.Net.Http; using System.Threading.Tasks; -using Netch.Models.GitHubRelease; -using Newtonsoft.Json; namespace Netch.Controllers { diff --git a/Netch/Forms/MainForm.cs b/Netch/Forms/MainForm.cs index cb6b9b87..a0a67f79 100644 --- a/Netch/Forms/MainForm.cs +++ b/Netch/Forms/MainForm.cs @@ -6,7 +6,6 @@ using System.Drawing; using System.IO; using System.Linq; using System.ServiceProcess; -using System.Text; using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; diff --git a/Netch/Forms/SettingForm.cs b/Netch/Forms/SettingForm.cs index 4973bb82..33e86da7 100644 --- a/Netch/Forms/SettingForm.cs +++ b/Netch/Forms/SettingForm.cs @@ -1,5 +1,4 @@ using System; -using System.Collections; using System.Net; using System.Windows.Forms; using TaskScheduler; diff --git a/Netch/Forms/SubscribeForm.cs b/Netch/Forms/SubscribeForm.cs index b6f8013b..e49b5c1a 100644 --- a/Netch/Forms/SubscribeForm.cs +++ b/Netch/Forms/SubscribeForm.cs @@ -1,5 +1,4 @@ -using Netch.Models; -using System; +using System; using System.Collections.Generic; using System.Windows.Forms; diff --git a/Netch/Models/Profile.cs b/Netch/Models/Profile.cs index 156d118c..ebff87e7 100644 --- a/Netch/Models/Profile.cs +++ b/Netch/Models/Profile.cs @@ -1,7 +1,7 @@ namespace Netch.Models { public class Profile - { + { public string ServerRemark; public string ModeRemark; public string ProfileName; @@ -24,5 +24,5 @@ } - } + } } diff --git a/Netch/Models/Setting.cs b/Netch/Models/Setting.cs index 5892d6dc..8df8f340 100644 --- a/Netch/Models/Setting.cs +++ b/Netch/Models/Setting.cs @@ -178,6 +178,6 @@ namespace Netch.Models /// ACL规则 /// public string ACL = "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/banAD.acl"; - + } } diff --git a/Netch/Netch.csproj b/Netch/Netch.csproj index 9433c8fb..1e6b4190 100644 --- a/Netch/Netch.csproj +++ b/Netch/Netch.csproj @@ -65,8 +65,6 @@ - - diff --git a/Netch/Properties/AssemblyInfo.cs b/Netch/Properties/AssemblyInfo.cs index 687c9edf..586a8e88 100644 --- a/Netch/Properties/AssemblyInfo.cs +++ b/Netch/Properties/AssemblyInfo.cs @@ -1,6 +1,6 @@ -using System.Reflection; +using Netch.Controllers; +using System.Reflection; using System.Runtime.InteropServices; -using Netch.Controllers; // 有关程序集的一般信息由以下 // 控制。更改这些特性值可修改 diff --git a/Netch/Resolver.cs b/Netch/Resolver.cs deleted file mode 100644 index ef6b46de..00000000 --- a/Netch/Resolver.cs +++ /dev/null @@ -1,59 +0,0 @@ -using DNS.Protocol; -using System; -using System.Linq; -using System.Threading.Tasks; - -namespace Netch -{ - public class Resolver : DNS.Client.RequestResolver.IRequestResolver - { - public Task Resolve(IRequest request) - { - IResponse response = Response.FromRequest(request); - - foreach (var question in response.Questions) - { - if (question.Type == RecordType.A) - { - var client = new DnsClient.LookupClient(DnsClient.NameServer.GooglePublicDns); - client.UseTcpOnly = true; - client.UseCache = true; - - try - { - var result = client.Query(question.Name.ToString(), DnsClient.QueryType.A); - foreach (var item in result.Answers.ARecords()) - { - response.AnswerRecords.Add(new DNS.Protocol.ResourceRecords.IPAddressResourceRecord(question.Name, item.Address)); - } - } - catch (Exception) - { - // 跳过 - } - } - else if (question.Type == RecordType.AAAA) - { - var client = new DnsClient.LookupClient(DnsClient.NameServer.GooglePublicDns); - client.UseTcpOnly = true; - client.UseCache = true; - - try - { - var result = client.Query(question.Name.ToString(), DnsClient.QueryType.AAAA); - foreach (var item in result.Answers.AaaaRecords()) - { - response.AnswerRecords.Add(new DNS.Protocol.ResourceRecords.IPAddressResourceRecord(question.Name, item.Address)); - } - } - catch (Exception) - { - // 跳过 - } - } - } - - return Task.FromResult(response); - } - } -} diff --git a/Netch/Utils/Configuration.cs b/Netch/Utils/Configuration.cs index d0d9a876..eb10295d 100644 --- a/Netch/Utils/Configuration.cs +++ b/Netch/Utils/Configuration.cs @@ -175,7 +175,8 @@ namespace Netch.Utils Global.TUNTAP.ComponentID = TUNTAP.GetComponentID(); } - else { + else + { return false; } //MessageBox.Show(i18N.Translate("Please install TAP-Windows and create an TUN/TAP adapter manually"), i18N.Translate("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); diff --git a/Netch/Utils/ShareLink.cs b/Netch/Utils/ShareLink.cs index 7d0381b8..f9061f4f 100644 --- a/Netch/Utils/ShareLink.cs +++ b/Netch/Utils/ShareLink.cs @@ -1,12 +1,12 @@ -using System; +using Netch.Models; +using Netch.Models.SS; +using Newtonsoft.Json; +using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Text.RegularExpressions; using System.Web; -using Netch.Models; -using Netch.Models.SS; -using Newtonsoft.Json; namespace Netch.Utils {