mirror of
https://github.com/netchx/netch.git
synced 2026-05-11 23:45:06 +08:00
Compare commits
19 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4e6bcdcf88 | ||
|
|
f244212cdf | ||
|
|
6649a1fce9 | ||
|
|
c31338ee1f | ||
|
|
5f3a300ccc | ||
|
|
bc0e88ae5e | ||
|
|
fac28ca88b | ||
|
|
5efd88b60c | ||
|
|
3f59a63766 | ||
|
|
8f14b030bb | ||
|
|
f941df0af2 | ||
|
|
13a66d0648 | ||
|
|
9548a3d03a | ||
|
|
c2f33ba15b | ||
|
|
2895989b13 | ||
|
|
7cddb75cef | ||
|
|
f05ae498c6 | ||
|
|
ff0fe2ab9f | ||
|
|
764e78d662 |
@@ -2,8 +2,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Net;
|
|
||||||
using System.Threading;
|
|
||||||
|
|
||||||
namespace Netch.Controllers
|
namespace Netch.Controllers
|
||||||
{
|
{
|
||||||
@@ -15,23 +13,23 @@ namespace Netch.Controllers
|
|||||||
public Process Instance;
|
public Process Instance;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 启动NatTypeTester
|
/// 启动DNS服务
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public bool Start()
|
public bool Start()
|
||||||
{
|
{
|
||||||
MainForm.Instance.StatusText($"{Utils.i18N.Translate("Starting dns2tcp Service")}");
|
MainForm.Instance.StatusText($"{Utils.i18N.Translate("Starting dns Service")}");
|
||||||
try
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Instance = MainController.GetProcess();
|
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.OutputDataReceived += OnOutputDataReceived;
|
||||||
Instance.ErrorDataReceived += OnOutputDataReceived;
|
Instance.ErrorDataReceived += OnOutputDataReceived;
|
||||||
@@ -43,7 +41,7 @@ namespace Netch.Controllers
|
|||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
Utils.Logging.Info("dns2tcp 进程出错");
|
Utils.Logging.Info("dns-unbound 进程出错");
|
||||||
Stop();
|
Stop();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -71,42 +69,12 @@ namespace Netch.Controllers
|
|||||||
{
|
{
|
||||||
if (!string.IsNullOrWhiteSpace(e.Data))
|
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());
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using Microsoft.Win32;
|
|
||||||
|
|
||||||
namespace Netch.Controllers
|
namespace Netch.Controllers
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
using System;
|
using Netch.Forms;
|
||||||
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Netch.Controllers
|
namespace Netch.Controllers
|
||||||
@@ -123,7 +123,14 @@ namespace Netch.Controllers
|
|||||||
pNTTController = new NTTController();
|
pNTTController = new NTTController();
|
||||||
}
|
}
|
||||||
// 进程代理模式,启动 NF 控制器
|
// 进程代理模式,启动 NF 控制器
|
||||||
result = pNFController.Start(server, mode);
|
result = pNFController.Start(server, mode, false);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
MainForm.Instance.StatusText($"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("ReStarting Redirector")}");
|
||||||
|
Utils.Logging.Info("正常启动失败后尝试停止驱动服务再重新启动");
|
||||||
|
//正常启动失败后尝试停止驱动服务再重新启动
|
||||||
|
result = pNFController.Start(server, mode, true);
|
||||||
|
}
|
||||||
if (result)
|
if (result)
|
||||||
Task.Run(() =>
|
Task.Run(() =>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -40,18 +40,45 @@ namespace Netch.Controllers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="server">服务器</param>
|
/// <param name="server">服务器</param>
|
||||||
/// <param name="mode">模式</param>
|
/// <param name="mode">模式</param>
|
||||||
|
/// <param name="StopServiceAndRestart">先停止驱动服务再重新启动</param>
|
||||||
/// <returns>是否成功</returns>
|
/// <returns>是否成功</returns>
|
||||||
public bool Start(Models.Server server, Models.Mode mode)
|
public bool Start(Models.Server server, Models.Mode mode, bool StopServiceAndRestart)
|
||||||
{
|
{
|
||||||
MainForm.Instance.StatusText($"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Starting Redirector")}");
|
if (!StopServiceAndRestart)
|
||||||
|
MainForm.Instance.StatusText($"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Starting Redirector")}");
|
||||||
|
|
||||||
// 检查驱动是否存在
|
// 检查驱动是否存在
|
||||||
if (File.Exists(driverPath))
|
if (File.Exists(driverPath))
|
||||||
{
|
{
|
||||||
//检查驱动版本号
|
// 生成系统版本
|
||||||
FileVersionInfo fileVerInfo = System.Diagnostics.FileVersionInfo.GetVersionInfo(driverPath);
|
var version = $"{Environment.OSVersion.Version.Major.ToString()}.{Environment.OSVersion.Version.Minor.ToString()}";
|
||||||
if (new Version(fileVerInfo.FileVersion) < new Version(UpdateChecker.NFDriverVersion))
|
var driverName = "";
|
||||||
|
|
||||||
|
switch (version)
|
||||||
{
|
{
|
||||||
|
case "10.0":
|
||||||
|
driverName = "Win-10.sys";
|
||||||
|
break;
|
||||||
|
case "6.3":
|
||||||
|
case "6.2":
|
||||||
|
driverName = "Win-8.sys";
|
||||||
|
break;
|
||||||
|
case "6.1":
|
||||||
|
case "6.0":
|
||||||
|
driverName = "Win-7.sys";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Utils.Logging.Info($"不支持的系统版本:{version}");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//检查驱动版本号
|
||||||
|
FileVersionInfo SystemfileVerInfo = System.Diagnostics.FileVersionInfo.GetVersionInfo(driverPath);
|
||||||
|
FileVersionInfo BinFileVerInfo = System.Diagnostics.FileVersionInfo.GetVersionInfo(string.Format("bin\\{0}", driverName));
|
||||||
|
|
||||||
|
if (!SystemfileVerInfo.FileVersion.Equals(BinFileVerInfo.FileVersion))
|
||||||
|
{
|
||||||
|
Utils.Logging.Info("开始更新驱动");
|
||||||
//需要更新驱动
|
//需要更新驱动
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -67,6 +94,8 @@ namespace Netch.Controllers
|
|||||||
File.Delete(driverPath);
|
File.Delete(driverPath);
|
||||||
if (!InstallDriver())
|
if (!InstallDriver())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
Utils.Logging.Info($"驱动更新完毕,当前驱动版本:{BinFileVerInfo.FileVersion}");
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
@@ -86,12 +115,13 @@ namespace Netch.Controllers
|
|||||||
{
|
{
|
||||||
//启动驱动服务
|
//启动驱动服务
|
||||||
var service = new ServiceController("netfilter2");
|
var service = new ServiceController("netfilter2");
|
||||||
if (service.Status == ServiceControllerStatus.Running)
|
if (service.Status == ServiceControllerStatus.Running && StopServiceAndRestart)
|
||||||
{
|
{
|
||||||
//防止其他程序占用 重置NF百万ID限制 待定
|
//防止其他程序占用 重置NF百万ID限制
|
||||||
/*service.Stop();
|
service.Stop();
|
||||||
|
service.WaitForStatus(ServiceControllerStatus.Stopped);
|
||||||
MainForm.Instance.StatusText($"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Starting netfilter2 Service")}");
|
MainForm.Instance.StatusText($"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Starting netfilter2 Service")}");
|
||||||
service.Start();*/
|
service.Start();
|
||||||
}
|
}
|
||||||
else if (service.Status == ServiceControllerStatus.Stopped)
|
else if (service.Status == ServiceControllerStatus.Stopped)
|
||||||
{
|
{
|
||||||
@@ -207,12 +237,11 @@ namespace Netch.Controllers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils.Logging.Info($"{fallback}");
|
|
||||||
|
|
||||||
if (File.Exists("logging\\redirector.log"))
|
if (File.Exists("logging\\redirector.log"))
|
||||||
File.Delete("logging\\redirector.log");
|
File.Delete("logging\\redirector.log");
|
||||||
|
|
||||||
Instance.StartInfo.Arguments = fallback;
|
Instance.StartInfo.Arguments = fallback + $" -tcport {Global.Settings.RedirectorTCPPort}";
|
||||||
|
Utils.Logging.Info(Instance.StartInfo.Arguments);
|
||||||
Instance.OutputDataReceived += OnOutputDataReceived;
|
Instance.OutputDataReceived += OnOutputDataReceived;
|
||||||
Instance.ErrorDataReceived += OnOutputDataReceived;
|
Instance.ErrorDataReceived += OnOutputDataReceived;
|
||||||
State = Models.State.Starting;
|
State = Models.State.Starting;
|
||||||
@@ -220,14 +249,19 @@ namespace Netch.Controllers
|
|||||||
Instance.BeginOutputReadLine();
|
Instance.BeginOutputReadLine();
|
||||||
Instance.BeginErrorReadLine();
|
Instance.BeginErrorReadLine();
|
||||||
|
|
||||||
for (var i = 0; i < 1000; i++)
|
for (var i = 0; i < 10; i++)
|
||||||
{
|
{
|
||||||
Thread.Sleep(10);
|
Thread.Sleep(1000);
|
||||||
|
|
||||||
if (State == Models.State.Started)
|
if (State == Models.State.Started)
|
||||||
{
|
{
|
||||||
|
Utils.Logging.Info($"成功启动Redirector耗时:{i + 1}秒");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Utils.Logging.Info($"Redirector启动中,已耗时:{i + 1}秒");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils.Logging.Info("NF 进程启动超时");
|
Utils.Logging.Info("NF 进程启动超时");
|
||||||
@@ -256,6 +290,7 @@ namespace Netch.Controllers
|
|||||||
public bool InstallDriver()
|
public bool InstallDriver()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
Utils.Logging.Info("安装驱动中");
|
||||||
// 生成系统版本
|
// 生成系统版本
|
||||||
var version = $"{Environment.OSVersion.Version.Major.ToString()}.{Environment.OSVersion.Version.Minor.ToString()}";
|
var version = $"{Environment.OSVersion.Version.Major.ToString()}.{Environment.OSVersion.Version.Minor.ToString()}";
|
||||||
|
|
||||||
@@ -344,4 +379,4 @@ namespace Netch.Controllers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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";
|
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)
|
if (mode.BypassChina)
|
||||||
{
|
{
|
||||||
Instance.StartInfo.Arguments += " --acl default.acl";
|
Instance.StartInfo.Arguments += " --acl default.acl";
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ namespace Netch.Controllers
|
|||||||
|
|
||||||
Instance = MainController.GetProcess();
|
Instance = MainController.GetProcess();
|
||||||
Instance.StartInfo.FileName = "bin\\ShadowsocksR.exe";
|
Instance.StartInfo.FileName = "bin\\ShadowsocksR.exe";
|
||||||
Instance.StartInfo.Arguments = $"-s {server.Hostname} -p {server.Port} -k \"{server.Password}\" -m {server.EncryptMethod}";
|
Instance.StartInfo.Arguments = $"-s {server.Hostname} -p {server.Port} -k \"{server.Password}\" -m {server.EncryptMethod} -t 600";
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(server.Protocol))
|
if (!string.IsNullOrEmpty(server.Protocol))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
using System;
|
using Netch.Forms;
|
||||||
|
using Netch.Utils;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using Netch.Forms;
|
|
||||||
using Netch.Utils;
|
|
||||||
|
|
||||||
namespace Netch.Controllers
|
namespace Netch.Controllers
|
||||||
{
|
{
|
||||||
@@ -39,7 +39,7 @@ namespace Netch.Controllers
|
|||||||
public DNSController pDNSController = new DNSController();
|
public DNSController pDNSController = new DNSController();
|
||||||
|
|
||||||
// ByPassLan IP
|
// ByPassLan IP
|
||||||
List<string> BypassLanIPs = new List<string>() { "10.0.0.0/8", "172.16.0.0/16", "192.168.0.0/24" };
|
List<string> BypassLanIPs = new List<string>() { "10.0.0.0/8", "172.16.0.0/16", "192.168.0.0/16" };
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 配置 TUNTAP 适配器
|
/// 配置 TUNTAP 适配器
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
using System;
|
using Netch.Models.GitHubRelease;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Netch.Models.GitHubRelease;
|
|
||||||
using Newtonsoft.Json;
|
|
||||||
|
|
||||||
namespace Netch.Controllers
|
namespace Netch.Controllers
|
||||||
{
|
{
|
||||||
@@ -26,8 +26,7 @@ namespace Netch.Controllers
|
|||||||
|
|
||||||
public const string Name = @"Netch";
|
public const string Name = @"Netch";
|
||||||
public const string Copyright = @"Copyright © 2019 - 2020";
|
public const string Copyright = @"Copyright © 2019 - 2020";
|
||||||
public const string Version = @"1.4.0";
|
public const string Version = @"1.4.2";
|
||||||
public const string NFDriverVersion = @"1.5.9.0";
|
|
||||||
|
|
||||||
public async void Check(bool notifyNoFound, bool isPreRelease)
|
public async void Check(bool notifyNoFound, bool isPreRelease)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -126,19 +126,7 @@ namespace Netch.Controllers
|
|||||||
{
|
{
|
||||||
enabled = server.UseMux
|
enabled = server.UseMux
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
//此处修复一个诡异的BUG 感谢@ColinWood Tap模式 Mux不能为Null 否则Netch内存占用极大
|
|
||||||
/*new Models.Information.VMess.Outbounds
|
|
||||||
{
|
|
||||||
tag = "direct",
|
|
||||||
protocol = "freedom",
|
|
||||||
settings = null,
|
|
||||||
streamSettings = null,
|
|
||||||
*//*mux = new Models.Information.VMess.OutboundMux(){
|
|
||||||
enabled = true
|
|
||||||
}*//*
|
|
||||||
mux = null
|
|
||||||
}*/
|
|
||||||
},
|
},
|
||||||
routing = new Models.Information.VMess.Routing
|
routing = new Models.Information.VMess.Routing
|
||||||
{
|
{
|
||||||
|
|||||||
42
Netch/Forms/MainForm.Designer.cs
generated
42
Netch/Forms/MainForm.Designer.cs
generated
@@ -50,8 +50,10 @@ namespace Netch.Forms
|
|||||||
this.RestartServiceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.RestartServiceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.UninstallServiceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.UninstallServiceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.CleanDNSCacheToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.CleanDNSCacheToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.UpdateACLToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.AboutToolStripButton = new System.Windows.Forms.ToolStripButton();
|
this.AboutToolStripButton = new System.Windows.Forms.ToolStripButton();
|
||||||
this.VersionLabel = new System.Windows.Forms.ToolStripLabel();
|
this.VersionLabel = new System.Windows.Forms.ToolStripLabel();
|
||||||
|
this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.ConfigurationGroupBox = new System.Windows.Forms.GroupBox();
|
this.ConfigurationGroupBox = new System.Windows.Forms.GroupBox();
|
||||||
this.configLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
|
this.configLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
|
||||||
this.ProfileLabel = new System.Windows.Forms.Label();
|
this.ProfileLabel = new System.Windows.Forms.Label();
|
||||||
@@ -82,6 +84,7 @@ namespace Netch.Forms
|
|||||||
this.SettingsButton = new System.Windows.Forms.Button();
|
this.SettingsButton = new System.Windows.Forms.Button();
|
||||||
this.ProfileGroupBox = new System.Windows.Forms.GroupBox();
|
this.ProfileGroupBox = new System.Windows.Forms.GroupBox();
|
||||||
this.ProfileTable = new System.Windows.Forms.TableLayoutPanel();
|
this.ProfileTable = new System.Windows.Forms.TableLayoutPanel();
|
||||||
|
this.updateACLWithProxyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.MenuStrip.SuspendLayout();
|
this.MenuStrip.SuspendLayout();
|
||||||
this.ConfigurationGroupBox.SuspendLayout();
|
this.ConfigurationGroupBox.SuspendLayout();
|
||||||
this.configLayoutPanel.SuspendLayout();
|
this.configLayoutPanel.SuspendLayout();
|
||||||
@@ -108,7 +111,8 @@ namespace Netch.Forms
|
|||||||
this.SubscribeToolStripMenuItem,
|
this.SubscribeToolStripMenuItem,
|
||||||
this.OptionsToolStripMenuItem,
|
this.OptionsToolStripMenuItem,
|
||||||
this.AboutToolStripButton,
|
this.AboutToolStripButton,
|
||||||
this.VersionLabel});
|
this.VersionLabel,
|
||||||
|
this.exitToolStripMenuItem});
|
||||||
this.MenuStrip.Location = new System.Drawing.Point(0, 0);
|
this.MenuStrip.Location = new System.Drawing.Point(0, 0);
|
||||||
this.MenuStrip.Name = "MenuStrip";
|
this.MenuStrip.Name = "MenuStrip";
|
||||||
this.MenuStrip.RenderMode = System.Windows.Forms.ToolStripRenderMode.Professional;
|
this.MenuStrip.RenderMode = System.Windows.Forms.ToolStripRenderMode.Professional;
|
||||||
@@ -217,7 +221,9 @@ namespace Netch.Forms
|
|||||||
this.ReloadModesToolStripMenuItem,
|
this.ReloadModesToolStripMenuItem,
|
||||||
this.RestartServiceToolStripMenuItem,
|
this.RestartServiceToolStripMenuItem,
|
||||||
this.UninstallServiceToolStripMenuItem,
|
this.UninstallServiceToolStripMenuItem,
|
||||||
this.CleanDNSCacheToolStripMenuItem});
|
this.CleanDNSCacheToolStripMenuItem,
|
||||||
|
this.UpdateACLToolStripMenuItem,
|
||||||
|
this.updateACLWithProxyToolStripMenuItem});
|
||||||
this.OptionsToolStripMenuItem.Margin = new System.Windows.Forms.Padding(0, 0, 0, 1);
|
this.OptionsToolStripMenuItem.Margin = new System.Windows.Forms.Padding(0, 0, 0, 1);
|
||||||
this.OptionsToolStripMenuItem.Name = "OptionsToolStripMenuItem";
|
this.OptionsToolStripMenuItem.Name = "OptionsToolStripMenuItem";
|
||||||
this.OptionsToolStripMenuItem.Size = new System.Drawing.Size(66, 21);
|
this.OptionsToolStripMenuItem.Size = new System.Drawing.Size(66, 21);
|
||||||
@@ -226,31 +232,38 @@ namespace Netch.Forms
|
|||||||
// ReloadModesToolStripMenuItem
|
// ReloadModesToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.ReloadModesToolStripMenuItem.Name = "ReloadModesToolStripMenuItem";
|
this.ReloadModesToolStripMenuItem.Name = "ReloadModesToolStripMenuItem";
|
||||||
this.ReloadModesToolStripMenuItem.Size = new System.Drawing.Size(177, 22);
|
this.ReloadModesToolStripMenuItem.Size = new System.Drawing.Size(209, 22);
|
||||||
this.ReloadModesToolStripMenuItem.Text = "Reload Modes";
|
this.ReloadModesToolStripMenuItem.Text = "Reload Modes";
|
||||||
this.ReloadModesToolStripMenuItem.Click += new System.EventHandler(this.ReloadModesToolStripMenuItem_Click);
|
this.ReloadModesToolStripMenuItem.Click += new System.EventHandler(this.ReloadModesToolStripMenuItem_Click);
|
||||||
//
|
//
|
||||||
// RestartServiceToolStripMenuItem
|
// RestartServiceToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.RestartServiceToolStripMenuItem.Name = "RestartServiceToolStripMenuItem";
|
this.RestartServiceToolStripMenuItem.Name = "RestartServiceToolStripMenuItem";
|
||||||
this.RestartServiceToolStripMenuItem.Size = new System.Drawing.Size(177, 22);
|
this.RestartServiceToolStripMenuItem.Size = new System.Drawing.Size(209, 22);
|
||||||
this.RestartServiceToolStripMenuItem.Text = "Restart Service";
|
this.RestartServiceToolStripMenuItem.Text = "Restart Service";
|
||||||
this.RestartServiceToolStripMenuItem.Click += new System.EventHandler(this.RestartServiceToolStripMenuItem_Click);
|
this.RestartServiceToolStripMenuItem.Click += new System.EventHandler(this.RestartServiceToolStripMenuItem_Click);
|
||||||
//
|
//
|
||||||
// UninstallServiceToolStripMenuItem
|
// UninstallServiceToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.UninstallServiceToolStripMenuItem.Name = "UninstallServiceToolStripMenuItem";
|
this.UninstallServiceToolStripMenuItem.Name = "UninstallServiceToolStripMenuItem";
|
||||||
this.UninstallServiceToolStripMenuItem.Size = new System.Drawing.Size(177, 22);
|
this.UninstallServiceToolStripMenuItem.Size = new System.Drawing.Size(209, 22);
|
||||||
this.UninstallServiceToolStripMenuItem.Text = "Uninstall Service";
|
this.UninstallServiceToolStripMenuItem.Text = "Uninstall Service";
|
||||||
this.UninstallServiceToolStripMenuItem.Click += new System.EventHandler(this.UninstallServiceToolStripMenuItem_Click);
|
this.UninstallServiceToolStripMenuItem.Click += new System.EventHandler(this.UninstallServiceToolStripMenuItem_Click);
|
||||||
//
|
//
|
||||||
// CleanDNSCacheToolStripMenuItem
|
// CleanDNSCacheToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.CleanDNSCacheToolStripMenuItem.Name = "CleanDNSCacheToolStripMenuItem";
|
this.CleanDNSCacheToolStripMenuItem.Name = "CleanDNSCacheToolStripMenuItem";
|
||||||
this.CleanDNSCacheToolStripMenuItem.Size = new System.Drawing.Size(177, 22);
|
this.CleanDNSCacheToolStripMenuItem.Size = new System.Drawing.Size(209, 22);
|
||||||
this.CleanDNSCacheToolStripMenuItem.Text = "Clean DNS Cache";
|
this.CleanDNSCacheToolStripMenuItem.Text = "Clean DNS Cache";
|
||||||
this.CleanDNSCacheToolStripMenuItem.Click += new System.EventHandler(this.CleanDNSCacheToolStripMenuItem_Click);
|
this.CleanDNSCacheToolStripMenuItem.Click += new System.EventHandler(this.CleanDNSCacheToolStripMenuItem_Click);
|
||||||
//
|
//
|
||||||
|
// UpdateACLToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.UpdateACLToolStripMenuItem.Name = "UpdateACLToolStripMenuItem";
|
||||||
|
this.UpdateACLToolStripMenuItem.Size = new System.Drawing.Size(209, 22);
|
||||||
|
this.UpdateACLToolStripMenuItem.Text = "Update ACL";
|
||||||
|
this.UpdateACLToolStripMenuItem.Click += new System.EventHandler(this.updateACLToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
// AboutToolStripButton
|
// AboutToolStripButton
|
||||||
//
|
//
|
||||||
this.AboutToolStripButton.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;
|
this.AboutToolStripButton.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;
|
||||||
@@ -273,6 +286,13 @@ namespace Netch.Forms
|
|||||||
this.VersionLabel.Text = "x.x.x";
|
this.VersionLabel.Text = "x.x.x";
|
||||||
this.VersionLabel.Click += new System.EventHandler(this.VersionLabel_Click);
|
this.VersionLabel.Click += new System.EventHandler(this.VersionLabel_Click);
|
||||||
//
|
//
|
||||||
|
// exitToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
|
||||||
|
this.exitToolStripMenuItem.Size = new System.Drawing.Size(40, 22);
|
||||||
|
this.exitToolStripMenuItem.Text = "Exit";
|
||||||
|
this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
// ConfigurationGroupBox
|
// ConfigurationGroupBox
|
||||||
//
|
//
|
||||||
this.ConfigurationGroupBox.Controls.Add(this.configLayoutPanel);
|
this.ConfigurationGroupBox.Controls.Add(this.configLayoutPanel);
|
||||||
@@ -602,6 +622,13 @@ namespace Netch.Forms
|
|||||||
this.ProfileTable.Size = new System.Drawing.Size(599, 43);
|
this.ProfileTable.Size = new System.Drawing.Size(599, 43);
|
||||||
this.ProfileTable.TabIndex = 0;
|
this.ProfileTable.TabIndex = 0;
|
||||||
//
|
//
|
||||||
|
// updateACLWithProxyToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.updateACLWithProxyToolStripMenuItem.Name = "updateACLWithProxyToolStripMenuItem";
|
||||||
|
this.updateACLWithProxyToolStripMenuItem.Size = new System.Drawing.Size(209, 22);
|
||||||
|
this.updateACLWithProxyToolStripMenuItem.Text = "Update ACL with proxy";
|
||||||
|
this.updateACLWithProxyToolStripMenuItem.Click += new System.EventHandler(this.updateACLWithProxyToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
// MainForm
|
// MainForm
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
|
||||||
@@ -698,5 +725,8 @@ namespace Netch.Forms
|
|||||||
private System.Windows.Forms.TableLayoutPanel configLayoutPanel;
|
private System.Windows.Forms.TableLayoutPanel configLayoutPanel;
|
||||||
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2;
|
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2;
|
||||||
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel3;
|
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel3;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem UpdateACLToolStripMenuItem;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem updateACLWithProxyToolStripMenuItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -325,10 +325,12 @@ namespace Netch.Forms
|
|||||||
ManageSubscribeLinksToolStripMenuItem.Text = Utils.i18N.Translate(ManageSubscribeLinksToolStripMenuItem.Text);
|
ManageSubscribeLinksToolStripMenuItem.Text = Utils.i18N.Translate(ManageSubscribeLinksToolStripMenuItem.Text);
|
||||||
UpdateServersFromSubscribeLinksToolStripMenuItem.Text = Utils.i18N.Translate(UpdateServersFromSubscribeLinksToolStripMenuItem.Text);
|
UpdateServersFromSubscribeLinksToolStripMenuItem.Text = Utils.i18N.Translate(UpdateServersFromSubscribeLinksToolStripMenuItem.Text);
|
||||||
OptionsToolStripMenuItem.Text = Utils.i18N.Translate(OptionsToolStripMenuItem.Text);
|
OptionsToolStripMenuItem.Text = Utils.i18N.Translate(OptionsToolStripMenuItem.Text);
|
||||||
|
exitToolStripMenuItem.Text = Utils.i18N.Translate(exitToolStripMenuItem.Text);
|
||||||
RestartServiceToolStripMenuItem.Text = Utils.i18N.Translate(RestartServiceToolStripMenuItem.Text);
|
RestartServiceToolStripMenuItem.Text = Utils.i18N.Translate(RestartServiceToolStripMenuItem.Text);
|
||||||
UninstallServiceToolStripMenuItem.Text = Utils.i18N.Translate(UninstallServiceToolStripMenuItem.Text);
|
UninstallServiceToolStripMenuItem.Text = Utils.i18N.Translate(UninstallServiceToolStripMenuItem.Text);
|
||||||
ReloadModesToolStripMenuItem.Text = Utils.i18N.Translate(ReloadModesToolStripMenuItem.Text);
|
ReloadModesToolStripMenuItem.Text = Utils.i18N.Translate(ReloadModesToolStripMenuItem.Text);
|
||||||
CleanDNSCacheToolStripMenuItem.Text = Utils.i18N.Translate(CleanDNSCacheToolStripMenuItem.Text);
|
CleanDNSCacheToolStripMenuItem.Text = Utils.i18N.Translate(CleanDNSCacheToolStripMenuItem.Text);
|
||||||
|
UpdateACLToolStripMenuItem.Text = Utils.i18N.Translate(UpdateACLToolStripMenuItem.Text);
|
||||||
AboutToolStripButton.Text = Utils.i18N.Translate(AboutToolStripButton.Text);
|
AboutToolStripButton.Text = Utils.i18N.Translate(AboutToolStripButton.Text);
|
||||||
ConfigurationGroupBox.Text = Utils.i18N.Translate(ConfigurationGroupBox.Text);
|
ConfigurationGroupBox.Text = Utils.i18N.Translate(ConfigurationGroupBox.Text);
|
||||||
ServerLabel.Text = Utils.i18N.Translate(ServerLabel.Text);
|
ServerLabel.Text = Utils.i18N.Translate(ServerLabel.Text);
|
||||||
@@ -791,7 +793,14 @@ namespace Netch.Forms
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MenuStrip.Enabled = ConfigurationGroupBox.Enabled = ControlButton.Enabled = SettingsButton.Enabled = false;
|
//MenuStrip.Enabled = ConfigurationGroupBox.Enabled = ControlButton.Enabled = SettingsButton.Enabled = false;
|
||||||
|
|
||||||
|
//关闭启动按钮
|
||||||
|
ControlButton.Enabled = false;
|
||||||
|
//关闭使用代理更新ACL
|
||||||
|
updateACLWithProxyToolStripMenuItem.Enabled = false;
|
||||||
|
UpdateServersFromSubscribeLinksToolStripMenuItem.Enabled = false;
|
||||||
|
|
||||||
ControlButton.Text = "...";
|
ControlButton.Text = "...";
|
||||||
StatusLabel.Text = $"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Starting")}";
|
StatusLabel.Text = $"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Starting")}";
|
||||||
State = Models.State.Starting;
|
State = Models.State.Starting;
|
||||||
@@ -885,8 +894,8 @@ namespace Netch.Forms
|
|||||||
if (State == Models.State.Started)
|
if (State == Models.State.Started)
|
||||||
{
|
{
|
||||||
server.Test();
|
server.Test();
|
||||||
// 重载服务器列表
|
// 重载服务器列表
|
||||||
InitServer();
|
InitServer();
|
||||||
|
|
||||||
Thread.Sleep(Global.Settings.StartedTcping_Interval * 1000);
|
Thread.Sleep(Global.Settings.StartedTcping_Interval * 1000);
|
||||||
}
|
}
|
||||||
@@ -1284,5 +1293,126 @@ namespace Netch.Forms
|
|||||||
NatTypeStatusLabel.Text = "NAT" + Utils.i18N.Translate(": ") + Utils.i18N.Translate("Test failed");
|
NatTypeStatusLabel.Text = "NAT" + Utils.i18N.Translate(": ") + Utils.i18N.Translate("Test failed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateACLToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
using var client = new Override.WebClient();
|
||||||
|
|
||||||
|
client.DownloadFileTaskAsync(Global.Settings.ACL, "bin\\default.acl");
|
||||||
|
client.DownloadFileCompleted += ((sender, args) =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
|
||||||
|
if (args.Error == null)
|
||||||
|
{
|
||||||
|
NotifyIcon.ShowBalloonTip(5,
|
||||||
|
UpdateChecker.Name, Utils.i18N.Translate("ACL updated successfully"),
|
||||||
|
ToolTipIcon.Info);
|
||||||
|
//MessageBox.Show(Utils.i18N.Translate("ACL updated successfully"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Utils.Logging.Info("ACL更新失败!" + args.Error);
|
||||||
|
NotifyIcon.ShowBalloonTip(5,
|
||||||
|
UpdateChecker.Name,
|
||||||
|
Utils.i18N.Translate("ACL update failed"),
|
||||||
|
ToolTipIcon.Error);
|
||||||
|
//MessageBox.Show(Utils.i18N.Translate("ACL update failed"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
StatusText($"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Waiting for command")}");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
// 当前状态如果不是已停止状态
|
||||||
|
if (State != Models.State.Waiting && State != Models.State.Stopped)
|
||||||
|
{
|
||||||
|
// 如果未勾选退出时停止,要求先点击停止按钮
|
||||||
|
if (!Global.Settings.StopWhenExited)
|
||||||
|
{
|
||||||
|
MessageBox.Show(Utils.i18N.Translate("Please press Stop button first"), Utils.i18N.Translate("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
|
||||||
|
Visible = true;
|
||||||
|
ShowInTaskbar = true; // 显示在系统任务栏
|
||||||
|
WindowState = FormWindowState.Normal; // 还原窗体
|
||||||
|
NotifyIcon.Visible = true; // 托盘图标隐藏
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 否则直接调用停止按钮的方法
|
||||||
|
|
||||||
|
ControlButton_Click(sender, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
SaveConfigs();
|
||||||
|
|
||||||
|
State = Models.State.Terminating;
|
||||||
|
NotifyIcon.Visible = false;
|
||||||
|
Close();
|
||||||
|
Dispose();
|
||||||
|
Environment.Exit(Environment.ExitCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateACLWithProxyToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
updateACLWithProxyToolStripMenuItem.Enabled = false;
|
||||||
|
if (Global.Settings.UseProxyToUpdateSubscription)
|
||||||
|
{
|
||||||
|
// 当前 ServerComboBox 中至少有一项
|
||||||
|
if (ServerComboBox.SelectedIndex == -1)
|
||||||
|
{
|
||||||
|
MessageBox.Show(Utils.i18N.Translate("Please select a server first"), Utils.i18N.Translate("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
MenuStrip.Enabled = ConfigurationGroupBox.Enabled = ControlButton.Enabled = SettingsButton.Enabled = false;
|
||||||
|
ControlButton.Text = "...";
|
||||||
|
}
|
||||||
|
|
||||||
|
Task.Run(() =>
|
||||||
|
{
|
||||||
|
var mode = new Models.Mode
|
||||||
|
{
|
||||||
|
Remark = "ProxyUpdate",
|
||||||
|
Type = 5
|
||||||
|
};
|
||||||
|
MainController = new MainController();
|
||||||
|
MainController.Start(ServerComboBox.SelectedItem as Models.Server, mode);
|
||||||
|
|
||||||
|
using var client = new Override.WebClient();
|
||||||
|
|
||||||
|
client.Proxy = new System.Net.WebProxy($"http://127.0.0.1:{Global.Settings.HTTPLocalPort}");
|
||||||
|
|
||||||
|
StatusText($"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Updating in the background")}");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
client.DownloadFile(Global.Settings.ACL, "bin\\default.acl");
|
||||||
|
NotifyIcon.ShowBalloonTip(5,
|
||||||
|
UpdateChecker.Name, Utils.i18N.Translate("ACL updated successfully"),
|
||||||
|
ToolTipIcon.Info);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
|
||||||
|
Utils.Logging.Info("ACL更新失败!" + e.Message);
|
||||||
|
NotifyIcon.ShowBalloonTip(5,
|
||||||
|
UpdateChecker.Name,
|
||||||
|
Utils.i18N.Translate("ACL update failed"),
|
||||||
|
ToolTipIcon.Error);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
updateACLWithProxyToolStripMenuItem.Enabled = true;
|
||||||
|
|
||||||
|
StatusText($"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Waiting for command")}");
|
||||||
|
MainController.Stop();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
54
Netch/Forms/SettingForm.Designer.cs
generated
54
Netch/Forms/SettingForm.Designer.cs
generated
@@ -30,6 +30,8 @@
|
|||||||
{
|
{
|
||||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SettingForm));
|
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SettingForm));
|
||||||
this.PortGroupBox = new System.Windows.Forms.GroupBox();
|
this.PortGroupBox = new System.Windows.Forms.GroupBox();
|
||||||
|
this.RedirectorLabel = new System.Windows.Forms.Label();
|
||||||
|
this.RedirectorTextBox = new System.Windows.Forms.TextBox();
|
||||||
this.AllowDevicesCheckBox = new System.Windows.Forms.CheckBox();
|
this.AllowDevicesCheckBox = new System.Windows.Forms.CheckBox();
|
||||||
this.HTTPPortLabel = new System.Windows.Forms.Label();
|
this.HTTPPortLabel = new System.Windows.Forms.Label();
|
||||||
this.HTTPPortTextBox = new System.Windows.Forms.TextBox();
|
this.HTTPPortTextBox = new System.Windows.Forms.TextBox();
|
||||||
@@ -68,6 +70,8 @@
|
|||||||
this.StartWhenOpenedCheckBox = new System.Windows.Forms.CheckBox();
|
this.StartWhenOpenedCheckBox = new System.Windows.Forms.CheckBox();
|
||||||
this.StopWhenExitedCheckBox = new System.Windows.Forms.CheckBox();
|
this.StopWhenExitedCheckBox = new System.Windows.Forms.CheckBox();
|
||||||
this.ExitWhenClosedCheckBox = new System.Windows.Forms.CheckBox();
|
this.ExitWhenClosedCheckBox = new System.Windows.Forms.CheckBox();
|
||||||
|
this.AclAddr = new System.Windows.Forms.TextBox();
|
||||||
|
this.AclLabel = new System.Windows.Forms.Label();
|
||||||
this.PortGroupBox.SuspendLayout();
|
this.PortGroupBox.SuspendLayout();
|
||||||
this.TUNTAPGroupBox.SuspendLayout();
|
this.TUNTAPGroupBox.SuspendLayout();
|
||||||
this.BehaviorGroupBox.SuspendLayout();
|
this.BehaviorGroupBox.SuspendLayout();
|
||||||
@@ -75,6 +79,8 @@
|
|||||||
//
|
//
|
||||||
// PortGroupBox
|
// PortGroupBox
|
||||||
//
|
//
|
||||||
|
this.PortGroupBox.Controls.Add(this.RedirectorLabel);
|
||||||
|
this.PortGroupBox.Controls.Add(this.RedirectorTextBox);
|
||||||
this.PortGroupBox.Controls.Add(this.AllowDevicesCheckBox);
|
this.PortGroupBox.Controls.Add(this.AllowDevicesCheckBox);
|
||||||
this.PortGroupBox.Controls.Add(this.HTTPPortLabel);
|
this.PortGroupBox.Controls.Add(this.HTTPPortLabel);
|
||||||
this.PortGroupBox.Controls.Add(this.HTTPPortTextBox);
|
this.PortGroupBox.Controls.Add(this.HTTPPortTextBox);
|
||||||
@@ -87,10 +93,27 @@
|
|||||||
this.PortGroupBox.TabStop = false;
|
this.PortGroupBox.TabStop = false;
|
||||||
this.PortGroupBox.Text = "Local Port";
|
this.PortGroupBox.Text = "Local Port";
|
||||||
//
|
//
|
||||||
|
// RedirectorLabel
|
||||||
|
//
|
||||||
|
this.RedirectorLabel.AutoSize = true;
|
||||||
|
this.RedirectorLabel.Location = new System.Drawing.Point(9, 83);
|
||||||
|
this.RedirectorLabel.Name = "RedirectorLabel";
|
||||||
|
this.RedirectorLabel.Size = new System.Drawing.Size(95, 17);
|
||||||
|
this.RedirectorLabel.TabIndex = 6;
|
||||||
|
this.RedirectorLabel.Text = "Redirector TCP";
|
||||||
|
//
|
||||||
|
// RedirectorTextBox
|
||||||
|
//
|
||||||
|
this.RedirectorTextBox.Location = new System.Drawing.Point(120, 80);
|
||||||
|
this.RedirectorTextBox.Name = "RedirectorTextBox";
|
||||||
|
this.RedirectorTextBox.Size = new System.Drawing.Size(294, 23);
|
||||||
|
this.RedirectorTextBox.TabIndex = 7;
|
||||||
|
this.RedirectorTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||||
|
//
|
||||||
// AllowDevicesCheckBox
|
// AllowDevicesCheckBox
|
||||||
//
|
//
|
||||||
this.AllowDevicesCheckBox.AutoSize = true;
|
this.AllowDevicesCheckBox.AutoSize = true;
|
||||||
this.AllowDevicesCheckBox.Location = new System.Drawing.Point(120, 80);
|
this.AllowDevicesCheckBox.Location = new System.Drawing.Point(120, 109);
|
||||||
this.AllowDevicesCheckBox.Name = "AllowDevicesCheckBox";
|
this.AllowDevicesCheckBox.Name = "AllowDevicesCheckBox";
|
||||||
this.AllowDevicesCheckBox.Size = new System.Drawing.Size(206, 21);
|
this.AllowDevicesCheckBox.Size = new System.Drawing.Size(206, 21);
|
||||||
this.AllowDevicesCheckBox.TabIndex = 5;
|
this.AllowDevicesCheckBox.TabIndex = 5;
|
||||||
@@ -264,6 +287,8 @@
|
|||||||
//
|
//
|
||||||
// BehaviorGroupBox
|
// BehaviorGroupBox
|
||||||
//
|
//
|
||||||
|
this.BehaviorGroupBox.Controls.Add(this.AclAddr);
|
||||||
|
this.BehaviorGroupBox.Controls.Add(this.AclLabel);
|
||||||
this.BehaviorGroupBox.Controls.Add(this.DetectionInterval_Label);
|
this.BehaviorGroupBox.Controls.Add(this.DetectionInterval_Label);
|
||||||
this.BehaviorGroupBox.Controls.Add(this.DetectionInterval_TextBox);
|
this.BehaviorGroupBox.Controls.Add(this.DetectionInterval_TextBox);
|
||||||
this.BehaviorGroupBox.Controls.Add(this.EnableStartedTcping_CheckBox);
|
this.BehaviorGroupBox.Controls.Add(this.EnableStartedTcping_CheckBox);
|
||||||
@@ -329,7 +354,7 @@
|
|||||||
// BypassModeCheckBox
|
// BypassModeCheckBox
|
||||||
//
|
//
|
||||||
this.BypassModeCheckBox.AutoSize = true;
|
this.BypassModeCheckBox.AutoSize = true;
|
||||||
this.BypassModeCheckBox.Location = new System.Drawing.Point(276, 236);
|
this.BypassModeCheckBox.Location = new System.Drawing.Point(276, 307);
|
||||||
this.BypassModeCheckBox.Name = "BypassModeCheckBox";
|
this.BypassModeCheckBox.Name = "BypassModeCheckBox";
|
||||||
this.BypassModeCheckBox.Size = new System.Drawing.Size(135, 21);
|
this.BypassModeCheckBox.Size = new System.Drawing.Size(135, 21);
|
||||||
this.BypassModeCheckBox.TabIndex = 14;
|
this.BypassModeCheckBox.TabIndex = 14;
|
||||||
@@ -340,7 +365,7 @@
|
|||||||
// Redirector2checkBox
|
// Redirector2checkBox
|
||||||
//
|
//
|
||||||
this.Redirector2checkBox.AutoSize = true;
|
this.Redirector2checkBox.AutoSize = true;
|
||||||
this.Redirector2checkBox.Location = new System.Drawing.Point(152, 235);
|
this.Redirector2checkBox.Location = new System.Drawing.Point(152, 306);
|
||||||
this.Redirector2checkBox.Name = "Redirector2checkBox";
|
this.Redirector2checkBox.Name = "Redirector2checkBox";
|
||||||
this.Redirector2checkBox.Size = new System.Drawing.Size(118, 21);
|
this.Redirector2checkBox.Size = new System.Drawing.Size(118, 21);
|
||||||
this.Redirector2checkBox.TabIndex = 11;
|
this.Redirector2checkBox.TabIndex = 11;
|
||||||
@@ -350,7 +375,7 @@
|
|||||||
// ExperimentalFunction_Label
|
// ExperimentalFunction_Label
|
||||||
//
|
//
|
||||||
this.ExperimentalFunction_Label.AutoSize = true;
|
this.ExperimentalFunction_Label.AutoSize = true;
|
||||||
this.ExperimentalFunction_Label.Location = new System.Drawing.Point(6, 236);
|
this.ExperimentalFunction_Label.Location = new System.Drawing.Point(6, 307);
|
||||||
this.ExperimentalFunction_Label.Name = "ExperimentalFunction_Label";
|
this.ExperimentalFunction_Label.Name = "ExperimentalFunction_Label";
|
||||||
this.ExperimentalFunction_Label.Size = new System.Drawing.Size(133, 17);
|
this.ExperimentalFunction_Label.Size = new System.Drawing.Size(133, 17);
|
||||||
this.ExperimentalFunction_Label.TabIndex = 13;
|
this.ExperimentalFunction_Label.TabIndex = 13;
|
||||||
@@ -471,6 +496,23 @@
|
|||||||
this.ExitWhenClosedCheckBox.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
this.ExitWhenClosedCheckBox.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||||
this.ExitWhenClosedCheckBox.UseVisualStyleBackColor = true;
|
this.ExitWhenClosedCheckBox.UseVisualStyleBackColor = true;
|
||||||
//
|
//
|
||||||
|
// AclAddr
|
||||||
|
//
|
||||||
|
this.AclAddr.Location = new System.Drawing.Point(117, 235);
|
||||||
|
this.AclAddr.Name = "AclAddr";
|
||||||
|
this.AclAddr.Size = new System.Drawing.Size(294, 23);
|
||||||
|
this.AclAddr.TabIndex = 19;
|
||||||
|
this.AclAddr.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||||
|
//
|
||||||
|
// AclLabel
|
||||||
|
//
|
||||||
|
this.AclLabel.AutoSize = true;
|
||||||
|
this.AclLabel.Location = new System.Drawing.Point(6, 238);
|
||||||
|
this.AclLabel.Name = "AclLabel";
|
||||||
|
this.AclLabel.Size = new System.Drawing.Size(78, 17);
|
||||||
|
this.AclLabel.TabIndex = 20;
|
||||||
|
this.AclLabel.Text = "Custom ACL";
|
||||||
|
//
|
||||||
// SettingForm
|
// SettingForm
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
|
||||||
@@ -542,5 +584,9 @@
|
|||||||
private System.Windows.Forms.CheckBox EnableStartedTcping_CheckBox;
|
private System.Windows.Forms.CheckBox EnableStartedTcping_CheckBox;
|
||||||
private System.Windows.Forms.Label DelayTestAfterStartup_Label;
|
private System.Windows.Forms.Label DelayTestAfterStartup_Label;
|
||||||
private System.Windows.Forms.Label DetectionInterval_Label;
|
private System.Windows.Forms.Label DetectionInterval_Label;
|
||||||
|
private System.Windows.Forms.Label RedirectorLabel;
|
||||||
|
private System.Windows.Forms.TextBox RedirectorTextBox;
|
||||||
|
private System.Windows.Forms.TextBox AclAddr;
|
||||||
|
private System.Windows.Forms.Label AclLabel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TaskScheduler;
|
using TaskScheduler;
|
||||||
@@ -69,6 +68,7 @@ namespace Netch.Forms
|
|||||||
|
|
||||||
Socks5PortTextBox.Text = Global.Settings.Socks5LocalPort.ToString();
|
Socks5PortTextBox.Text = Global.Settings.Socks5LocalPort.ToString();
|
||||||
HTTPPortTextBox.Text = Global.Settings.HTTPLocalPort.ToString();
|
HTTPPortTextBox.Text = Global.Settings.HTTPLocalPort.ToString();
|
||||||
|
RedirectorTextBox.Text = Global.Settings.RedirectorTCPPort.ToString();
|
||||||
|
|
||||||
TUNTAPAddressTextBox.Text = Global.Settings.TUNTAP.Address;
|
TUNTAPAddressTextBox.Text = Global.Settings.TUNTAP.Address;
|
||||||
TUNTAPNetmaskTextBox.Text = Global.Settings.TUNTAP.Netmask;
|
TUNTAPNetmaskTextBox.Text = Global.Settings.TUNTAP.Netmask;
|
||||||
@@ -95,6 +95,9 @@ namespace Netch.Forms
|
|||||||
STUN_ServerTextBox.Text = Global.Settings.STUN_Server.ToString();
|
STUN_ServerTextBox.Text = Global.Settings.STUN_Server.ToString();
|
||||||
STUN_ServerPortTextBox.Text = Global.Settings.STUN_Server_Port.ToString();
|
STUN_ServerPortTextBox.Text = Global.Settings.STUN_Server_Port.ToString();
|
||||||
|
|
||||||
|
AclLabel.Text = Utils.i18N.Translate(AclLabel.Text);
|
||||||
|
AclAddr.Text = Global.Settings.ACL.ToString();
|
||||||
|
|
||||||
if (Global.Settings.TUNTAP.DNS.Count > 0)
|
if (Global.Settings.TUNTAP.DNS.Count > 0)
|
||||||
{
|
{
|
||||||
var dns = "";
|
var dns = "";
|
||||||
@@ -238,6 +241,27 @@ namespace Netch.Forms
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var RedirectorPort = int.Parse(RedirectorTextBox.Text);
|
||||||
|
|
||||||
|
if (RedirectorPort > 0 && RedirectorPort < 65536)
|
||||||
|
{
|
||||||
|
Global.Settings.RedirectorTCPPort = RedirectorPort;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new FormatException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (FormatException)
|
||||||
|
{
|
||||||
|
RedirectorTextBox.Text = Global.Settings.RedirectorTCPPort.ToString();
|
||||||
|
MessageBox.Show(Utils.i18N.Translate("Port value illegal. Try again."), Utils.i18N.Translate("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (AllowDevicesCheckBox.Checked)
|
if (AllowDevicesCheckBox.Checked)
|
||||||
{
|
{
|
||||||
Global.Settings.LocalAddress = "0.0.0.0";
|
Global.Settings.LocalAddress = "0.0.0.0";
|
||||||
@@ -345,6 +369,8 @@ namespace Netch.Forms
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Global.Settings.ACL = AclAddr.Text;
|
||||||
|
|
||||||
Global.Settings.TUNTAP.Address = TUNTAPAddressTextBox.Text;
|
Global.Settings.TUNTAP.Address = TUNTAPAddressTextBox.Text;
|
||||||
Global.Settings.TUNTAP.Netmask = TUNTAPNetmaskTextBox.Text;
|
Global.Settings.TUNTAP.Netmask = TUNTAPNetmaskTextBox.Text;
|
||||||
Global.Settings.TUNTAP.Gateway = TUNTAPGatewayTextBox.Text;
|
Global.Settings.TUNTAP.Gateway = TUNTAPGatewayTextBox.Text;
|
||||||
|
|||||||
12
Netch/Forms/SubscribeForm.Designer.cs
generated
12
Netch/Forms/SubscribeForm.Designer.cs
generated
@@ -88,7 +88,7 @@
|
|||||||
this.UserAgentLabel.AutoSize = true;
|
this.UserAgentLabel.AutoSize = true;
|
||||||
this.UserAgentLabel.Location = new System.Drawing.Point(11, 77);
|
this.UserAgentLabel.Location = new System.Drawing.Point(11, 77);
|
||||||
this.UserAgentLabel.Name = "UserAgentLabel";
|
this.UserAgentLabel.Name = "UserAgentLabel";
|
||||||
this.UserAgentLabel.Size = new System.Drawing.Size(73, 17);
|
this.UserAgentLabel.Size = new System.Drawing.Size(74, 17);
|
||||||
this.UserAgentLabel.TabIndex = 5;
|
this.UserAgentLabel.TabIndex = 5;
|
||||||
this.UserAgentLabel.Text = "User-Agent";
|
this.UserAgentLabel.Text = "User-Agent";
|
||||||
//
|
//
|
||||||
@@ -150,6 +150,7 @@
|
|||||||
this.SubscribeLinkListView.TabIndex = 0;
|
this.SubscribeLinkListView.TabIndex = 0;
|
||||||
this.SubscribeLinkListView.UseCompatibleStateImageBehavior = false;
|
this.SubscribeLinkListView.UseCompatibleStateImageBehavior = false;
|
||||||
this.SubscribeLinkListView.View = System.Windows.Forms.View.Details;
|
this.SubscribeLinkListView.View = System.Windows.Forms.View.Details;
|
||||||
|
this.SubscribeLinkListView.SelectedIndexChanged += new System.EventHandler(this.SubscribeLinkListView_SelectedIndexChanged);
|
||||||
//
|
//
|
||||||
// RemarkColumnHeader
|
// RemarkColumnHeader
|
||||||
//
|
//
|
||||||
@@ -169,23 +170,22 @@
|
|||||||
// pContextMenuStrip
|
// pContextMenuStrip
|
||||||
//
|
//
|
||||||
this.pContextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
this.pContextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
this.DeleteToolStripMenuItem});
|
this.DeleteToolStripMenuItem,
|
||||||
this.pContextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
|
||||||
this.CopyLinkToolStripMenuItem});
|
this.CopyLinkToolStripMenuItem});
|
||||||
this.pContextMenuStrip.Name = "pContextMenuStrip";
|
this.pContextMenuStrip.Name = "pContextMenuStrip";
|
||||||
this.pContextMenuStrip.Size = new System.Drawing.Size(114, 26);
|
this.pContextMenuStrip.Size = new System.Drawing.Size(130, 48);
|
||||||
//
|
//
|
||||||
// DeleteToolStripMenuItem
|
// DeleteToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.DeleteToolStripMenuItem.Name = "DeleteToolStripMenuItem";
|
this.DeleteToolStripMenuItem.Name = "DeleteToolStripMenuItem";
|
||||||
this.DeleteToolStripMenuItem.Size = new System.Drawing.Size(113, 22);
|
this.DeleteToolStripMenuItem.Size = new System.Drawing.Size(129, 22);
|
||||||
this.DeleteToolStripMenuItem.Text = "Delete";
|
this.DeleteToolStripMenuItem.Text = "Delete";
|
||||||
this.DeleteToolStripMenuItem.Click += new System.EventHandler(this.DeleteToolStripMenuItem_Click);
|
this.DeleteToolStripMenuItem.Click += new System.EventHandler(this.DeleteToolStripMenuItem_Click);
|
||||||
//
|
//
|
||||||
// CopyLinkToolStripMenuItem
|
// CopyLinkToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.CopyLinkToolStripMenuItem.Name = "CopyLinkToolStripMenuItem";
|
this.CopyLinkToolStripMenuItem.Name = "CopyLinkToolStripMenuItem";
|
||||||
this.CopyLinkToolStripMenuItem.Size = new System.Drawing.Size(113, 22);
|
this.CopyLinkToolStripMenuItem.Size = new System.Drawing.Size(129, 22);
|
||||||
this.CopyLinkToolStripMenuItem.Text = "CopyLink";
|
this.CopyLinkToolStripMenuItem.Text = "CopyLink";
|
||||||
this.CopyLinkToolStripMenuItem.Click += new System.EventHandler(this.CopyLinkToolStripMenuItem_Click);
|
this.CopyLinkToolStripMenuItem.Click += new System.EventHandler(this.CopyLinkToolStripMenuItem_Click);
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using Netch.Models;
|
using System;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
@@ -144,5 +143,15 @@ namespace Netch.Forms
|
|||||||
MessageBox.Show(Utils.i18N.Translate("Successfully saved"), Utils.i18N.Translate("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
|
MessageBox.Show(Utils.i18N.Translate("Successfully saved"), Utils.i18N.Translate("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 订阅列表选中节点
|
||||||
|
/// TODO 选中节点编辑
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void SubscribeLinkListView_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
//MessageBox.Show(SubscribeLinkListView.SelectedItems + "", Utils.i18N.Translate("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
namespace Netch.Models
|
namespace Netch.Models
|
||||||
{
|
{
|
||||||
public class Profile
|
public class Profile
|
||||||
{
|
{
|
||||||
public string ServerRemark;
|
public string ServerRemark;
|
||||||
public string ModeRemark;
|
public string ModeRemark;
|
||||||
public string ProfileName;
|
public string ProfileName;
|
||||||
@@ -24,5 +24,5 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ namespace Netch.Models
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Redirector TCP 占用端口
|
/// Redirector TCP 占用端口
|
||||||
/// </summary>
|
/// </summary>
|
||||||
//public int RedirectorTCPPort = 2800;
|
public int RedirectorTCPPort = 3901;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// HTTP 和 Socks5 本地代理地址
|
/// HTTP 和 Socks5 本地代理地址
|
||||||
@@ -147,12 +147,12 @@ namespace Netch.Models
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// STUN测试服务器
|
/// STUN测试服务器
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string STUN_Server = "stun.l.google.com";
|
public string STUN_Server = "stun.stunprotocol.org";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// STUN测试服务器
|
/// STUN测试服务器
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int STUN_Server_Port = 19302;
|
public int STUN_Server_Port = 3478;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 是否切换为2号核心
|
/// 是否切换为2号核心
|
||||||
@@ -173,5 +173,11 @@ namespace Netch.Models
|
|||||||
/// 启动后延迟测试间隔/秒
|
/// 启动后延迟测试间隔/秒
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int StartedTcping_Interval = 3;
|
public int StartedTcping_Interval = 3;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ACL规则
|
||||||
|
/// </summary>
|
||||||
|
public string ACL = "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/banAD.acl";
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,8 +65,6 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="DNS" Version="5.0.0" />
|
|
||||||
<PackageReference Include="DnsClient" Version="1.2.0" />
|
|
||||||
<PackageReference Include="ini-parser" Version="2.5.2" />
|
<PackageReference Include="ini-parser" Version="2.5.2" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||||
<PackageReference Include="System.Buffers" Version="4.5.0" />
|
<PackageReference Include="System.Buffers" Version="4.5.0" />
|
||||||
@@ -112,4 +110,5 @@
|
|||||||
<Target Condition="'$(VisualStudioDir)' != ''" Name="PostBuild" AfterTargets="PostBuildEvent">
|
<Target Condition="'$(VisualStudioDir)' != ''" Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||||
<Exec Command="@ECHO OFF
RD /S /Q $(TargetDir)bin > NUL 2>&1
RD /S /Q $(TargetDir)i18n > NUL 2>&1
RD /S /Q $(TargetDir)mode > NUL 2>&1

MKDIR $(TargetDir)bin > NUL 2>&1
MKDIR $(TargetDir)i18n > NUL 2>&1
MKDIR $(TargetDir)mode > NUL 2>&1

COPY /Y $(SolutionDir)binaries\$(PlatformName)\* $(TargetDir)bin > NUL 2>&1
COPY /Y $(SolutionDir)binaries\* $(TargetDir)bin > NUL 2>&1
MOVE /Y $(TargetDir)bin\nfapinet.dll $(TargetDir)nfapinet.dll > NUL 2>&1
COPY /Y $(SolutionDir)translations\i18n\* $(TargetDir)i18n > NUL 2>&1
COPY /Y $(SolutionDir)modes\mode\*.txt $(TargetDir)mode > NUL 2>&1
MKDIR $(TargetDir)bin\tap-driver > NUL 2>&1
COPY /Y $(SolutionDir)binaries\$(PlatformName)\tap-driver\* $(TargetDir)bin\tap-driver > NUL 2>&1" />
|
<Exec Command="@ECHO OFF
RD /S /Q $(TargetDir)bin > NUL 2>&1
RD /S /Q $(TargetDir)i18n > NUL 2>&1
RD /S /Q $(TargetDir)mode > NUL 2>&1

MKDIR $(TargetDir)bin > NUL 2>&1
MKDIR $(TargetDir)i18n > NUL 2>&1
MKDIR $(TargetDir)mode > NUL 2>&1

COPY /Y $(SolutionDir)binaries\$(PlatformName)\* $(TargetDir)bin > NUL 2>&1
COPY /Y $(SolutionDir)binaries\* $(TargetDir)bin > NUL 2>&1
MOVE /Y $(TargetDir)bin\nfapinet.dll $(TargetDir)nfapinet.dll > NUL 2>&1
COPY /Y $(SolutionDir)translations\i18n\* $(TargetDir)i18n > NUL 2>&1
COPY /Y $(SolutionDir)modes\mode\*.txt $(TargetDir)mode > NUL 2>&1
MKDIR $(TargetDir)bin\tap-driver > NUL 2>&1
COPY /Y $(SolutionDir)binaries\$(PlatformName)\tap-driver\* $(TargetDir)bin\tap-driver > NUL 2>&1" />
|
||||||
</Target>
|
</Target>
|
||||||
|
<ProjectExtensions><VisualStudio><UserProperties /></VisualStudio></ProjectExtensions>
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using System.Reflection;
|
using Netch.Controllers;
|
||||||
|
using System.Reflection;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using Netch.Controllers;
|
|
||||||
|
|
||||||
// 有关程序集的一般信息由以下
|
// 有关程序集的一般信息由以下
|
||||||
// 控制。更改这些特性值可修改
|
// 控制。更改这些特性值可修改
|
||||||
|
|||||||
@@ -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<IResponse> 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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -23,8 +23,9 @@
|
|||||||
"Starting NatTester": "正在启动Nat测试",
|
"Starting NatTester": "正在启动Nat测试",
|
||||||
"Starting LocalDns service": "正在启动本地DNS服务",
|
"Starting LocalDns service": "正在启动本地DNS服务",
|
||||||
"Starting Redirector": "正在启动Redirector",
|
"Starting Redirector": "正在启动Redirector",
|
||||||
|
"ReStarting Redirector": "正常启动失败,正在尝试重新启动Redirector",
|
||||||
"Starting netfilter2 Service": "正在启动netfilter2服务",
|
"Starting netfilter2 Service": "正在启动netfilter2服务",
|
||||||
"Starting dns2tcp Service": "正在启动dns2tcp服务",
|
"Starting dns Service": "正在启动dns服务",
|
||||||
"SetupBypass": "设置绕行规则",
|
"SetupBypass": "设置绕行规则",
|
||||||
"Test failed": "测试失败",
|
"Test failed": "测试失败",
|
||||||
"Starting update subscription": "正在更新订阅",
|
"Starting update subscription": "正在更新订阅",
|
||||||
@@ -87,6 +88,9 @@
|
|||||||
"Modes have been reload": "模式已重载",
|
"Modes have been reload": "模式已重载",
|
||||||
"Clean DNS Cache": "清理 DNS 缓存",
|
"Clean DNS Cache": "清理 DNS 缓存",
|
||||||
"DNS cache cleanup succeeded": "DNS 缓存清理成功",
|
"DNS cache cleanup succeeded": "DNS 缓存清理成功",
|
||||||
|
"Update ACL": "更新ACL规则",
|
||||||
|
"ACL updated successfully": "ACL更新成功",
|
||||||
|
"ACL update failed": "ACL更新失败",
|
||||||
|
|
||||||
"About": "关于",
|
"About": "关于",
|
||||||
"Telegram Channel": "Telegram 频道",
|
"Telegram Channel": "Telegram 频道",
|
||||||
@@ -157,6 +161,7 @@
|
|||||||
"Delay test after startup": "启动后延迟测试",
|
"Delay test after startup": "启动后延迟测试",
|
||||||
"Enable": "启用",
|
"Enable": "启用",
|
||||||
"Detection interval(/s)": "检测间隔(/秒)",
|
"Detection interval(/s)": "检测间隔(/秒)",
|
||||||
|
"Custom ACL": "自定义ACL规则",
|
||||||
|
|
||||||
"Profile": "配置名",
|
"Profile": "配置名",
|
||||||
"Profiles": "配置",
|
"Profiles": "配置",
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using System.IO;
|
|||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.NetworkInformation;
|
using System.Net.NetworkInformation;
|
||||||
using System.Net.Sockets;
|
using System.Net.Sockets;
|
||||||
|
using System.Threading;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace Netch.Utils
|
namespace Netch.Utils
|
||||||
@@ -169,10 +170,13 @@ namespace Netch.Utils
|
|||||||
installProcess.Start();
|
installProcess.Start();
|
||||||
installProcess.WaitForExit();
|
installProcess.WaitForExit();
|
||||||
installProcess.Close();
|
installProcess.Close();
|
||||||
|
//给点时间,不然立马安装完毕就查找适配器可能会导致找不到适配器ID
|
||||||
|
Thread.Sleep(1000);
|
||||||
|
|
||||||
Global.TUNTAP.ComponentID = TUNTAP.GetComponentID();
|
Global.TUNTAP.ComponentID = TUNTAP.GetComponentID();
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
//MessageBox.Show(i18N.Translate("Please install TAP-Windows and create an TUN/TAP adapter manually"), i18N.Translate("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
|
//MessageBox.Show(i18N.Translate("Please install TAP-Windows and create an TUN/TAP adapter manually"), i18N.Translate("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
using System;
|
using Netch.Models;
|
||||||
|
using Netch.Models.SS;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
using Netch.Models;
|
|
||||||
using Netch.Models.SS;
|
|
||||||
using Newtonsoft.Json;
|
|
||||||
|
|
||||||
namespace Netch.Utils
|
namespace Netch.Utils
|
||||||
{
|
{
|
||||||
|
|||||||
2
binaries
2
binaries
Submodule binaries updated: a26274a834...b01d61e06f
2
modes
2
modes
Submodule modes updated: de2c3c7cf1...a9329cd3f1
Reference in New Issue
Block a user