diff --git a/Netch/Controllers/DNSController.cs b/Netch/Controllers/DNSController.cs index 8c16fb3d..e6313428 100644 --- a/Netch/Controllers/DNSController.cs +++ b/Netch/Controllers/DNSController.cs @@ -15,23 +15,23 @@ namespace Netch.Controllers public Process Instance; /// - /// 启动NatTypeTester + /// 启动DNS服务 /// /// public bool Start() { - MainForm.Instance.StatusText($"{Utils.i18N.Translate("Starting dns2tcp Service")}"); + MainForm.Instance.StatusText($"{Utils.i18N.Translate("Starting dns Service")}"); try { - if (!File.Exists("bin\\dns2tcp.exe")) + if (!File.Exists("bin\\unbound.exe") && !File.Exists("bin\\unbound-service.conf") && !File.Exists("bin\\forward-zone.conf")) { return false; } Instance = MainController.GetProcess(); - Instance.StartInfo.FileName = "bin\\dns2tcp.exe"; + Instance.StartInfo.FileName = "bin\\unbound.exe"; - Instance.StartInfo.Arguments = " -L 127.0.0.1:53 -R 1.1.1.1:53"; + Instance.StartInfo.Arguments = "-c unbound-service.conf -v"; Instance.OutputDataReceived += OnOutputDataReceived; Instance.ErrorDataReceived += OnOutputDataReceived; @@ -43,7 +43,7 @@ namespace Netch.Controllers } catch (Exception) { - Utils.Logging.Info("dns2tcp 进程出错"); + Utils.Logging.Info("dns-unbound 进程出错"); Stop(); return false; } @@ -71,42 +71,12 @@ namespace Netch.Controllers { if (!string.IsNullOrWhiteSpace(e.Data)) { - if (File.Exists("logging\\dns2tcp.log")) + if (File.Exists("logging\\dns-unbound.log")) { - File.Delete("logging\\dns2tcp.log"); + File.Delete("logging\\dns-unbound.log"); } - File.AppendAllText("logging\\dns2tcp.log", $"{e.Data}\r\n"); + File.AppendAllText("logging\\dns-unbound.log", $"{e.Data}\r\n"); } } - - /* public static DNS.Server.DnsServer Server = new DNS.Server.DnsServer(new Resolver()); - - public bool Start() - { - MainForm.Instance.StatusText($"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Starting LocalDns service")}"); - try - { - _ = Server.Listen(new IPEndPoint(IPAddress.IPv6Any, 53)); - } - catch (Exception e) - { - Utils.Logging.Info(e.ToString()); - return false; - } - - return true; - } - - public void Stop() - { - try - { - Server.Dispose(); - } - catch (Exception e) - { - Utils.Logging.Info(e.ToString()); - } - }*/ } } diff --git a/Netch/Resources/zh-CN b/Netch/Resources/zh-CN index f459bc43..7f1ae69b 100644 --- a/Netch/Resources/zh-CN +++ b/Netch/Resources/zh-CN @@ -25,7 +25,7 @@ "Starting Redirector": "正在启动Redirector", "ReStarting Redirector": "正常启动失败,正在尝试重新启动Redirector", "Starting netfilter2 Service": "正在启动netfilter2服务", - "Starting dns2tcp Service": "正在启动dns2tcp服务", + "Starting dns Service": "正在启动dns服务", "SetupBypass": "设置绕行规则", "Test failed": "测试失败", "Starting update subscription": "正在更新订阅", diff --git a/binaries b/binaries index 2c681e04..b01d61e0 160000 --- a/binaries +++ b/binaries @@ -1 +1 @@ -Subproject commit 2c681e04eb860465e998d79f23bc831e4dbce1e7 +Subproject commit b01d61e06f6e98729a072095314dc285bdc39132