mirror of
https://github.com/netchx/netch.git
synced 2026-05-11 23:45:06 +08:00
Compare commits
37 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e556ab1622 | ||
|
|
e8cb32f8c0 | ||
|
|
5b7be73427 | ||
|
|
76f9258953 | ||
|
|
141db8ad63 | ||
|
|
5c10b5c92d | ||
|
|
96a3d0cc52 | ||
|
|
f199641c64 | ||
|
|
65df583f0c | ||
|
|
cacbb5db16 | ||
|
|
feccfcab7a | ||
|
|
365d4b5ff5 | ||
|
|
704def859a | ||
|
|
a9433f8c22 | ||
|
|
d156ada795 | ||
|
|
be1e8eb8e6 | ||
|
|
0c63d8c80d | ||
|
|
5f9c944619 | ||
|
|
4e6bcdcf88 | ||
|
|
f244212cdf | ||
|
|
6649a1fce9 | ||
|
|
c31338ee1f | ||
|
|
5f3a300ccc | ||
|
|
bc0e88ae5e | ||
|
|
fac28ca88b | ||
|
|
5efd88b60c | ||
|
|
3f59a63766 | ||
|
|
8f14b030bb | ||
|
|
f941df0af2 | ||
|
|
13a66d0648 | ||
|
|
9548a3d03a | ||
|
|
c2f33ba15b | ||
|
|
2895989b13 | ||
|
|
7cddb75cef | ||
|
|
f05ae498c6 | ||
|
|
ff0fe2ab9f | ||
|
|
764e78d662 |
@@ -1,9 +1,8 @@
|
||||
using Netch.Forms;
|
||||
using Netch.Utils;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Threading;
|
||||
|
||||
namespace Netch.Controllers
|
||||
{
|
||||
@@ -15,23 +14,23 @@ namespace Netch.Controllers
|
||||
public Process Instance;
|
||||
|
||||
/// <summary>
|
||||
/// 启动NatTypeTester
|
||||
/// 启动DNS服务
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
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;
|
||||
@@ -39,11 +38,12 @@ namespace Netch.Controllers
|
||||
Instance.Start();
|
||||
Instance.BeginOutputReadLine();
|
||||
Instance.BeginErrorReadLine();
|
||||
Logging.Info("dns-unbound 启动完毕");
|
||||
return true;
|
||||
}
|
||||
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());
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
using Microsoft.Win32;
|
||||
using Netch.Utils;
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Netch.Controllers
|
||||
{
|
||||
@@ -53,7 +55,11 @@ namespace Netch.Controllers
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Utils.Logging.Info(e.ToString());
|
||||
if (System.Windows.Forms.MessageBox.Show(i18N.Translate("Failed to set the system proxy, it may be caused by the lack of dependent programs. Do you want to jump to Netch's official website to download dependent programs?"), i18N.Translate("Information"), MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == DialogResult.OK)
|
||||
{
|
||||
System.Diagnostics.Process.Start("https://netch.org/#/?id=%e4%be%9d%e8%b5%96");
|
||||
}
|
||||
Utils.Logging.Info("设置系统代理失败"+e.ToString());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using System;
|
||||
using Netch.Forms;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Netch.Controllers
|
||||
@@ -123,7 +123,14 @@ namespace Netch.Controllers
|
||||
pNTTController = new NTTController();
|
||||
}
|
||||
// 进程代理模式,启动 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)
|
||||
Task.Run(() =>
|
||||
{
|
||||
|
||||
@@ -40,18 +40,45 @@ namespace Netch.Controllers
|
||||
/// </summary>
|
||||
/// <param name="server">服务器</param>
|
||||
/// <param name="mode">模式</param>
|
||||
/// <param name="StopServiceAndRestart">先停止驱动服务再重新启动</param>
|
||||
/// <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))
|
||||
{
|
||||
//检查驱动版本号
|
||||
FileVersionInfo fileVerInfo = System.Diagnostics.FileVersionInfo.GetVersionInfo(driverPath);
|
||||
if (new Version(fileVerInfo.FileVersion) < new Version(UpdateChecker.NFDriverVersion))
|
||||
// 生成系统版本
|
||||
var version = $"{Environment.OSVersion.Version.Major.ToString()}.{Environment.OSVersion.Version.Minor.ToString()}";
|
||||
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
|
||||
{
|
||||
@@ -67,6 +94,8 @@ namespace Netch.Controllers
|
||||
File.Delete(driverPath);
|
||||
if (!InstallDriver())
|
||||
return false;
|
||||
|
||||
Utils.Logging.Info($"驱动更新完毕,当前驱动版本:{BinFileVerInfo.FileVersion}");
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
@@ -86,12 +115,13 @@ namespace Netch.Controllers
|
||||
{
|
||||
//启动驱动服务
|
||||
var service = new ServiceController("netfilter2");
|
||||
if (service.Status == ServiceControllerStatus.Running)
|
||||
if (service.Status == ServiceControllerStatus.Running && StopServiceAndRestart)
|
||||
{
|
||||
//防止其他程序占用 重置NF百万ID限制 待定
|
||||
/*service.Stop();
|
||||
//防止其他程序占用 重置NF百万ID限制
|
||||
service.Stop();
|
||||
service.WaitForStatus(ServiceControllerStatus.Stopped);
|
||||
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)
|
||||
{
|
||||
@@ -207,12 +237,11 @@ namespace Netch.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
Utils.Logging.Info($"{fallback}");
|
||||
|
||||
if (File.Exists("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.ErrorDataReceived += OnOutputDataReceived;
|
||||
State = Models.State.Starting;
|
||||
@@ -220,14 +249,19 @@ namespace Netch.Controllers
|
||||
Instance.BeginOutputReadLine();
|
||||
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)
|
||||
{
|
||||
Utils.Logging.Info($"成功启动Redirector耗时:{i + 1}秒");
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Utils.Logging.Info($"Redirector启动中,已耗时:{i + 1}秒");
|
||||
}
|
||||
}
|
||||
|
||||
Utils.Logging.Info("NF 进程启动超时");
|
||||
@@ -256,6 +290,7 @@ namespace Netch.Controllers
|
||||
public bool InstallDriver()
|
||||
{
|
||||
|
||||
Utils.Logging.Info("安装驱动中");
|
||||
// 生成系统版本
|
||||
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";
|
||||
}
|
||||
|
||||
|
||||
if (mode.BypassChina)
|
||||
{
|
||||
Instance.StartInfo.Arguments += " --acl default.acl";
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace Netch.Controllers
|
||||
|
||||
Instance = MainController.GetProcess();
|
||||
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))
|
||||
{
|
||||
|
||||
@@ -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
|
||||
{
|
||||
@@ -39,7 +39,7 @@ namespace Netch.Controllers
|
||||
public DNSController pDNSController = new DNSController();
|
||||
|
||||
// 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>
|
||||
/// 配置 TUNTAP 适配器
|
||||
@@ -68,6 +68,7 @@ namespace Netch.Controllers
|
||||
public bool SetupBypass()
|
||||
{
|
||||
MainForm.Instance.StatusText($"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("SetupBypass")}");
|
||||
Logging.Info("设置绕行规则->设置让服务器 IP 走直连");
|
||||
// 让服务器 IP 走直连
|
||||
foreach (var address in ServerAddresses)
|
||||
{
|
||||
@@ -80,6 +81,7 @@ namespace Netch.Controllers
|
||||
// 处理模式的绕过中国
|
||||
if (SavedMode.BypassChina)
|
||||
{
|
||||
Logging.Info("设置绕行规则->处理模式的绕过中国");
|
||||
using (var sr = new StringReader(Encoding.UTF8.GetString(Properties.Resources.CNIP)))
|
||||
{
|
||||
string text;
|
||||
@@ -93,6 +95,7 @@ namespace Netch.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
Logging.Info("设置绕行规则->处理全局绕过 IP");
|
||||
// 处理全局绕过 IP
|
||||
foreach (var ip in Global.Settings.BypassIPs)
|
||||
{
|
||||
@@ -105,6 +108,8 @@ namespace Netch.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
Logging.Info("设置绕行规则->处理绕过局域网 IP");
|
||||
// 处理绕过局域网 IP
|
||||
foreach (var ip in BypassLanIPs)
|
||||
{
|
||||
var info = ip.Split('/');
|
||||
@@ -118,6 +123,7 @@ namespace Netch.Controllers
|
||||
|
||||
if (SavedMode.Type == 2) // 处理仅规则内走直连
|
||||
{
|
||||
Logging.Info("设置绕行规则->处理仅规则内走直连");
|
||||
// 将 TUN/TAP 网卡权重放到最高
|
||||
var instance = new Process
|
||||
{
|
||||
@@ -132,6 +138,7 @@ namespace Netch.Controllers
|
||||
};
|
||||
instance.Start();
|
||||
|
||||
Logging.Info("设置绕行规则->创建默认路由");
|
||||
// 创建默认路由
|
||||
if (!NativeMethods.CreateRoute("0.0.0.0", 0, Global.Settings.TUNTAP.Gateway, Global.TUNTAP.Index, 10))
|
||||
{
|
||||
@@ -145,6 +152,8 @@ namespace Netch.Controllers
|
||||
return false;
|
||||
}
|
||||
|
||||
Logging.Info("设置绕行规则->创建规则路由");
|
||||
// 创建规则路由
|
||||
foreach (var ip in SavedMode.Rule)
|
||||
{
|
||||
var info = ip.Split('/');
|
||||
@@ -160,6 +169,7 @@ namespace Netch.Controllers
|
||||
}
|
||||
else if (SavedMode.Type == 1) // 处理仅规则内走代理
|
||||
{
|
||||
Logging.Info("设置绕行规则->处理仅规则内走代理");
|
||||
foreach (var ip in SavedMode.Rule)
|
||||
{
|
||||
var info = ip.Split('/');
|
||||
@@ -196,6 +206,7 @@ namespace Netch.Controllers
|
||||
//处理DNS代理
|
||||
if (Global.Settings.TUNTAP.ProxyDNS)
|
||||
{
|
||||
Logging.Info("设置绕行规则->处理自定义DNS代理");
|
||||
if (Global.Settings.TUNTAP.UseCustomDNS)
|
||||
{
|
||||
string dns = "";
|
||||
|
||||
@@ -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
|
||||
{
|
||||
@@ -26,8 +26,7 @@ namespace Netch.Controllers
|
||||
|
||||
public const string Name = @"Netch";
|
||||
public const string Copyright = @"Copyright © 2019 - 2020";
|
||||
public const string Version = @"1.4.0";
|
||||
public const string NFDriverVersion = @"1.5.9.0";
|
||||
public const string Version = @"1.4.3";
|
||||
|
||||
public async void Check(bool notifyNoFound, bool isPreRelease)
|
||||
{
|
||||
|
||||
@@ -126,19 +126,7 @@ namespace Netch.Controllers
|
||||
{
|
||||
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
|
||||
{
|
||||
|
||||
52
Netch/Forms/MainForm.Designer.cs
generated
52
Netch/Forms/MainForm.Designer.cs
generated
@@ -50,8 +50,12 @@ namespace Netch.Forms
|
||||
this.RestartServiceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.UninstallServiceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.CleanDNSCacheToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.UpdateACLToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.updateACLWithProxyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.reinstallTapDriverToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.AboutToolStripButton = new System.Windows.Forms.ToolStripButton();
|
||||
this.VersionLabel = new System.Windows.Forms.ToolStripLabel();
|
||||
this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.ConfigurationGroupBox = new System.Windows.Forms.GroupBox();
|
||||
this.configLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.ProfileLabel = new System.Windows.Forms.Label();
|
||||
@@ -108,7 +112,8 @@ namespace Netch.Forms
|
||||
this.SubscribeToolStripMenuItem,
|
||||
this.OptionsToolStripMenuItem,
|
||||
this.AboutToolStripButton,
|
||||
this.VersionLabel});
|
||||
this.VersionLabel,
|
||||
this.exitToolStripMenuItem});
|
||||
this.MenuStrip.Location = new System.Drawing.Point(0, 0);
|
||||
this.MenuStrip.Name = "MenuStrip";
|
||||
this.MenuStrip.RenderMode = System.Windows.Forms.ToolStripRenderMode.Professional;
|
||||
@@ -217,7 +222,10 @@ namespace Netch.Forms
|
||||
this.ReloadModesToolStripMenuItem,
|
||||
this.RestartServiceToolStripMenuItem,
|
||||
this.UninstallServiceToolStripMenuItem,
|
||||
this.CleanDNSCacheToolStripMenuItem});
|
||||
this.CleanDNSCacheToolStripMenuItem,
|
||||
this.UpdateACLToolStripMenuItem,
|
||||
this.updateACLWithProxyToolStripMenuItem,
|
||||
this.reinstallTapDriverToolStripMenuItem});
|
||||
this.OptionsToolStripMenuItem.Margin = new System.Windows.Forms.Padding(0, 0, 0, 1);
|
||||
this.OptionsToolStripMenuItem.Name = "OptionsToolStripMenuItem";
|
||||
this.OptionsToolStripMenuItem.Size = new System.Drawing.Size(66, 21);
|
||||
@@ -226,31 +234,52 @@ namespace Netch.Forms
|
||||
// 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.Click += new System.EventHandler(this.ReloadModesToolStripMenuItem_Click);
|
||||
//
|
||||
// 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.Click += new System.EventHandler(this.RestartServiceToolStripMenuItem_Click);
|
||||
//
|
||||
// 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.Click += new System.EventHandler(this.UninstallServiceToolStripMenuItem_Click);
|
||||
//
|
||||
// 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.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);
|
||||
//
|
||||
// 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);
|
||||
//
|
||||
// reinstallTapDriverToolStripMenuItem
|
||||
//
|
||||
this.reinstallTapDriverToolStripMenuItem.Name = "reinstallTapDriverToolStripMenuItem";
|
||||
this.reinstallTapDriverToolStripMenuItem.Size = new System.Drawing.Size(209, 22);
|
||||
this.reinstallTapDriverToolStripMenuItem.Text = "Reinstall Tap driver";
|
||||
this.reinstallTapDriverToolStripMenuItem.Click += new System.EventHandler(this.reinstallTapDriverToolStripMenuItem_Click);
|
||||
//
|
||||
// AboutToolStripButton
|
||||
//
|
||||
this.AboutToolStripButton.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;
|
||||
@@ -273,6 +302,13 @@ namespace Netch.Forms
|
||||
this.VersionLabel.Text = "x.x.x";
|
||||
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
|
||||
//
|
||||
this.ConfigurationGroupBox.Controls.Add(this.configLayoutPanel);
|
||||
@@ -698,5 +734,9 @@ namespace Netch.Forms
|
||||
private System.Windows.Forms.TableLayoutPanel configLayoutPanel;
|
||||
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2;
|
||||
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel3;
|
||||
private System.Windows.Forms.ToolStripMenuItem UpdateACLToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem updateACLWithProxyToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem reinstallTapDriverToolStripMenuItem;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,6 @@
|
||||
using Microsoft.Win32;
|
||||
using Netch.Controllers;
|
||||
using Netch.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
@@ -49,13 +51,35 @@ namespace Netch.Forms
|
||||
public MainForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
// 监听电源事件
|
||||
SystemEvents.PowerModeChanged += new PowerModeChangedEventHandler(SystemEvents_PowerModeChanged);
|
||||
|
||||
VersionLabel.Text = UpdateChecker.Version;
|
||||
|
||||
CheckForIllegalCrossThreadCalls = false;
|
||||
// MenuStrip.Renderer = new Override.ToolStripProfessionalRender();
|
||||
Instance = this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 监听电源事件,自动重启Netch服务
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
void SystemEvents_PowerModeChanged(object sender, PowerModeChangedEventArgs e)
|
||||
{
|
||||
switch (e.Mode)
|
||||
{
|
||||
case PowerModes.Suspend://操作系统即将挂起
|
||||
Logging.Info("操作系统即将挂起,自动停止===>" + DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"));
|
||||
ControlFun();
|
||||
break;
|
||||
case PowerModes.Resume://操作系统即将从挂起状态继续
|
||||
Logging.Info("操作系统即将从挂起状态继续,自动重启===>" + DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"));
|
||||
ControlFun();
|
||||
break;
|
||||
}
|
||||
}
|
||||
private void CheckUpdate()
|
||||
{
|
||||
var updater = new UpdateChecker();
|
||||
@@ -71,10 +95,16 @@ namespace Netch.Forms
|
||||
|
||||
public void TestServer()
|
||||
{
|
||||
Parallel.ForEach(Global.Settings.Server, new ParallelOptions { MaxDegreeOfParallelism = 16 }, server =>
|
||||
try
|
||||
{
|
||||
server.Test();
|
||||
});
|
||||
Parallel.ForEach(Global.Settings.Server, new ParallelOptions { MaxDegreeOfParallelism = 16 }, server =>
|
||||
{
|
||||
server.Test();
|
||||
});
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public void InitServer()
|
||||
@@ -325,10 +355,14 @@ namespace Netch.Forms
|
||||
ManageSubscribeLinksToolStripMenuItem.Text = Utils.i18N.Translate(ManageSubscribeLinksToolStripMenuItem.Text);
|
||||
UpdateServersFromSubscribeLinksToolStripMenuItem.Text = Utils.i18N.Translate(UpdateServersFromSubscribeLinksToolStripMenuItem.Text);
|
||||
OptionsToolStripMenuItem.Text = Utils.i18N.Translate(OptionsToolStripMenuItem.Text);
|
||||
exitToolStripMenuItem.Text = Utils.i18N.Translate(exitToolStripMenuItem.Text);
|
||||
RestartServiceToolStripMenuItem.Text = Utils.i18N.Translate(RestartServiceToolStripMenuItem.Text);
|
||||
UninstallServiceToolStripMenuItem.Text = Utils.i18N.Translate(UninstallServiceToolStripMenuItem.Text);
|
||||
ReloadModesToolStripMenuItem.Text = Utils.i18N.Translate(ReloadModesToolStripMenuItem.Text);
|
||||
CleanDNSCacheToolStripMenuItem.Text = Utils.i18N.Translate(CleanDNSCacheToolStripMenuItem.Text);
|
||||
UpdateACLToolStripMenuItem.Text = Utils.i18N.Translate(UpdateACLToolStripMenuItem.Text);
|
||||
updateACLWithProxyToolStripMenuItem.Text = Utils.i18N.Translate(updateACLWithProxyToolStripMenuItem.Text);
|
||||
reinstallTapDriverToolStripMenuItem.Text = Utils.i18N.Translate(reinstallTapDriverToolStripMenuItem.Text);
|
||||
AboutToolStripButton.Text = Utils.i18N.Translate(AboutToolStripButton.Text);
|
||||
ConfigurationGroupBox.Text = Utils.i18N.Translate(ConfigurationGroupBox.Text);
|
||||
ServerLabel.Text = Utils.i18N.Translate(ServerLabel.Text);
|
||||
@@ -474,6 +508,9 @@ namespace Netch.Forms
|
||||
|
||||
private void UpdateServersFromSubscribeLinksToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (Global.Settings.UseProxyToUpdateSubscription && ServerComboBox.SelectedIndex == -1)
|
||||
Global.Settings.UseProxyToUpdateSubscription = false;
|
||||
|
||||
if (Global.Settings.UseProxyToUpdateSubscription)
|
||||
{
|
||||
// 当前 ServerComboBox 中至少有一项
|
||||
@@ -542,6 +579,7 @@ namespace Netch.Forms
|
||||
foreach (var x in result)
|
||||
{
|
||||
x.Group = item.Remark;
|
||||
x.Remark = "[" + item.Remark + "] " + x.Remark;
|
||||
}
|
||||
Global.Settings.Server.AddRange(result);
|
||||
NotifyIcon.ShowBalloonTip(5,
|
||||
@@ -774,6 +812,12 @@ namespace Netch.Forms
|
||||
|
||||
private void ControlButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
ControlFun();
|
||||
}
|
||||
public void ControlFun()
|
||||
{
|
||||
//聚焦到启动按钮,防止模式选择框变成蓝色:D
|
||||
ControlButton.Focus();
|
||||
SaveConfigs();
|
||||
if (State == Models.State.Waiting || State == Models.State.Stopped)
|
||||
{
|
||||
@@ -791,7 +835,20 @@ namespace Netch.Forms
|
||||
return;
|
||||
}
|
||||
|
||||
MenuStrip.Enabled = ConfigurationGroupBox.Enabled = ControlButton.Enabled = SettingsButton.Enabled = false;
|
||||
//MenuStrip.Enabled = ConfigurationGroupBox.Enabled = ControlButton.Enabled = SettingsButton.Enabled = false;
|
||||
|
||||
//关闭启动按钮
|
||||
ControlButton.Enabled = false;
|
||||
|
||||
//关闭部分选项功能
|
||||
RestartServiceToolStripMenuItem.Enabled = false;
|
||||
UninstallServiceToolStripMenuItem.Enabled = false;
|
||||
updateACLWithProxyToolStripMenuItem.Enabled = false;
|
||||
UpdateServersFromSubscribeLinksToolStripMenuItem.Enabled = false;
|
||||
reinstallTapDriverToolStripMenuItem.Enabled = false;
|
||||
ServerComboBox.Enabled = false;
|
||||
ModeComboBox.Enabled = false;
|
||||
|
||||
ControlButton.Text = "...";
|
||||
StatusLabel.Text = $"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Starting")}";
|
||||
State = Models.State.Starting;
|
||||
@@ -885,8 +942,8 @@ namespace Netch.Forms
|
||||
if (State == Models.State.Started)
|
||||
{
|
||||
server.Test();
|
||||
// 重载服务器列表
|
||||
InitServer();
|
||||
// 重载服务器列表
|
||||
InitServer();
|
||||
|
||||
Thread.Sleep(Global.Settings.StartedTcping_Interval * 1000);
|
||||
}
|
||||
@@ -901,6 +958,17 @@ namespace Netch.Forms
|
||||
else
|
||||
{
|
||||
MenuStrip.Enabled = ConfigurationGroupBox.Enabled = ControlButton.Enabled = SettingsButton.Enabled = true;
|
||||
|
||||
RestartServiceToolStripMenuItem.Enabled = true;
|
||||
UninstallServiceToolStripMenuItem.Enabled = true;
|
||||
updateACLWithProxyToolStripMenuItem.Enabled = true;
|
||||
UpdateServersFromSubscribeLinksToolStripMenuItem.Enabled = true;
|
||||
reinstallTapDriverToolStripMenuItem.Enabled = true;
|
||||
ServerComboBox.Enabled = true;
|
||||
ModeComboBox.Enabled = true;
|
||||
//隐藏NTT测试
|
||||
NatTypeStatusLabel.Visible = false;
|
||||
|
||||
ControlButton.Text = Utils.i18N.Translate("Start");
|
||||
StatusLabel.Text = $"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Start failed")}";
|
||||
State = Models.State.Stopped;
|
||||
@@ -909,6 +977,7 @@ namespace Netch.Forms
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
ControlButton.Enabled = false;
|
||||
ControlButton.Text = "...";
|
||||
StatusLabel.Text = $"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Stopping")}";
|
||||
@@ -936,6 +1005,16 @@ namespace Netch.Forms
|
||||
ControlButton.Enabled = true;
|
||||
ProfileGroupBox.Enabled = true;
|
||||
|
||||
RestartServiceToolStripMenuItem.Enabled = true;
|
||||
UninstallServiceToolStripMenuItem.Enabled = true;
|
||||
updateACLWithProxyToolStripMenuItem.Enabled = true;
|
||||
UpdateServersFromSubscribeLinksToolStripMenuItem.Enabled = true;
|
||||
reinstallTapDriverToolStripMenuItem.Enabled = true;
|
||||
ServerComboBox.Enabled = true;
|
||||
ModeComboBox.Enabled = true;
|
||||
//隐藏NTT测试
|
||||
NatTypeStatusLabel.Visible = false;
|
||||
|
||||
ControlButton.Text = Utils.i18N.Translate("Start");
|
||||
StatusLabel.Text = $"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Stopped")}";
|
||||
State = Models.State.Stopped;
|
||||
@@ -943,8 +1022,8 @@ namespace Netch.Forms
|
||||
TestServer();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
private void ShowMainFormToolStripButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (WindowState == FormWindowState.Minimized)
|
||||
@@ -1275,6 +1354,7 @@ namespace Netch.Forms
|
||||
}
|
||||
public void NatTypeStatusText(string text)
|
||||
{
|
||||
NatTypeStatusLabel.Visible = true;
|
||||
if (!string.IsNullOrWhiteSpace(text))
|
||||
{
|
||||
NatTypeStatusLabel.Text = "NAT" + Utils.i18N.Translate(": ") + text;
|
||||
@@ -1284,5 +1364,158 @@ namespace Netch.Forms
|
||||
NatTypeStatusLabel.Text = "NAT" + Utils.i18N.Translate(": ") + Utils.i18N.Translate("Test failed");
|
||||
}
|
||||
}
|
||||
|
||||
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 updateACLToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
StatusText($"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Starting update ACL")}");
|
||||
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") + args.Error,
|
||||
ToolTipIcon.Error);*/
|
||||
MessageBox.Show(Utils.i18N.Translate("ACL update failed") + "\n" + args.Error);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
StatusText($"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Waiting for command")}");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
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") + args.Error,
|
||||
ToolTipIcon.Error);*/
|
||||
MessageBox.Show(Utils.i18N.Translate("ACL update failed") + "\n" + e.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
updateACLWithProxyToolStripMenuItem.Enabled = true;
|
||||
MenuStrip.Enabled = ConfigurationGroupBox.Enabled = ControlButton.Enabled = SettingsButton.Enabled = true;
|
||||
|
||||
ControlButton.Text = Utils.i18N.Translate("Start");
|
||||
StatusText($"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Waiting for command")}");
|
||||
MainController.Stop();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void reinstallTapDriverToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Task.Run(() =>
|
||||
{
|
||||
StatusText($"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Reinstalling Tap driver")}");
|
||||
Enabled = false;
|
||||
try
|
||||
{
|
||||
Configuration.deltapall();
|
||||
Configuration.addtap();
|
||||
NotifyIcon.ShowBalloonTip(5,
|
||||
UpdateChecker.Name, Utils.i18N.Translate("Reinstall Tap driver successfully"),
|
||||
ToolTipIcon.Info);
|
||||
}
|
||||
catch
|
||||
{
|
||||
NotifyIcon.ShowBalloonTip(5,
|
||||
UpdateChecker.Name, Utils.i18N.Translate("Reinstall Tap driver failed"),
|
||||
ToolTipIcon.Error);
|
||||
}
|
||||
finally
|
||||
{
|
||||
ControlButton.Text = Utils.i18N.Translate("Start");
|
||||
StatusText($"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Waiting for command")}");
|
||||
Enabled = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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));
|
||||
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.HTTPPortLabel = new System.Windows.Forms.Label();
|
||||
this.HTTPPortTextBox = new System.Windows.Forms.TextBox();
|
||||
@@ -68,6 +70,8 @@
|
||||
this.StartWhenOpenedCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.StopWhenExitedCheckBox = 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.TUNTAPGroupBox.SuspendLayout();
|
||||
this.BehaviorGroupBox.SuspendLayout();
|
||||
@@ -75,6 +79,8 @@
|
||||
//
|
||||
// PortGroupBox
|
||||
//
|
||||
this.PortGroupBox.Controls.Add(this.RedirectorLabel);
|
||||
this.PortGroupBox.Controls.Add(this.RedirectorTextBox);
|
||||
this.PortGroupBox.Controls.Add(this.AllowDevicesCheckBox);
|
||||
this.PortGroupBox.Controls.Add(this.HTTPPortLabel);
|
||||
this.PortGroupBox.Controls.Add(this.HTTPPortTextBox);
|
||||
@@ -87,10 +93,27 @@
|
||||
this.PortGroupBox.TabStop = false;
|
||||
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
|
||||
//
|
||||
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.Size = new System.Drawing.Size(206, 21);
|
||||
this.AllowDevicesCheckBox.TabIndex = 5;
|
||||
@@ -264,6 +287,8 @@
|
||||
//
|
||||
// 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_TextBox);
|
||||
this.BehaviorGroupBox.Controls.Add(this.EnableStartedTcping_CheckBox);
|
||||
@@ -329,7 +354,7 @@
|
||||
// BypassModeCheckBox
|
||||
//
|
||||
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.Size = new System.Drawing.Size(135, 21);
|
||||
this.BypassModeCheckBox.TabIndex = 14;
|
||||
@@ -340,7 +365,7 @@
|
||||
// Redirector2checkBox
|
||||
//
|
||||
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.Size = new System.Drawing.Size(118, 21);
|
||||
this.Redirector2checkBox.TabIndex = 11;
|
||||
@@ -350,7 +375,7 @@
|
||||
// ExperimentalFunction_Label
|
||||
//
|
||||
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.Size = new System.Drawing.Size(133, 17);
|
||||
this.ExperimentalFunction_Label.TabIndex = 13;
|
||||
@@ -471,6 +496,23 @@
|
||||
this.ExitWhenClosedCheckBox.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
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
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
|
||||
@@ -542,5 +584,9 @@
|
||||
private System.Windows.Forms.CheckBox EnableStartedTcping_CheckBox;
|
||||
private System.Windows.Forms.Label DelayTestAfterStartup_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.Collections;
|
||||
using System.Net;
|
||||
using System.Windows.Forms;
|
||||
using TaskScheduler;
|
||||
@@ -69,6 +68,7 @@ namespace Netch.Forms
|
||||
|
||||
Socks5PortTextBox.Text = Global.Settings.Socks5LocalPort.ToString();
|
||||
HTTPPortTextBox.Text = Global.Settings.HTTPLocalPort.ToString();
|
||||
RedirectorTextBox.Text = Global.Settings.RedirectorTCPPort.ToString();
|
||||
|
||||
TUNTAPAddressTextBox.Text = Global.Settings.TUNTAP.Address;
|
||||
TUNTAPNetmaskTextBox.Text = Global.Settings.TUNTAP.Netmask;
|
||||
@@ -95,6 +95,9 @@ namespace Netch.Forms
|
||||
STUN_ServerTextBox.Text = Global.Settings.STUN_Server.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)
|
||||
{
|
||||
var dns = "";
|
||||
@@ -238,6 +241,27 @@ namespace Netch.Forms
|
||||
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)
|
||||
{
|
||||
Global.Settings.LocalAddress = "0.0.0.0";
|
||||
@@ -340,11 +364,13 @@ namespace Netch.Forms
|
||||
catch (FormatException)
|
||||
{
|
||||
ProfileCount_TextBox.Text = Global.Settings.ProfileCount.ToString();
|
||||
MessageBox.Show(Utils.i18N.Translate("STUN_ServerPort value illegal. Try again."), Utils.i18N.Translate("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
MessageBox.Show(Utils.i18N.Translate("Detection interval value illegal. Try again."), Utils.i18N.Translate("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Global.Settings.ACL = AclAddr.Text;
|
||||
|
||||
Global.Settings.TUNTAP.Address = TUNTAPAddressTextBox.Text;
|
||||
Global.Settings.TUNTAP.Netmask = TUNTAPNetmaskTextBox.Text;
|
||||
Global.Settings.TUNTAP.Gateway = TUNTAPGatewayTextBox.Text;
|
||||
|
||||
22
Netch/Forms/SubscribeForm.Designer.cs
generated
22
Netch/Forms/SubscribeForm.Designer.cs
generated
@@ -62,7 +62,7 @@
|
||||
this.AddSubscriptionBox.Controls.Add(this.RemarkLabel);
|
||||
this.AddSubscriptionBox.Location = new System.Drawing.Point(12, 226);
|
||||
this.AddSubscriptionBox.Name = "AddSubscriptionBox";
|
||||
this.AddSubscriptionBox.Size = new System.Drawing.Size(660, 132);
|
||||
this.AddSubscriptionBox.Size = new System.Drawing.Size(660, 135);
|
||||
this.AddSubscriptionBox.TabIndex = 1;
|
||||
this.AddSubscriptionBox.TabStop = false;
|
||||
//
|
||||
@@ -75,11 +75,11 @@
|
||||
//
|
||||
// AddButton
|
||||
//
|
||||
this.AddButton.Location = new System.Drawing.Point(579, 103);
|
||||
this.AddButton.Location = new System.Drawing.Point(541, 103);
|
||||
this.AddButton.Name = "AddButton";
|
||||
this.AddButton.Size = new System.Drawing.Size(75, 23);
|
||||
this.AddButton.Size = new System.Drawing.Size(113, 26);
|
||||
this.AddButton.TabIndex = 7;
|
||||
this.AddButton.Text = "Add";
|
||||
this.AddButton.Text = "Add / Modify";
|
||||
this.AddButton.UseVisualStyleBackColor = true;
|
||||
this.AddButton.Click += new System.EventHandler(this.AddButton_Click);
|
||||
//
|
||||
@@ -88,7 +88,7 @@
|
||||
this.UserAgentLabel.AutoSize = true;
|
||||
this.UserAgentLabel.Location = new System.Drawing.Point(11, 77);
|
||||
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.Text = "User-Agent";
|
||||
//
|
||||
@@ -150,6 +150,7 @@
|
||||
this.SubscribeLinkListView.TabIndex = 0;
|
||||
this.SubscribeLinkListView.UseCompatibleStateImageBehavior = false;
|
||||
this.SubscribeLinkListView.View = System.Windows.Forms.View.Details;
|
||||
this.SubscribeLinkListView.SelectedIndexChanged += new System.EventHandler(this.SubscribeLinkListView_SelectedIndexChanged);
|
||||
//
|
||||
// RemarkColumnHeader
|
||||
//
|
||||
@@ -169,30 +170,29 @@
|
||||
// pContextMenuStrip
|
||||
//
|
||||
this.pContextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.DeleteToolStripMenuItem});
|
||||
this.pContextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.DeleteToolStripMenuItem,
|
||||
this.CopyLinkToolStripMenuItem});
|
||||
this.pContextMenuStrip.Name = "pContextMenuStrip";
|
||||
this.pContextMenuStrip.Size = new System.Drawing.Size(114, 26);
|
||||
this.pContextMenuStrip.Size = new System.Drawing.Size(130, 48);
|
||||
//
|
||||
// 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.Click += new System.EventHandler(this.DeleteToolStripMenuItem_Click);
|
||||
//
|
||||
// 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.Click += new System.EventHandler(this.CopyLinkToolStripMenuItem_Click);
|
||||
//
|
||||
// UseSelectedServerCheckBox
|
||||
//
|
||||
this.UseSelectedServerCheckBox.AutoSize = true;
|
||||
this.UseSelectedServerCheckBox.Location = new System.Drawing.Point(12, 364);
|
||||
this.UseSelectedServerCheckBox.Location = new System.Drawing.Point(12, 396);
|
||||
this.UseSelectedServerCheckBox.Name = "UseSelectedServerCheckBox";
|
||||
this.UseSelectedServerCheckBox.Size = new System.Drawing.Size(285, 21);
|
||||
this.UseSelectedServerCheckBox.TabIndex = 9;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Netch.Models;
|
||||
using Netch.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Netch.Forms
|
||||
@@ -49,7 +50,17 @@ namespace Netch.Forms
|
||||
ControlButton.Text = Utils.i18N.Translate(ControlButton.Text);
|
||||
|
||||
UserAgentTextBox.Text = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36";
|
||||
UseSelectedServerCheckBox.Checked = Global.Settings.UseProxyToUpdateSubscription;
|
||||
|
||||
if (Global.Settings.Server.Count > 0)
|
||||
{
|
||||
UseSelectedServerCheckBox.Enabled = true;
|
||||
UseSelectedServerCheckBox.Checked = Global.Settings.UseProxyToUpdateSubscription;
|
||||
}
|
||||
else
|
||||
{
|
||||
UseSelectedServerCheckBox.Checked = false;
|
||||
UseSelectedServerCheckBox.Enabled = false;
|
||||
}
|
||||
|
||||
InitSubscribeLink();
|
||||
}
|
||||
@@ -76,26 +87,33 @@ namespace Netch.Forms
|
||||
{
|
||||
if (SubscribeLinkListView.SelectedItems.Count > 0)
|
||||
{
|
||||
for (var i = SubscribeLinkListView.SelectedItems.Count - 1; i >= 0; i--)
|
||||
DeleteSubscribe();
|
||||
}
|
||||
}
|
||||
}
|
||||
public void DeleteSubscribe()
|
||||
{
|
||||
if (SubscribeLinkListView.SelectedItems.Count > 0)
|
||||
{
|
||||
for (var i = SubscribeLinkListView.SelectedItems.Count - 1; i >= 0; i--)
|
||||
{
|
||||
var item = SubscribeLinkListView.SelectedItems[i];
|
||||
var link = Global.Settings.SubscribeLink[item.Index];
|
||||
|
||||
var list = new List<Models.Server>();
|
||||
foreach (var server in Global.Settings.Server)
|
||||
{
|
||||
var item = SubscribeLinkListView.SelectedItems[i];
|
||||
var link = Global.Settings.SubscribeLink[item.Index];
|
||||
|
||||
var list = new List<Models.Server>();
|
||||
foreach (var server in Global.Settings.Server)
|
||||
if (server.Group != link.Remark)
|
||||
{
|
||||
if (server.Group != link.Remark)
|
||||
{
|
||||
list.Add(server);
|
||||
}
|
||||
list.Add(server);
|
||||
}
|
||||
|
||||
Global.Settings.Server = list;
|
||||
Global.Settings.SubscribeLink.RemoveAt(item.Index);
|
||||
SubscribeLinkListView.Items.Remove(item);
|
||||
|
||||
Global.MainForm.InitServer();
|
||||
}
|
||||
|
||||
Global.Settings.Server = list;
|
||||
Global.Settings.SubscribeLink.RemoveAt(item.Index);
|
||||
SubscribeLinkListView.Items.Remove(item);
|
||||
|
||||
Global.MainForm.InitServer();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -108,12 +126,56 @@ namespace Netch.Forms
|
||||
{
|
||||
if (LinkTextBox.Text.StartsWith("HTTP://", StringComparison.OrdinalIgnoreCase) || LinkTextBox.Text.StartsWith("HTTPS://", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
Global.Settings.SubscribeLink.Add(new Models.SubscribeLink
|
||||
//是否为新增订阅
|
||||
var saveFlag = true;
|
||||
Global.Settings.SubscribeLink.ForEach((subitem) =>
|
||||
{
|
||||
Remark = RemarkTextBox.Text,
|
||||
Link = LinkTextBox.Text,
|
||||
UserAgent = UserAgentTextBox.Text
|
||||
if (subitem.Link.Equals(LinkTextBox.Text))
|
||||
{
|
||||
if (!subitem.Remark.Equals(RemarkTextBox.Text))
|
||||
{
|
||||
//修改了订阅备注,删除旧订阅服务器
|
||||
Global.Settings.Server.ForEach((serverItem) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
//当前服务器组群组为订阅群组时批量修改备注
|
||||
if (serverItem.Group == subitem.Remark)
|
||||
{
|
||||
string OldServerRemark = "[" + serverItem.Group + "] ";
|
||||
Logging.Info(serverItem.Remark.Split(OldServerRemark.ToCharArray())[1]);
|
||||
serverItem.Remark = "[" + RemarkTextBox.Text + "] " + serverItem.Remark.Split(new string[] { OldServerRemark }, StringSplitOptions.None)[1];
|
||||
serverItem.Group = RemarkTextBox.Text;
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
});
|
||||
|
||||
subitem.Remark = RemarkTextBox.Text;
|
||||
Global.MainForm.InitServer();
|
||||
}
|
||||
|
||||
subitem.UserAgent = UserAgentTextBox.Text;
|
||||
saveFlag = false;
|
||||
|
||||
Utils.Configuration.Save();
|
||||
Global.Settings.UseProxyToUpdateSubscription = UseSelectedServerCheckBox.Checked;
|
||||
MessageBox.Show(Utils.i18N.Translate("Successfully saved"), Utils.i18N.Translate("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
|
||||
return;
|
||||
}
|
||||
});
|
||||
if (saveFlag)
|
||||
{
|
||||
Global.Settings.SubscribeLink.Add(new Models.SubscribeLink
|
||||
{
|
||||
Remark = RemarkTextBox.Text,
|
||||
Link = LinkTextBox.Text,
|
||||
UserAgent = UserAgentTextBox.Text
|
||||
});
|
||||
}
|
||||
|
||||
RemarkTextBox.Text = string.Empty;
|
||||
LinkTextBox.Text = string.Empty;
|
||||
@@ -144,5 +206,20 @@ namespace Netch.Forms
|
||||
MessageBox.Show(Utils.i18N.Translate("Successfully saved"), Utils.i18N.Translate("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
Close();
|
||||
}
|
||||
/// <summary>
|
||||
/// 订阅列表选中节点
|
||||
/// TODO 选中节点编辑
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void SubscribeLinkListView_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (SubscribeLinkListView.SelectedItems.Count > 0)
|
||||
{
|
||||
RemarkTextBox.Text = SubscribeLinkListView.SelectedItems[0].SubItems[0].Text;
|
||||
LinkTextBox.Text = SubscribeLinkListView.SelectedItems[0].SubItems[1].Text;
|
||||
UserAgentTextBox.Text = SubscribeLinkListView.SelectedItems[0].SubItems[2].Text;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
namespace Netch.Models
|
||||
{
|
||||
public class Profile
|
||||
{
|
||||
{
|
||||
public string ServerRemark;
|
||||
public string ModeRemark;
|
||||
public string ProfileName;
|
||||
@@ -24,5 +24,5 @@
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Netch.Models
|
||||
@@ -181,27 +178,11 @@ namespace Netch.Models
|
||||
var list = new Task<int>[3];
|
||||
for (var i = 0; i < 3; i++)
|
||||
{
|
||||
list[i] = Task.Run(() =>
|
||||
list[i] = Task.Run(async () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var client = new Socket(SocketType.Stream, ProtocolType.Tcp))
|
||||
{
|
||||
var watch = new Stopwatch();
|
||||
watch.Start();
|
||||
|
||||
var task = client.BeginConnect(new IPEndPoint(destination, Port), result =>
|
||||
{
|
||||
watch.Stop();
|
||||
}, 0);
|
||||
|
||||
if (task.AsyncWaitHandle.WaitOne(1000))
|
||||
{
|
||||
return (int)watch.ElapsedMilliseconds;
|
||||
}
|
||||
|
||||
return 1000;
|
||||
}
|
||||
return await Utils.Utils.TCPingAsync(destination, Port);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
@@ -210,7 +191,7 @@ namespace Netch.Models
|
||||
});
|
||||
}
|
||||
|
||||
Task.WaitAll(list);
|
||||
Task.WaitAll(list[0], list[1], list[2]);
|
||||
|
||||
var min = Math.Min(list[0].Result, list[1].Result);
|
||||
min = Math.Min(min, list[2].Result);
|
||||
|
||||
@@ -102,7 +102,7 @@ namespace Netch.Models
|
||||
/// <summary>
|
||||
/// Redirector TCP 占用端口
|
||||
/// </summary>
|
||||
//public int RedirectorTCPPort = 2800;
|
||||
public int RedirectorTCPPort = 3901;
|
||||
|
||||
/// <summary>
|
||||
/// HTTP 和 Socks5 本地代理地址
|
||||
@@ -147,12 +147,12 @@ namespace Netch.Models
|
||||
/// <summary>
|
||||
/// STUN测试服务器
|
||||
/// </summary>
|
||||
public string STUN_Server = "stun.l.google.com";
|
||||
public string STUN_Server = "stun.stunprotocol.org";
|
||||
|
||||
/// <summary>
|
||||
/// STUN测试服务器
|
||||
/// </summary>
|
||||
public int STUN_Server_Port = 19302;
|
||||
public int STUN_Server_Port = 3478;
|
||||
|
||||
/// <summary>
|
||||
/// 是否切换为2号核心
|
||||
@@ -173,5 +173,11 @@ namespace Netch.Models
|
||||
/// 启动后延迟测试间隔/秒
|
||||
/// </summary>
|
||||
public int StartedTcping_Interval = 3;
|
||||
|
||||
/// <summary>
|
||||
/// ACL规则
|
||||
/// </summary>
|
||||
public string ACL = "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/banAD.acl";
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using Microsoft.Win32;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
@@ -73,24 +74,16 @@ namespace Netch
|
||||
{
|
||||
// 加载语言
|
||||
Utils.i18N.Load(Encoding.UTF8.GetString(Properties.Resources.zh_CN));
|
||||
|
||||
// 记录当前程序语言
|
||||
Utils.Logging.Info($"当前程序语言:{culture}");
|
||||
}
|
||||
|
||||
// 记录当前程序语言
|
||||
Utils.Logging.Info($"当前程序语言:{culture}");
|
||||
|
||||
// 从外置文件中加载语言
|
||||
if (File.Exists($"i18n\\{culture}"))
|
||||
{
|
||||
// 加载语言
|
||||
Utils.i18N.Load(File.ReadAllText($"i18n\\{culture}"));
|
||||
|
||||
// 记录当前程序语言
|
||||
Utils.Logging.Info($"当前程序语言:{culture}");
|
||||
}
|
||||
else
|
||||
{
|
||||
// 记录日志
|
||||
Utils.Logging.Info("当前程序语言:en_US");
|
||||
}
|
||||
|
||||
// 检查是否已经运行
|
||||
|
||||
@@ -65,8 +65,6 @@
|
||||
</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="Newtonsoft.Json" Version="12.0.3" />
|
||||
<PackageReference Include="System.Buffers" Version="4.5.0" />
|
||||
@@ -110,6 +108,7 @@
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<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\tap-driver\* $(TargetDir)bin\tap-driver > NUL 2>&1" />
|
||||
</Target>
|
||||
<ProjectExtensions><VisualStudio><UserProperties /></VisualStudio></ProjectExtensions>
|
||||
</Project>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Reflection;
|
||||
using Netch.Controllers;
|
||||
using System.Reflection;
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,18 +16,20 @@
|
||||
"Started": "已启动",
|
||||
"Stopping": "正在停止中",
|
||||
"Stopped": "已停止",
|
||||
"Starting Shadowsocks": "正在启动Shadowsocks",
|
||||
"Starting ShadowsocksR": "正在启动ShadowsocksR",
|
||||
"Starting V2ray": "正在启动V2ray",
|
||||
"Starting Tap": "正在启动Tap",
|
||||
"Starting NatTester": "正在启动Nat测试",
|
||||
"Starting LocalDns service": "正在启动本地DNS服务",
|
||||
"Starting Redirector": "正在启动Redirector",
|
||||
"Starting netfilter2 Service": "正在启动netfilter2服务",
|
||||
"Starting dns2tcp Service": "正在启动dns2tcp服务",
|
||||
"Starting Shadowsocks": "正在启动 Shadowsocks",
|
||||
"Starting ShadowsocksR": "正在启动 ShadowsocksR",
|
||||
"Starting V2ray": "正在启动 V2Ray",
|
||||
"Starting Tap": "正在启动 TUN/TAP",
|
||||
"Starting NatTester": "正在启动 NAT 测试",
|
||||
"Starting LocalDns service": "正在启动本地 DNS 服务",
|
||||
"Starting Redirector": "正在启动 Redirector",
|
||||
"ReStarting Redirector": "正常启动失败,正在尝试重新启动 Redirector",
|
||||
"Starting netfilter2 Service": "正在启动 netfilter2 服务",
|
||||
"Starting dns Service": "正在启动 DNS 服务",
|
||||
"SetupBypass": "设置绕行规则",
|
||||
"Test failed": "测试失败",
|
||||
"Starting update subscription": "正在更新订阅",
|
||||
"Starting update ACL": "正在更新ACL",
|
||||
"Subscription updated": "订阅更新完毕",
|
||||
"Register driver": "正在注册驱动",
|
||||
|
||||
@@ -87,6 +89,14 @@
|
||||
"Modes have been reload": "模式已重载",
|
||||
"Clean DNS Cache": "清理 DNS 缓存",
|
||||
"DNS cache cleanup succeeded": "DNS 缓存清理成功",
|
||||
"Update ACL": "更新ACL规则",
|
||||
"Update ACL with proxy": "使用代理更新 ACL 规则",
|
||||
"ACL updated successfully": "ACL 更新成功",
|
||||
"ACL update failed": "ACL更新失败",
|
||||
"Reinstall Tap driver": "重新安装Tap驱动",
|
||||
"Reinstall Tap driver successfully": "重装Tap驱动成功",
|
||||
"Reinstall Tap driver failed": "重装Tap驱动失败",
|
||||
"Reinstalling Tap driver": "正在重装Tap驱动",
|
||||
|
||||
"About": "关于",
|
||||
"Telegram Channel": "Telegram 频道",
|
||||
@@ -98,7 +108,7 @@
|
||||
"Please select a server first": "请先选择一个服务器",
|
||||
"Please select an mode first": "请先选择一个模式",
|
||||
"Please enter a profile name first": "请先为该配置设置一个名称",
|
||||
"No saved profile here. Save a profile first by Ctrl+Click on the button": "当前按钮下没有保存配置,请先使用ctrl+左键点击该按钮保存一个配置",
|
||||
"No saved profile here. Save a profile first by Ctrl+Click on the button": "当前按钮下没有保存配置,请先使用 CTRL + 左键 点击该按钮保存一个配置",
|
||||
|
||||
"Used": "已使用",
|
||||
"Status": "状态",
|
||||
@@ -113,6 +123,7 @@
|
||||
"Add": "添加",
|
||||
"Scan": "扫描",
|
||||
"Save": "保存",
|
||||
"Add / Modify": "保存/修改",
|
||||
"Select a folder": "选择一个目录",
|
||||
"Please enter an process name (xxx.exe)": "请输入一个进程名(xxx.exe)",
|
||||
"Scan completed": "扫描完成",
|
||||
@@ -142,7 +153,7 @@
|
||||
"Netmask": "子网掩码",
|
||||
"Gateway": "网关",
|
||||
"Use Custom DNS": "使用自定义 DNS",
|
||||
"Proxy DNS in Mode 2": "在模式2下代理DNS",
|
||||
"Proxy DNS in Mode 2": "在模式 2 下代理 DNS",
|
||||
"Behavior": "行为",
|
||||
"Exit when closed": "关闭时退出",
|
||||
"Stop when exited": "退出时停止",
|
||||
@@ -151,12 +162,15 @@
|
||||
"Check update when opened": "打开软件时检查更新",
|
||||
"ProfileCount": "快捷配置数量(重启软件生效)",
|
||||
"ProfileCount value illegal. Try again.": "快捷配置数值非法。请重试。",
|
||||
"STUN_ServerPort value illegal. Try again.": "STUN端口数值非法。请重试。",
|
||||
"TUN/TAP driver is not detected. Is it installed now?": "未检测到TUN/TAP驱动,是否现在安装?",
|
||||
"STUN_ServerPort value illegal. Try again.": "STUN 端口数值非法。请重试。",
|
||||
"Detection interval value illegal. Try again.": "检测间隔值非法。请重试。",
|
||||
"TUN/TAP driver is not detected. Is it installed now?": "未检测到 TUN/TAP 驱动,是否现在安装?",
|
||||
"Failed to set the system proxy, it may be caused by the lack of dependent programs. Do you want to jump to Netch's official website to download dependent programs?": "设置系统代理失败,可能是缺少依赖导致,是否跳转Netch官网下载依赖程序?",
|
||||
"Experimental function": "实验性功能",
|
||||
"Delay test after startup": "启动后延迟测试",
|
||||
"Enable": "启用",
|
||||
"Detection interval(/s)": "检测间隔(/秒)",
|
||||
"Custom ACL": "自定义 ACL 规则",
|
||||
|
||||
"Profile": "配置名",
|
||||
"Profiles": "配置",
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.IO;
|
||||
using System.Net;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Net.Sockets;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Netch.Utils
|
||||
@@ -160,19 +161,16 @@ namespace Netch.Utils
|
||||
Global.TUNTAP.ComponentID = TUNTAP.GetComponentID();
|
||||
if (string.IsNullOrEmpty(Global.TUNTAP.ComponentID))
|
||||
{
|
||||
Logging.Info("未找到可用 TUN/TAP 适配器");
|
||||
if (MessageBox.Show(i18N.Translate("TUN/TAP driver is not detected. Is it installed now?"), i18N.Translate("Information"), MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == DialogResult.OK)
|
||||
{
|
||||
//安装Tap Driver
|
||||
Process installProcess = new Process();
|
||||
installProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
|
||||
installProcess.StartInfo.FileName = Path.Combine("bin/tap-driver", "install.bat");
|
||||
installProcess.Start();
|
||||
installProcess.WaitForExit();
|
||||
installProcess.Close();
|
||||
|
||||
addtap();
|
||||
//给点时间,不然立马安装完毕就查找适配器可能会导致找不到适配器ID
|
||||
Thread.Sleep(1000);
|
||||
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);
|
||||
@@ -195,5 +193,32 @@ namespace Netch.Utils
|
||||
Logging.Info("无法找到出口");
|
||||
return false;
|
||||
}
|
||||
/// <summary>
|
||||
/// 安装tap网卡
|
||||
/// </summary>
|
||||
public static void addtap()
|
||||
{
|
||||
Logging.Info("正在安装 TUN/TAP 适配器");
|
||||
//安装Tap Driver
|
||||
Process installProcess = new Process();
|
||||
installProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
|
||||
installProcess.StartInfo.FileName = Path.Combine("bin/tap-driver", "addtap.bat");
|
||||
installProcess.Start();
|
||||
installProcess.WaitForExit();
|
||||
installProcess.Close();
|
||||
}
|
||||
/// <summary>
|
||||
/// 卸载tap网卡
|
||||
/// </summary>
|
||||
public static void deltapall()
|
||||
{
|
||||
Logging.Info("正在卸载 TUN/TAP 适配器");
|
||||
Process installProcess = new Process();
|
||||
installProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
|
||||
installProcess.StartInfo.FileName = Path.Combine("bin/tap-driver", "deltapall.bat");
|
||||
installProcess.Start();
|
||||
installProcess.WaitForExit();
|
||||
installProcess.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
{
|
||||
@@ -28,7 +28,7 @@ namespace Netch.Utils
|
||||
/// <returns>加密后的字符串</returns>
|
||||
public static string URLSafeBase64Encode(string text)
|
||||
{
|
||||
return Convert.ToBase64String(Encoding.UTF8.GetBytes(text)).Replace("-", "+").Replace("_", "/").PadRight(text.Length + (4 - text.Length % 4) % 4, '=');
|
||||
return Convert.ToBase64String(Encoding.UTF8.GetBytes(text)).Replace("+", "-").Replace("/", "_").Replace("=", "");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
using System.Diagnostics;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Netch.Utils
|
||||
{
|
||||
@@ -40,5 +45,24 @@ namespace Netch.Utils
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static async Task<int> TCPingAsync(IPAddress ip, int port, int timeout = 1000, CancellationToken ct = default)
|
||||
{
|
||||
using var client = new TcpClient(ip.AddressFamily);
|
||||
var task = client.ConnectAsync(ip, port);
|
||||
|
||||
var stopwatch = new Stopwatch();
|
||||
stopwatch.Start();
|
||||
|
||||
var resTask = await Task.WhenAny(Task.Delay(timeout, ct), task);
|
||||
|
||||
stopwatch.Stop();
|
||||
if (resTask == task && client.Connected)
|
||||
{
|
||||
var t = Convert.ToInt32(stopwatch.Elapsed.TotalMilliseconds);
|
||||
return t;
|
||||
}
|
||||
return timeout;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
19
README.md
19
README.md
@@ -37,3 +37,22 @@ NyanCAT Network,全中转高质量节点,多条低倍率节点保证流量
|
||||
|
||||
- Microsoft Visual C++ Runtime
|
||||
- [.NET Framework 4.8](https://dotnet.microsoft.com/download/dotnet-framework/net48)
|
||||
|
||||
## Quote
|
||||
https://github.com/eycorsican/go-tun2socks
|
||||
|
||||
https://github.com/shadowsocks/shadowsocks-libev
|
||||
|
||||
https://github.com/shadowsocksrr/shadowsocksr-libev
|
||||
|
||||
https://github.com/v2ray/v2ray-core
|
||||
|
||||
https://github.com/ACL4SSR/ACL4SSR
|
||||
|
||||
https://github.com/felixonmars/dnsmasq-china-list
|
||||
|
||||
https://github.com/NLnetLabs/unbound
|
||||
|
||||
https://github.com/OpenVPN/tap-windows6
|
||||
|
||||
https://sourceforge.net/projects/ijbswa/
|
||||
|
||||
2
binaries
2
binaries
Submodule binaries updated: a26274a834...ed4f83dcdc
14
build.ps1
14
build.ps1
@@ -21,9 +21,11 @@ function Build-NetFrameworkx64
|
||||
if ($LASTEXITCODE) { cd $mainDir ; exit $LASTEXITCODE }
|
||||
|
||||
Write-Host 'Build x64 Complete ,Started Copy bin,mode,i18n file'
|
||||
|
||||
Copy-Item "$mainDir\binaries\x64\*" "$net_baseoutput\x64\Release\win-x64\bin"
|
||||
Copy-Item "$mainDir\binaries\x64\tap-driver" "$net_baseoutput\x64\Release\win-x64\bin\tap-driver" -recurse
|
||||
|
||||
mkdir "$net_baseoutput\x64\Release\win-x64\bin"
|
||||
Copy-Item "$mainDir\binaries\x64\*" -destination "$net_baseoutput\x64\Release\win-x64\bin" -recurse
|
||||
mkdir "$net_baseoutput\x64\Release\win-x64\bin\tap-driver"
|
||||
Copy-Item "$mainDir\binaries\tap-driver\*" -destination "$net_baseoutput\x64\Release\win-x64\bin\tap-driver" -recurse
|
||||
Copy-Item "$mainDir\binaries\*.acl" "$net_baseoutput\x64\Release\win-x64\bin"
|
||||
Copy-Item "$mainDir\binaries\*.conf" "$net_baseoutput\x64\Release\win-x64\bin"
|
||||
Copy-Item "$mainDir\binaries\*.dat" "$net_baseoutput\x64\Release\win-x64\bin"
|
||||
@@ -46,9 +48,11 @@ function Build-NetFrameworkx86
|
||||
if ($LASTEXITCODE) { cd $mainDir ; exit $LASTEXITCODE }
|
||||
|
||||
Write-Host 'Build x86 Complete ,Started Copy bin,mode,i18n file'
|
||||
|
||||
|
||||
mkdir "$net_baseoutput\x86\Release\win-x86\bin"
|
||||
Copy-Item "$mainDir\binaries\x86\*" "$net_baseoutput\x86\Release\win-x86\bin"
|
||||
Copy-Item "$mainDir\binaries\x86\tap-driver" "$net_baseoutput\x86\Release\win-x86\bin\tap-driver" -recurse
|
||||
mkdir "$net_baseoutput\x86\Release\win-x86\bin\tap-driver"
|
||||
Copy-Item "$mainDir\binaries\tap-driver\*" "$net_baseoutput\x86\Release\win-x86\bin\tap-driver" -recurse
|
||||
Copy-Item "$mainDir\binaries\*.acl" "$net_baseoutput\x86\Release\win-x86\bin"
|
||||
Copy-Item "$mainDir\binaries\*.conf" "$net_baseoutput\x86\Release\win-x86\bin"
|
||||
Copy-Item "$mainDir\binaries\*.dat" "$net_baseoutput\x86\Release\win-x86\bin"
|
||||
|
||||
@@ -45,4 +45,21 @@ NyanCAT Network,全中转高质量节点,多条低倍率节点保证流量
|
||||
|
||||
Netch 支持多种语言,在启动时会根据系统语言选择自身语言。如果需要手动切换语言,可以在启动时加入命令行参数,命令行参数为目前支持的语言代码,可以去 [NetchTranslation/i18n](https://github.com/NetchX/NetchTranslation/tree/master/i18n) 文件夹下查看外部支持的语言代码文件。Netch 目前内置 en-US,zh-CN,外置 zh-TW。欢迎大家为 [NetchTranslation](https://github.com/NetchX/NetchTranslation) 提供其他语言的翻译
|
||||
|
||||
## 引用
|
||||
https://github.com/eycorsican/go-tun2socks
|
||||
|
||||
https://github.com/shadowsocks/shadowsocks-libev
|
||||
|
||||
https://github.com/shadowsocksrr/shadowsocksr-libev
|
||||
|
||||
https://github.com/v2ray/v2ray-core
|
||||
|
||||
https://github.com/ACL4SSR/ACL4SSR
|
||||
|
||||
https://github.com/felixonmars/dnsmasq-china-list
|
||||
|
||||
https://github.com/NLnetLabs/unbound
|
||||
|
||||
https://github.com/OpenVPN/tap-windows6
|
||||
|
||||
https://sourceforge.net/projects/ijbswa/
|
||||
|
||||
2
modes
2
modes
Submodule modes updated: de2c3c7cf1...a9329cd3f1
Reference in New Issue
Block a user