Compare commits

..

35 Commits

Author SHA1 Message Date
Amazing_DM
853da97ffc Update NFController 2020-03-20 22:51:27 +08:00
Amazing_DM
a0fbcb588d :sparkles:添加白名单模式(可代理全局进程) 2020-03-20 22:37:59 +08:00
Amazing_DM
1e2c284a18 Update submodule 2020-03-20 20:40:05 +08:00
Amazing_DM
137456f6e6 Revert "解决MainForm Design页面报错问题"
This reverts commit 6c1d2c9e4e.
2020-03-20 17:21:39 +08:00
Amazing_DM
5fe0e33722 Merge pull request #254 from henning724/master
解决MainForm Design页面报错问题
2020-03-20 17:16:26 +08:00
henning724
6c1d2c9e4e 解决MainForm Design页面报错问题 2020-03-20 17:07:36 +08:00
Amazing_DM
0196dbb487 :bug:允许快捷配置数为0 2020-03-20 16:22:46 +08:00
Amazing_DM
0343a1ab0c Merge branch 'master' of https://github.com/NetchX/Netch 2020-03-20 16:18:19 +08:00
Amazing_DM
5ddc75ae16 :sparkles:实验性功能 2号核心:D
:art:改进NF启动
2020-03-20 16:18:09 +08:00
Amazing_DM
bcb587e4b5 Merge pull request #253 from henning724/master
提醒用户查看日志目录+配置数为0时,隐藏配置界面
2020-03-20 16:15:08 +08:00
henning
ba50a23914 配置数为0时,隐藏配置界面 2020-03-20 16:06:05 +08:00
henning
1912d2055f 提醒用户查看日志目录 2020-03-20 15:21:35 +08:00
Amazing_DM
ab2348afc7 Update build.yml 2020-03-20 13:08:13 +08:00
Amazing_DM
a42890fdbd Update and rename dotnetcore.yml to build.yml 2020-03-20 13:02:25 +08:00
Amazing_DM
5d96127b5a Merge pull request #252 from henning724/master
添加配置(profile)相关提示框
2020-03-20 10:53:01 +08:00
henning
f2912a334a 添加配置(profile)相关提示框 2020-03-20 10:46:48 +08:00
Amazing_DM
09bddd9ad4 :sparkles:启动后将自动以 1秒/次 的速度测试节点延迟(Tcping) 2020-03-19 23:15:12 +08:00
Amazing_DM
8fc4e3151f Create GetSHA256.ps1 2020-03-19 22:28:47 +08:00
Amazing_DM
d616380deb Update README.md 2020-03-19 22:04:08 +08:00
Amazing_DM
c6817e39b2 Merge pull request #251 from AmazingDM/master
:construction_worker:更新CI构建
2020-03-19 22:03:25 +08:00
Amazing_DM
b08cd53cee :construction_worker:更新CI构建 2020-03-19 21:54:37 +08:00
Amazing_DM
bf8dd98013 :construction_worker:添加CI构建系统 2020-03-19 17:24:15 +08:00
Amazing_DM
89c3ffaaf6 Revert "upd"
This reverts commit 1dcb96819b.
2020-03-19 13:05:01 +08:00
Amazing_DM
1dcb96819b upd 2020-03-19 13:03:03 +08:00
Amazing_DM
e33cd6d2d2 Update submodule
:sparkles:ssr添加rc4-md5-6加密支持
:sparkles:启动前清除dns
:art:增加启动成功率(:D
:globe_with_meridians:更新翻译文件
2020-03-19 12:30:58 +08:00
Connection Refused
7998be0c74 Update README.zh-CN.md 2020-03-16 18:47:40 +08:00
Connection Refused
238892ea2c Update README.md 2020-03-16 18:47:07 +08:00
Connection Refused
08332667ad Update README.md 2020-03-16 18:46:48 +08:00
Connection Refused
bc6bc52b9a Update README.md 2020-03-16 18:46:20 +08:00
Amazing_DM
2977afe00e :bug:修复2个小bug
Update submodule
2020-03-13 17:42:03 +08:00
Amazing_DM
f36ff457b4 修复NF启动超时bug 2020-03-13 14:50:16 +08:00
Amazing_DM
d1d58cc39c Update submodule 2020-03-13 10:11:58 +08:00
Amazing_DM
bd0b3a6f2e :lipstick:优化NTT测试结果 2020-03-12 16:20:09 +08:00
Amazing_DM
35eae6094e Merge pull request #250 from ColdThunder11/master
Support DNS proxy and NAT type test in mode2
2020-03-12 15:34:15 +08:00
ColdThunder11
725fdc2e9a Support DNS proxy and NAT type test in mode2 2020-03-12 15:29:34 +08:00
21 changed files with 710 additions and 186 deletions

71
.github/workflows/build.yml vendored Normal file
View File

@@ -0,0 +1,71 @@
name: GitHub Actions & Netch CI
on: [push]
jobs:
build:
name: Build
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Get tag name
uses: olegtarasov/get-tag@v1
- name: submodules-init
uses: snickerbockers/submodules-init@v4
- uses: nuget/setup-nuget@v1
- run: nuget restore Netch.sln
- name: Setup MSBuild.exe
uses: microsoft/setup-msbuild@v1.0.0
- name: Build .NET 4.8 Netch
shell: pwsh
run: |
.\build.ps1
New-Item -ItemType Directory -Path C:\builtfiles -Force > $null
Compress-Archive -Path Netch\bin\x64\Release\win-x64\* -DestinationPath C:\builtfiles\Netch.x64-${{ env.GITHUB_TAG_NAME }}.zip
echo "::set-env name=Netch64_SHA256::$(.\getSHA256.ps1 C:\builtfiles\Netch.x64-${{ env.GITHUB_TAG_NAME }}.zip)"
Compress-Archive -Path Netch\bin\x86\Release\win-x86\* -DestinationPath C:\builtfiles\Netch.x86-${{ env.GITHUB_TAG_NAME }}.zip
echo "::set-env name=Netch86_SHA256::$(.\getSHA256.ps1 C:\builtfiles\Netch.x86-${{ env.GITHUB_TAG_NAME }}.zip)"
- name: Upload Netch.x64
uses: actions/upload-artifact@v1
with:
name: Netch.x64
path: Netch\bin\x64\Release\win-x64
- name: Upload Netch.x86
uses: actions/upload-artifact@v1
with:
name: Netch.x86
path: Netch\bin\x86\Release\win-x86
# Create a new release: create a tag, then 'git push origin <tagname>', wait for it to build
- name: Create a new GitHub release if a new tag is pushed
uses: softprops/action-gh-release@v1
with:
name: ${{ env.GITHUB_TAG_NAME }}
prerelease: true
draft: false
files: |
C:\builtfiles\Netch.x64-${{ env.GITHUB_TAG_NAME }}.zip
C:\builtfiles\Netch.x86-${{ env.GITHUB_TAG_NAME }}.zip
body: |
[![](https://img.shields.io/badge/Telegram-Channel-blue)](https://t.me/Netch) [![](https://img.shields.io/badge/Telegram-Group-green)](https://t.me/Netch_Discuss_Group)
## 更新日志:
* 这是 GitHub Action 自动化部署,更新日志应该很快会手动更新:D
## 文件校验
| 文件名 | SHA256 |
| :- | :- |
| <sub>Netch.x64-${{ env.GITHUB_TAG_NAME }}.zip</sub> | <sub>${{ env.Netch64_SHA256 }}</sub> |
| <sub>Netch.x86-${{ env.GITHUB_TAG_NAME }}.zip</sub> | <sub>${{ env.Netch86_SHA256 }}</sub> |
if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

5
GetSHA256.ps1 Normal file
View File

@@ -0,0 +1,5 @@
param([string]$file)
$hash = [Security.Cryptography.HashAlgorithm]::Create( "SHA256" )
$stream = ([IO.StreamReader]$file).BaseStream
-join ($hash.ComputeHash($stream) | ForEach { "{0:X2}" -f $_ })
$stream.Close()

View File

@@ -1,12 +1,16 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
namespace Netch.Controllers
{
public class MainController
{
[DllImport("dnsapi", EntryPoint = "DnsFlushResolverCache")]
public static extern UInt32 FlushDNSResolverCache();
public static Process GetProcess()
{
var process = new Process();
@@ -65,6 +69,8 @@ namespace Netch.Controllers
/// <returns>是否启动成功</returns>
public bool Start(Models.Server server, Models.Mode mode)
{
FlushDNSResolverCache();
var result = false;
switch (server.Type)
{

View File

@@ -32,6 +32,9 @@ namespace Netch.Controllers
/// </summary>
public Models.State State = Models.State.Waiting;
// 生成驱动文件路径
public string driverPath = string.Format("{0}\\drivers\\netfilter2.sys", Environment.SystemDirectory);
/// <summary>
/// 启动
/// </summary>
@@ -41,64 +44,56 @@ namespace Netch.Controllers
public bool Start(Models.Server server, Models.Mode mode)
{
MainForm.Instance.StatusText($"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Starting Redirector")}");
if (!File.Exists("bin\\Redirector.exe"))
{
return false;
}
// 生成驱动文件路径
var driver = string.Format("{0}\\drivers\\netfilter2.sys", Environment.SystemDirectory);
// 检查驱动是否存在
if (!File.Exists(driver))
if (File.Exists(driverPath))
{
// 生成系统版本
var version = $"{Environment.OSVersion.Version.Major.ToString()}.{Environment.OSVersion.Version.Minor.ToString()}";
// 检查系统版本并复制对应驱动
try
//检查驱动版本
FileVersionInfo fileVerInfo = System.Diagnostics.FileVersionInfo.GetVersionInfo(driverPath);
if (new Version(fileVerInfo.FileVersion) < new Version(UpdateChecker.NFDriverVersion))
{
switch (version)
//需要更新驱动
try
{
case "10.0":
File.Copy("bin\\Win-10.sys", driver);
Utils.Logging.Info("已复制 Win10 驱动");
break;
case "6.3":
case "6.2":
File.Copy("bin\\Win-8.sys", driver);
Utils.Logging.Info("已复制 Win8 驱动");
break;
case "6.1":
case "6.0":
File.Copy("bin\\Win-7.sys", driver);
Utils.Logging.Info("已复制 Win7 驱动");
break;
default:
Utils.Logging.Info($"不支持的系统版本:{version}");
var service = new ServiceController("netfilter2");
if (service.Status == ServiceControllerStatus.Running)
{
service.Stop();
service.WaitForStatus(ServiceControllerStatus.Stopped);
}
nfapinet.NFAPI.nf_unRegisterDriver("netfilter2");
//删除老驱动
File.Delete(driverPath);
if (!InstallDriver())
return false;
}
}
catch (Exception e)
{
Utils.Logging.Info("复制驱动文件失败");
Utils.Logging.Info(e.ToString());
return false;
catch (Exception)
{
Utils.Logging.Info($"更新驱动出错");
}
}
// 注册驱动文件
var result = nfapinet.NFAPI.nf_registerDriver("netfilter2");
if (result != nfapinet.NF_STATUS.NF_STATUS_SUCCESS)
{
Utils.Logging.Info($"注册驱动失败,返回值:{result}");
}
else
{
if (!InstallDriver())
return false;
}
}
try
{
//启动驱动服务
var service = new ServiceController("netfilter2");
if (service.Status == ServiceControllerStatus.Stopped)
if (service.Status == ServiceControllerStatus.Running)
{
//防止其他程序占用 重置NF百万ID限制 待定
/*service.Stop();
MainForm.Instance.StatusText($"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Starting netfilter2 Service")}");
service.Start();*/
}
else if (service.Status == ServiceControllerStatus.Stopped)
{
MainForm.Instance.StatusText($"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Starting netfilter2 Service")}");
service.Start();
@@ -116,7 +111,13 @@ namespace Netch.Controllers
}
}
var processes = "NTT.exe,";
var processes = "";
//开启进程白名单模式
if (!Global.Settings.ProcessBypassMode)
{
processes += "NTT.exe,";
}
foreach (var proc in mode.Rule)
{
@@ -126,31 +127,91 @@ namespace Netch.Controllers
processes = processes.Substring(0, processes.Length - 1);
Instance = MainController.GetProcess();
Instance.StartInfo.FileName = "bin\\Redirector.exe";
var fallback = "";
if (server.Type != "Socks5")
if (Global.Settings.UseRedirector2)
{
fallback = $"-r 127.0.0.1:{Global.Settings.Socks5LocalPort} -p \"{processes}\"";
if (!File.Exists("bin\\Redirector2.exe"))
{
return false;
}
Instance.StartInfo.FileName = "bin\\Redirector2.exe";
if (server.Type != "Socks5")
{
fallback += $" 127.0.0.1:{Global.Settings.Socks5LocalPort}";
fallback += $" \"{processes}\"";
}
else
{
var result = Utils.DNS.Lookup(server.Hostname);
if (result == null)
{
Utils.Logging.Info("无法解析服务器 IP 地址");
return false;
}
fallback += $" {result}:{server.Port}";
fallback += $" \"{processes}\"";
if (!string.IsNullOrWhiteSpace(server.Username) && !string.IsNullOrWhiteSpace(server.Password))
{
fallback += $" \"{server.Username}\"";
fallback += $" \"{server.Password}\"";
}
}
}
else
{
var result = Utils.DNS.Lookup(server.Hostname);
if (result == null)
if (!File.Exists("bin\\Redirector.exe"))
{
Utils.Logging.Info("无法解析服务器 IP 地址");
return false;
}
Instance.StartInfo.FileName = "bin\\Redirector.exe";
fallback = $"-r {result}:{server.Port} -p \"{processes}\"";
if (!string.IsNullOrWhiteSpace(server.Username) && !string.IsNullOrWhiteSpace(server.Password))
//开启进程白名单模式
if (Global.Settings.ProcessBypassMode)
{
fallback += $" -username \"{server.Username}\" -password \"{server.Password}\"";
processes += ",Shadowsocks.exe";
processes += ",ShadowsocksR.exe";
processes += ",Privoxy.exe";
processes += ",simple-obfs.exe";
processes += ",v2ray.exe,v2ctl.exe,v2ray-plugin.exe";
fallback += " -bypass true ";
}
else
{
fallback += " -bypass false ";
}
if (server.Type != "Socks5")
{
fallback += $"-r 127.0.0.1:{Global.Settings.Socks5LocalPort} -p \"{processes}\"";
}
else
{
var result = Utils.DNS.Lookup(server.Hostname);
if (result == null)
{
Utils.Logging.Info("无法解析服务器 IP 地址");
return false;
}
fallback += $"-r {result}:{server.Port} -p \"{processes}\"";
if (!string.IsNullOrWhiteSpace(server.Username) && !string.IsNullOrWhiteSpace(server.Password))
{
fallback += $" -username \"{server.Username}\" -password \"{server.Password}\"";
}
}
}
Utils.Logging.Info($"{fallback}");
if (File.Exists("logging\\redirector.log"))
File.Delete("logging\\redirector.log");
Instance.StartInfo.Arguments = fallback;
Instance.OutputDataReceived += OnOutputDataReceived;
Instance.ErrorDataReceived += OnOutputDataReceived;
@@ -192,6 +253,52 @@ namespace Netch.Controllers
Utils.Logging.Info(e.ToString());
}
}
public bool InstallDriver()
{
// 生成系统版本
var version = $"{Environment.OSVersion.Version.Major.ToString()}.{Environment.OSVersion.Version.Minor.ToString()}";
// 检查系统版本并复制对应驱动
try
{
switch (version)
{
case "10.0":
File.Copy("bin\\Win-10.sys", driverPath);
Utils.Logging.Info("已复制 Win10 驱动");
break;
case "6.3":
case "6.2":
File.Copy("bin\\Win-8.sys", driverPath);
Utils.Logging.Info("已复制 Win8 驱动");
break;
case "6.1":
case "6.0":
File.Copy("bin\\Win-7.sys", driverPath);
Utils.Logging.Info("已复制 Win7 驱动");
break;
default:
Utils.Logging.Info($"不支持的系统版本:{version}");
return false;
}
}
catch (Exception e)
{
Utils.Logging.Info("复制驱动文件失败");
Utils.Logging.Info(e.ToString());
return false;
}
MainForm.Instance.StatusText($"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Register driver")}");
// 注册驱动文件
var result = nfapinet.NFAPI.nf_registerDriver("netfilter2");
if (result != nfapinet.NF_STATUS.NF_STATUS_SUCCESS)
{
Utils.Logging.Info($"注册驱动失败,返回值:{result}");
return false;
}
return true;
}
public void OnOutputDataReceived(object sender, DataReceivedEventArgs e)
{
@@ -205,7 +312,7 @@ namespace Netch.Controllers
{
State = Models.State.Stopped;
}
else if (e.Data.Contains("Redirect to"))
else if (e.Data.Contains("Start") || e.Data.Contains("Redirect to"))
{
State = Models.State.Started;
}

View File

@@ -24,6 +24,7 @@ namespace Netch.Controllers
/// <returns></returns>
public (bool, string, string, string) Start()
{
Thread.Sleep(1000);
MainForm.Instance.NatTypeStatusText($"{Utils.i18N.Translate("Starting NatTester")}");
try
{

View File

@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Net;
@@ -37,6 +38,9 @@ namespace Netch.Controllers
/// </summary>
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" };
/// <summary>
/// 配置 TUNTAP 适配器
/// </summary>
@@ -101,6 +105,17 @@ namespace Netch.Controllers
}
}
foreach (var ip in BypassLanIPs)
{
var info = ip.Split('/');
var address = IPAddress.Parse(info[0]);
if (!IPAddress.IsLoopback(address))
{
NativeMethods.CreateRoute(address.ToString(), int.Parse(info[1]), Global.Adapter.Gateway.ToString(), Global.Adapter.Index);
}
}
if (SavedMode.Type == 2) // 处理仅规则内走直连
{
// 将 TUN/TAP 网卡权重放到最高
@@ -157,6 +172,54 @@ namespace Netch.Controllers
}
}
}
//处理NAT类型检测由于协议的原因无法仅通过域名确定需要代理的IP自己记录解析了返回的IP仅支持默认检测服务器
if (Global.Settings.STUN_Server == "stun.stunprotocol.org")
{
try
{
var nttAddress = Dns.GetHostAddresses(Global.Settings.STUN_Server)[0];
if (int.TryParse("32", out var prefix))
{
NativeMethods.CreateRoute(nttAddress.ToString(), prefix, Global.Settings.TUNTAP.Gateway, Global.TUNTAP.Index);
}
var nttrAddress = Dns.GetHostAddresses("stunresponse.coldthunder11.com")[0];
if (int.TryParse("32", out var prefixr))
{
NativeMethods.CreateRoute(nttrAddress.ToString(), prefixr, Global.Settings.TUNTAP.Gateway, Global.TUNTAP.Index);
}
}
catch
{
Logging.Info("NAT类型测试域名解析失败将不会被添加到代理列表。");
}
}
//处理DNS代理
if (Global.Settings.TUNTAP.ProxyDNS)
{
if (Global.Settings.TUNTAP.UseCustomDNS)
{
string dns = "";
foreach (var value in Global.Settings.TUNTAP.DNS)
{
dns += value;
dns += ',';
}
dns = dns.Trim();
dns = dns.Substring(0, dns.Length - 1);
if (int.TryParse("32", out var prefix))
{
NativeMethods.CreateRoute(dns, prefix, Global.Settings.TUNTAP.Gateway, Global.TUNTAP.Index);
}
}
else
{
if (int.TryParse("32", out var prefix))
{
NativeMethods.CreateRoute("1.1.1.1", prefix, Global.Settings.TUNTAP.Gateway, Global.TUNTAP.Index);
}
}
}
}
return true;
}
@@ -198,6 +261,49 @@ namespace Netch.Controllers
}
}
}
if (Global.Settings.STUN_Server == "stun.stunprotocol.org")
{
try
{
var nttAddress = Dns.GetHostAddresses(Global.Settings.STUN_Server)[0];
if (int.TryParse("32", out var prefix))
{
NativeMethods.DeleteRoute(nttAddress.ToString(), prefix, Global.Settings.TUNTAP.Gateway, Global.TUNTAP.Index);
}
var nttrAddress = Dns.GetHostAddresses("stunresponse.coldthunder11.com")[0];
if (int.TryParse("32", out var prefixr))
{
NativeMethods.DeleteRoute(nttrAddress.ToString(), prefixr, Global.Settings.TUNTAP.Gateway, Global.TUNTAP.Index);
}
}
catch { }
}
if (Global.Settings.TUNTAP.ProxyDNS)
{
if (Global.Settings.TUNTAP.UseCustomDNS)
{
string dns = "";
foreach (var value in Global.Settings.TUNTAP.DNS)
{
dns += value;
dns += ',';
}
dns = dns.Trim();
dns = dns.Substring(0, dns.Length - 1);
if (int.TryParse("32", out var prefix))
{
NativeMethods.DeleteRoute(dns, prefix, Global.Settings.TUNTAP.Gateway, Global.TUNTAP.Index);
}
}
else
{
if (int.TryParse("32", out var prefix))
{
NativeMethods.DeleteRoute("1.1.1.1", prefix, Global.Settings.TUNTAP.Gateway, Global.TUNTAP.Index);
}
}
}
}
foreach (var ip in Global.Settings.BypassIPs)
@@ -210,6 +316,16 @@ namespace Netch.Controllers
NativeMethods.DeleteRoute(address.ToString(), int.Parse(info[1]), Global.Adapter.Gateway.ToString(), Global.Adapter.Index);
}
}
foreach (var ip in BypassLanIPs)
{
var info = ip.Split('/');
var address = IPAddress.Parse(info[0]);
if (!IPAddress.IsLoopback(address))
{
NativeMethods.DeleteRoute(address.ToString(), int.Parse(info[1]), Global.Adapter.Gateway.ToString(), Global.Adapter.Index);
}
}
if (SavedMode.BypassChina)
{
@@ -311,7 +427,7 @@ namespace Netch.Controllers
else
{
Instance.StartInfo.Arguments = string.Format("-proxyServer 127.0.0.1:{0} -tunAddr {1} -tunMask {2} -tunGw {3} -tunDns {4} -tunName \"{5}\"", Global.Settings.Socks5LocalPort, Global.Settings.TUNTAP.Address, Global.Settings.TUNTAP.Netmask, Global.Settings.TUNTAP.Gateway, dns, adapterName);
}
}
Instance.StartInfo.CreateNoWindow = true;
Instance.StartInfo.RedirectStandardError = true;

View File

@@ -27,6 +27,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 async void Check(bool notifyNoFound, bool isPreRelease)
{

View File

@@ -467,6 +467,7 @@ namespace Netch.Forms
this.ControlButton.Text = "Start";
this.ControlButton.UseVisualStyleBackColor = true;
this.ControlButton.Click += new System.EventHandler(this.ControlButton_Click);
this.ControlButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
//
// NotifyIcon
//
@@ -509,6 +510,7 @@ namespace Netch.Forms
this.SettingsButton.Text = "Settings";
this.SettingsButton.UseVisualStyleBackColor = true;
this.SettingsButton.Click += new System.EventHandler(this.SettingsButton_Click);
this.SettingsButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
//
// ProfileGroupBox
//

View File

@@ -488,6 +488,7 @@ namespace Netch.Forms
if (Global.Settings.SubscribeLink.Count > 0)
{
StatusLabel.Text = $"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Starting update subscription")}";
DeletePictureBox.Enabled = false;
UpdateServersFromSubscribeLinksToolStripMenuItem.Enabled = false;
@@ -571,6 +572,7 @@ namespace Netch.Forms
NatTypeStatusLabel.Text = "";
}
Utils.Configuration.Save();
StatusLabel.Text = $"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Subscription updated")}";
}).ContinueWith(task =>
{
BeginInvoke(new Action(() =>
@@ -873,6 +875,25 @@ namespace Netch.Forms
}
State = Models.State.Started;
// 自动检测延迟
Task.Run(() =>
{
while (true)
{
if (State == Models.State.Started)
{
server.Test();
// 重载服务器列表
InitServer();
Thread.Sleep(1000);
}
else
{
break;
}
}
});
}
else
{
@@ -1016,6 +1037,10 @@ namespace Netch.Forms
{
MessageBox.Show(Utils.i18N.Translate("Please select an mode first"), Utils.i18N.Translate("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else if (ProfileNameText.Text == "")
{
MessageBox.Show(Utils.i18N.Translate("Please enter a profile name first"), Utils.i18N.Translate("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
{
SaveProfile(index);
@@ -1024,6 +1049,11 @@ namespace Netch.Forms
}
else
{
if (ProfileButtons[index].Text == Utils.i18N.Translate("Error") || ProfileButtons[index].Text == Utils.i18N.Translate("None"))
{
MessageBox.Show(Utils.i18N.Translate("No saved profile here. Save a profile first by Ctrl+Click on the button"), Utils.i18N.Translate("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
}
try
{
ProfileNameText.Text = LoadProfile(index);
@@ -1069,6 +1099,14 @@ namespace Netch.Forms
public void InitProfile()
{
var num_profile = Global.Settings.ProfileCount;
if (num_profile == 0)
{
ProfileGroupBox.Size = new Size(0,0);
ConfigurationGroupBox.Size -= new Size(0, 30);
this.Size -= new Size(0, 70 + 30);
return;
}
ProfileTable.ColumnCount = num_profile;
while (Global.Settings.profiles.Count < num_profile)
@@ -1225,7 +1263,14 @@ namespace Netch.Forms
}
public void NatTypeStatusText(string text)
{
NatTypeStatusLabel.Text = "NatType:" + text;
if (!string.IsNullOrWhiteSpace(text))
{
NatTypeStatusLabel.Text = "NAT" + Utils.i18N.Translate(": ") + text;
}
else
{
NatTypeStatusLabel.Text = "NAT" + Utils.i18N.Translate(": ") + Utils.i18N.Translate("Test failed");
}
}
}
}

View File

@@ -36,6 +36,7 @@
this.Socks5PortLabel = new System.Windows.Forms.Label();
this.Socks5PortTextBox = new System.Windows.Forms.TextBox();
this.TUNTAPGroupBox = new System.Windows.Forms.GroupBox();
this.TUNTAPProxyDNSCheckBox = new System.Windows.Forms.CheckBox();
this.TUNTAPUseCustomDNSCheckBox = new System.Windows.Forms.CheckBox();
this.TUNTAPDNSLabel = new System.Windows.Forms.Label();
this.TUNTAPDNSTextBox = new System.Windows.Forms.TextBox();
@@ -48,6 +49,8 @@
this.ControlButton = new System.Windows.Forms.Button();
this.GlobalBypassIPsButton = new System.Windows.Forms.Button();
this.BehaviorGroupBox = new System.Windows.Forms.GroupBox();
this.Redirector2checkBox = new System.Windows.Forms.CheckBox();
this.label3 = new System.Windows.Forms.Label();
this.STUN_ServerPortTextBox = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
@@ -60,6 +63,7 @@
this.StartWhenOpenedCheckBox = new System.Windows.Forms.CheckBox();
this.StopWhenExitedCheckBox = new System.Windows.Forms.CheckBox();
this.ExitWhenClosedCheckBox = new System.Windows.Forms.CheckBox();
this.BypassModeCheckBox = new System.Windows.Forms.CheckBox();
this.PortGroupBox.SuspendLayout();
this.TUNTAPGroupBox.SuspendLayout();
this.BehaviorGroupBox.SuspendLayout();
@@ -126,6 +130,7 @@
//
// TUNTAPGroupBox
//
this.TUNTAPGroupBox.Controls.Add(this.TUNTAPProxyDNSCheckBox);
this.TUNTAPGroupBox.Controls.Add(this.TUNTAPUseCustomDNSCheckBox);
this.TUNTAPGroupBox.Controls.Add(this.TUNTAPDNSLabel);
this.TUNTAPGroupBox.Controls.Add(this.TUNTAPDNSTextBox);
@@ -137,11 +142,21 @@
this.TUNTAPGroupBox.Controls.Add(this.TUNTAPAddressTextBox);
this.TUNTAPGroupBox.Location = new System.Drawing.Point(12, 158);
this.TUNTAPGroupBox.Name = "TUNTAPGroupBox";
this.TUNTAPGroupBox.Size = new System.Drawing.Size(420, 164);
this.TUNTAPGroupBox.Size = new System.Drawing.Size(420, 187);
this.TUNTAPGroupBox.TabIndex = 3;
this.TUNTAPGroupBox.TabStop = false;
this.TUNTAPGroupBox.Text = "TUN/TAP";
//
// TUNTAPProxyDNSCheckBox
//
this.TUNTAPProxyDNSCheckBox.AutoSize = true;
this.TUNTAPProxyDNSCheckBox.Location = new System.Drawing.Point(120, 162);
this.TUNTAPProxyDNSCheckBox.Name = "TUNTAPProxyDNSCheckBox";
this.TUNTAPProxyDNSCheckBox.Size = new System.Drawing.Size(153, 21);
this.TUNTAPProxyDNSCheckBox.TabIndex = 10;
this.TUNTAPProxyDNSCheckBox.Text = "Proxy DNS in Mode 2";
this.TUNTAPProxyDNSCheckBox.UseVisualStyleBackColor = true;
//
// TUNTAPUseCustomDNSCheckBox
//
this.TUNTAPUseCustomDNSCheckBox.AutoSize = true;
@@ -224,7 +239,7 @@
// ControlButton
//
this.ControlButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.ControlButton.Location = new System.Drawing.Point(357, 648);
this.ControlButton.Location = new System.Drawing.Point(357, 679);
this.ControlButton.Name = "ControlButton";
this.ControlButton.Size = new System.Drawing.Size(75, 23);
this.ControlButton.TabIndex = 11;
@@ -235,7 +250,7 @@
// GlobalBypassIPsButton
//
this.GlobalBypassIPsButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.GlobalBypassIPsButton.Location = new System.Drawing.Point(12, 648);
this.GlobalBypassIPsButton.Location = new System.Drawing.Point(12, 679);
this.GlobalBypassIPsButton.Name = "GlobalBypassIPsButton";
this.GlobalBypassIPsButton.Size = new System.Drawing.Size(128, 23);
this.GlobalBypassIPsButton.TabIndex = 10;
@@ -245,6 +260,9 @@
//
// BehaviorGroupBox
//
this.BehaviorGroupBox.Controls.Add(this.BypassModeCheckBox);
this.BehaviorGroupBox.Controls.Add(this.Redirector2checkBox);
this.BehaviorGroupBox.Controls.Add(this.label3);
this.BehaviorGroupBox.Controls.Add(this.STUN_ServerPortTextBox);
this.BehaviorGroupBox.Controls.Add(this.label2);
this.BehaviorGroupBox.Controls.Add(this.label1);
@@ -257,13 +275,32 @@
this.BehaviorGroupBox.Controls.Add(this.StartWhenOpenedCheckBox);
this.BehaviorGroupBox.Controls.Add(this.StopWhenExitedCheckBox);
this.BehaviorGroupBox.Controls.Add(this.ExitWhenClosedCheckBox);
this.BehaviorGroupBox.Location = new System.Drawing.Point(12, 330);
this.BehaviorGroupBox.Location = new System.Drawing.Point(12, 351);
this.BehaviorGroupBox.Name = "BehaviorGroupBox";
this.BehaviorGroupBox.Size = new System.Drawing.Size(420, 312);
this.BehaviorGroupBox.TabIndex = 8;
this.BehaviorGroupBox.TabStop = false;
this.BehaviorGroupBox.Text = "Behavior";
//
// Redirector2checkBox
//
this.Redirector2checkBox.AutoSize = true;
this.Redirector2checkBox.Location = new System.Drawing.Point(120, 266);
this.Redirector2checkBox.Name = "Redirector2checkBox";
this.Redirector2checkBox.Size = new System.Drawing.Size(118, 21);
this.Redirector2checkBox.TabIndex = 11;
this.Redirector2checkBox.Text = "是否启用2号核心";
this.Redirector2checkBox.UseVisualStyleBackColor = true;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(9, 267);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(68, 17);
this.label3.TabIndex = 13;
this.label3.Text = "实验性功能";
//
// STUN_ServerPortTextBox
//
this.STUN_ServerPortTextBox.Location = new System.Drawing.Point(120, 237);
@@ -379,11 +416,22 @@
this.ExitWhenClosedCheckBox.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.ExitWhenClosedCheckBox.UseVisualStyleBackColor = true;
//
// BypassModeCheckBox
//
this.BypassModeCheckBox.AutoSize = true;
this.BypassModeCheckBox.Location = new System.Drawing.Point(237, 266);
this.BypassModeCheckBox.Name = "BypassModeCheckBox";
this.BypassModeCheckBox.Size = new System.Drawing.Size(135, 21);
this.BypassModeCheckBox.TabIndex = 14;
this.BypassModeCheckBox.Text = "进程代理白名单模式";
this.BypassModeCheckBox.UseVisualStyleBackColor = true;
this.BypassModeCheckBox.CheckedChanged += new System.EventHandler(this.BypassModeCheckBox_CheckedChanged);
//
// SettingForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(444, 682);
this.ClientSize = new System.Drawing.Size(444, 713);
this.Controls.Add(this.BehaviorGroupBox);
this.Controls.Add(this.PortGroupBox);
this.Controls.Add(this.GlobalBypassIPsButton);
@@ -442,5 +490,9 @@
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox STUN_ServerTextBox;
private System.Windows.Forms.TextBox STUN_ServerPortTextBox;
private System.Windows.Forms.CheckBox TUNTAPProxyDNSCheckBox;
private System.Windows.Forms.CheckBox Redirector2checkBox;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.CheckBox BypassModeCheckBox;
}
}

View File

@@ -52,6 +52,7 @@ namespace Netch.Forms
TUNTAPNetmaskLabel.Text = Utils.i18N.Translate(TUNTAPNetmaskLabel.Text);
TUNTAPGatewayLabel.Text = Utils.i18N.Translate(TUNTAPGatewayLabel.Text);
TUNTAPUseCustomDNSCheckBox.Text = Utils.i18N.Translate(TUNTAPUseCustomDNSCheckBox.Text);
TUNTAPProxyDNSCheckBox.Text = Utils.i18N.Translate(TUNTAPProxyDNSCheckBox.Text);
GlobalBypassIPsButton.Text = Utils.i18N.Translate(GlobalBypassIPsButton.Text);
ControlButton.Text = Utils.i18N.Translate(ControlButton.Text);
@@ -61,6 +62,8 @@ namespace Netch.Forms
CheckUpdateWhenOpenedCheckBox.Checked = Global.Settings.CheckUpdateWhenOpened;
MinimizeWhenStartedCheckBox.Checked = Global.Settings.MinimizeWhenStarted;
RunAtStartup.Checked = Global.Settings.RunAtStartup;
Redirector2checkBox.Checked = Global.Settings.UseRedirector2;
BypassModeCheckBox.Checked = Global.Settings.ProcessBypassMode;
Socks5PortTextBox.Text = Global.Settings.Socks5LocalPort.ToString();
HTTPPortTextBox.Text = Global.Settings.HTTPLocalPort.ToString();
@@ -70,6 +73,7 @@ namespace Netch.Forms
TUNTAPGatewayTextBox.Text = Global.Settings.TUNTAP.Gateway;
TUNTAPUseCustomDNSCheckBox.Checked = Global.Settings.TUNTAP.UseCustomDNS;
TUNTAPProxyDNSCheckBox.Checked = Global.Settings.TUNTAP.ProxyDNS;
BehaviorGroupBox.Text = Utils.i18N.Translate(BehaviorGroupBox.Text);
ExitWhenClosedCheckBox.Text = Utils.i18N.Translate(ExitWhenClosedCheckBox.Text);
@@ -142,6 +146,8 @@ namespace Netch.Forms
Global.Settings.CheckUpdateWhenOpened = CheckUpdateWhenOpenedCheckBox.Checked;
Global.Settings.MinimizeWhenStarted = MinimizeWhenStartedCheckBox.Checked;
Global.Settings.RunAtStartup = RunAtStartup.Checked;
Global.Settings.UseRedirector2 = Redirector2checkBox.Checked;
Global.Settings.ProcessBypassMode = BypassModeCheckBox.Checked;
// 开机自启判断
TaskSchedulerClass scheduler = new TaskSchedulerClass();
@@ -269,7 +275,7 @@ namespace Netch.Forms
{
var ProfileCount = int.Parse(ProfileCount_TextBox.Text);
if (ProfileCount > 0)
if (ProfileCount > -1)
{
Global.Settings.ProfileCount = ProfileCount;
}
@@ -320,10 +326,25 @@ namespace Netch.Forms
}
Global.Settings.TUNTAP.UseCustomDNS = TUNTAPUseCustomDNSCheckBox.Checked;
Global.Settings.TUNTAP.ProxyDNS = TUNTAPProxyDNSCheckBox.Checked;
Utils.Configuration.Save();
MessageBox.Show(Utils.i18N.Translate("Saved"), Utils.i18N.Translate("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
Close();
}
private void BypassModeCheckBox_CheckedChanged(object sender, EventArgs e)
{
if (BypassModeCheckBox.Checked)
{
Redirector2checkBox.Checked = false;
Redirector2checkBox.Enabled = false;
}
else
{
Redirector2checkBox.Enabled = true;
}
}
}
}

View File

@@ -56,6 +56,7 @@ namespace Netch
"table",
"rc4",
"rc4-md5",
"rc4-md5-6",
"aes-128-cfb",
"aes-192-cfb",
"aes-256-cfb",

View File

@@ -31,6 +31,11 @@ namespace Netch.Models
/// 使用自定义 DNS 设置
/// </summary>
public bool UseCustomDNS = false;
/// <summary>
/// 模式2下是否代理DNS
/// </summary>
public bool ProxyDNS = false;
}
/// <summary>
@@ -127,7 +132,7 @@ namespace Netch.Models
/// <summary>
/// 全局绕过 IP 列表
/// </summary>
public List<string> BypassIPs = new List<string>() { "10.0.0.0/8", "172.16.0.0/16", "192.168.0.0/24" };
public List<string> BypassIPs = new List<string>();
/// <summary>
/// 已保存的快捷配置
@@ -148,5 +153,14 @@ namespace Netch.Models
/// STUN测试服务器
/// </summary>
public int STUN_Server_Port = 3478;
/// <summary>
/// 是否切换为2号核心
/// </summary>
public bool UseRedirector2 = false;
/// <summary>
/// 是否启用进程代理白名单模式
/// </summary>
public bool ProcessBypassMode = false;
}
}

View File

@@ -1,101 +1,111 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net48</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<UseWPF>true</UseWPF>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<StartupObject>Netch.Netch</StartupObject>
<ApplicationManifest>App.manifest</ApplicationManifest>
<ApplicationIcon>Netch.ico</ApplicationIcon>
<Platforms>x86;x64</Platforms>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net48</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<UseWPF>true</UseWPF>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<StartupObject>Netch.Netch</StartupObject>
<ApplicationManifest>App.manifest</ApplicationManifest>
<ApplicationIcon>Netch.ico</ApplicationIcon>
<Platforms>x86;x64</Platforms>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<WarningsAsErrors />
<NoWarn />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<WarningsAsErrors />
<NoWarn />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x86'">
<DefineConstants>DEBUG;TRACE</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<NoWarn />
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<WarningsAsErrors />
<OutputPath>bin\x86\Debug\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x86'">
<DefineConstants>DEBUG;TRACE</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<NoWarn />
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<WarningsAsErrors />
<OutputPath>bin\x86\Debug\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x86'">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<NoWarn />
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<WarningsAsErrors />
<OutputPath>bin\x86\Release\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x86'">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<NoWarn />
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<WarningsAsErrors />
<OutputPath>bin\x86\Release\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<NoWarn />
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<WarningsAsErrors />
<OutputPath>bin\x64\Release\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<NoWarn />
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<WarningsAsErrors />
<OutputPath>bin\x64\Release\</OutputPath>
</PropertyGroup>
<ItemGroup>
<None Remove=".gitignore" />
</ItemGroup>
<ItemGroup>
<None Remove=".gitignore" />
</ItemGroup>
<ItemGroup>
<COMReference Include="TaskScheduler.dll">
<Guid>e34cb9f1-c7f7-424c-be29-027dcc09363a</Guid>
<VersionMajor>1</VersionMajor>
<VersionMinor>0</VersionMinor>
<WrapperTool>tlbimp</WrapperTool>
<Lcid>0</Lcid>
<Isolated>false</Isolated>
<EmbedInteropTypes>false</EmbedInteropTypes>
</COMReference>
</ItemGroup>
<ItemGroup>
<COMReference Include="TaskScheduler.dll">
<Guid>e34cb9f1-c7f7-424c-be29-027dcc09363a</Guid>
<VersionMajor>1</VersionMajor>
<VersionMinor>0</VersionMinor>
<WrapperTool>tlbimp</WrapperTool>
<Lcid>0</Lcid>
<Isolated>false</Isolated>
<EmbedInteropTypes>false</EmbedInteropTypes>
</COMReference>
</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" />
<PackageReference Include="WindowsAPICodePack-Shell" Version="1.1.1" />
</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" />
<PackageReference Include="WindowsAPICodePack-Shell" Version="1.1.1" />
</ItemGroup>
<ItemGroup>
<Reference Include="System.Net.Http" />
<Reference Include="System.ServiceProcess" />
<Reference Include="System.Web" />
</ItemGroup>
<ItemGroup>
<Reference Include="System.Net.Http" />
<Reference Include="System.ServiceProcess" />
<Reference Include="System.Web" />
</ItemGroup>
<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Update="Properties\Settings.Designer.cs">
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="@ECHO OFF&#xD;&#xA;RD /S /Q $(TargetDir)bin &gt; NUL 2&gt;&amp;1&#xD;&#xA;RD /S /Q $(TargetDir)i18n &gt; NUL 2&gt;&amp;1&#xD;&#xA;RD /S /Q $(TargetDir)mode &gt; NUL 2&gt;&amp;1&#xD;&#xA;&#xD;&#xA;MKDIR $(TargetDir)bin &gt; NUL 2&gt;&amp;1&#xD;&#xA;MKDIR $(TargetDir)i18n &gt; NUL 2&gt;&amp;1&#xD;&#xA;MKDIR $(TargetDir)mode &gt; NUL 2&gt;&amp;1&#xD;&#xA;&#xD;&#xA;COPY /Y $(SolutionDir)binaries\$(PlatformName)\* $(TargetDir)bin &gt; NUL 2&gt;&amp;1&#xD;&#xA;COPY /Y $(SolutionDir)binaries\* $(TargetDir)bin &gt; NUL 2&gt;&amp;1&#xD;&#xA;MOVE /Y $(TargetDir)bin\nfapinet.dll $(TargetDir)nfapinet.dll &gt; NUL 2&gt;&amp;1&#xD;&#xA;COPY /Y $(SolutionDir)translations\i18n\* $(TargetDir)i18n &gt; NUL 2&gt;&amp;1&#xD;&#xA;COPY /Y $(SolutionDir)modes\mode\*.txt $(TargetDir)mode &gt; NUL 2&gt;&amp;1&#xD;&#xA;MKDIR $(TargetDir)bin\tap-driver &gt; NUL 2&gt;&amp;1&#xD;&#xA;COPY /Y $(SolutionDir)binaries\$(PlatformName)\tap-driver\* $(TargetDir)bin\tap-driver &gt; NUL 2&gt;&amp;1" />
</Target>
</Project>
<ItemGroup>
<None Update="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
<Target Condition="'$(VisualStudioDir)' != ''" Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="@ECHO OFF&#xD;&#xA;RD /S /Q $(TargetDir)bin &gt; NUL 2&gt;&amp;1&#xD;&#xA;RD /S /Q $(TargetDir)i18n &gt; NUL 2&gt;&amp;1&#xD;&#xA;RD /S /Q $(TargetDir)mode &gt; NUL 2&gt;&amp;1&#xD;&#xA;&#xD;&#xA;MKDIR $(TargetDir)bin &gt; NUL 2&gt;&amp;1&#xD;&#xA;MKDIR $(TargetDir)i18n &gt; NUL 2&gt;&amp;1&#xD;&#xA;MKDIR $(TargetDir)mode &gt; NUL 2&gt;&amp;1&#xD;&#xA;&#xD;&#xA;COPY /Y $(SolutionDir)binaries\$(PlatformName)\* $(TargetDir)bin &gt; NUL 2&gt;&amp;1&#xD;&#xA;COPY /Y $(SolutionDir)binaries\* $(TargetDir)bin &gt; NUL 2&gt;&amp;1&#xD;&#xA;MOVE /Y $(TargetDir)bin\nfapinet.dll $(TargetDir)nfapinet.dll &gt; NUL 2&gt;&amp;1&#xD;&#xA;COPY /Y $(SolutionDir)translations\i18n\* $(TargetDir)i18n &gt; NUL 2&gt;&amp;1&#xD;&#xA;COPY /Y $(SolutionDir)modes\mode\*.txt $(TargetDir)mode &gt; NUL 2&gt;&amp;1&#xD;&#xA;MKDIR $(TargetDir)bin\tap-driver &gt; NUL 2&gt;&amp;1&#xD;&#xA;COPY /Y $(SolutionDir)binaries\$(PlatformName)\tap-driver\* $(TargetDir)bin\tap-driver &gt; NUL 2&gt;&amp;1" />
</Target>
</Project>

View File

@@ -1,30 +1,26 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace Netch.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
namespace Netch.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.4.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}

View File

@@ -12,7 +12,7 @@
"Stop": "停止",
"Waiting for command": "等待命令中",
"Starting": "正在启动中",
"Start failed": "启动失败",
"Start failed": "启动失败请打开软件目录logging文件夹查看日志",
"Started": "已启动",
"Stopping": "正在停止中",
"Stopped": "已停止",
@@ -26,6 +26,10 @@
"Starting netfilter2 Service": "正在启动netfilter2服务",
"Starting dns2tcp Service": "正在启动dns2tcp服务",
"SetupBypass": "设置绕行规则",
"Test failed": "测试失败",
"Starting update subscription": "正在更新订阅",
"Subscription updated": "订阅更新完毕",
"Register driver": "正在注册驱动",
"Server": "服务器",
"Import Servers From Clipboard": "从剪贴板导入服务器",
@@ -93,6 +97,8 @@
"Please press Stop button first": "请先点击停止按钮",
"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+左键点击该按钮保存一个配置",
"Used": "已使用",
"Status": "状态",
@@ -136,6 +142,7 @@
"Netmask": "子网掩码",
"Gateway": "网关",
"Use Custom DNS": "使用自定义 DNS",
"Proxy DNS in Mode 2": "在模式2下代理DNS",
"Behavior": "行为",
"Exit when closed": "关闭时退出",
"Stop when exited": "退出时停止",

View File

@@ -1,6 +1,6 @@
# Netch
[![](https://img.shields.io/badge/Telegram-Channel-blue.svg)](https://t.me/Netch)
[![](https://img.shields.io/badge/Telegram-Channel-blue)](https://t.me/Netch) [![](https://img.shields.io/badge/Telegram-Group-green)](https://t.me/Netch_Discuss_Group) ![GitHub Actions & Netch CI](https://github.com/NetchX/Netch/workflows/GitHub%20Actions%20&%20Netch%20CI/badge.svg)
Game accelerator
[简体中文](docs/README.zh-CN.md) (此版本内容更丰富)
@@ -24,8 +24,8 @@ As well, Netch avoid the restricted NAT problem caused by SSTap. You can use an
[![NyanCAT](docs/sponsor/nyancat.jpg)](https://nyancat.info)
NyanCAT Network全中转高质量节点多条低倍率节点保证流量无忧节点极低延迟涵盖五大洲。Netflix 视频党,游戏党,海外回国党必备,无需年付,月付 19 元起
[Telegram 群组](https://t.me/NyanCaaaat)
NyanCAT Network全中转高质量节点多条低倍率节点保证流量无忧节点极低延迟涵盖五大洲。Netflix 视频党,游戏党,海外回国党必备,无需年付,月付 19 元起。[测速图](https://t.me/BGP2020/935)
[加入 Telegram 群组](https://t.me/NyanCaaaat)
[![ManSora](docs/sponsor/mansora.jpg)](https://www.mansora.net/cart.php)

69
build.ps1 Normal file
View File

@@ -0,0 +1,69 @@
# REM The reason we don't use dotnet build is that dotnet build doesn't support COM references yet https://github.com/microsoft/msbuild/issues/3986
param([string]$buildtfm = 'all')
Write-Host 'dotnet SDK version'
dotnet --version
$exe = 'Netch.exe'
$mainDir = (Get-Item -Path ".\").FullName
$net_baseoutput = "$mainDir\Netch\bin\$configuration"
Write-Host $mainDir
Write-Host $net_baseoutput
function Build-NetFrameworkx64
{
Write-Host 'Building .NET Framework x64'
$outdir = "$net_baseoutput\x64"
msbuild -v:m -m -t:Build /p:Configuration="Release" /p:Platform="x64" /p:TargetFramework=net48 /p:Runtimeidentifier=win-x64 /restore
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
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"
Copy-Item "$mainDir\binaries\*.exe" "$net_baseoutput\x64\Release\win-x64\bin"
Move-Item "$net_baseoutput\x64\Release\win-x64\bin\nfapinet.dll" "$net_baseoutput\x64\Release\win-x64\nfapinet.dll"
Copy-Item "$mainDir\translations\i18n" "$net_baseoutput\x64\Release\win-x64\i18n" -recurse
mkdir "$net_baseoutput\x64\Release\win-x64\mode"
Copy-Item "$mainDir\modes\mode\*.txt" "$net_baseoutput\x64\Release\win-x64\mode"
Write-Host 'x64 ALL DONE'
}
function Build-NetFrameworkx86
{
Write-Host 'Building .NET Framework x86'
$outdir = "$net_baseoutput\x86"
msbuild -v:m -m -t:Build /p:Configuration="Release" /p:Platform="x86" /p:TargetFramework=net48 /p:Runtimeidentifier=win-x86 /restore
if ($LASTEXITCODE) { cd $mainDir ; exit $LASTEXITCODE }
Write-Host 'Build x86 Complete ,Started Copy bin,mode,i18n file'
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
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"
Copy-Item "$mainDir\binaries\*.exe" "$net_baseoutput\x86\Release\win-x86\bin"
Move-Item "$net_baseoutput\x86\Release\win-x86\bin\nfapinet.dll" "$net_baseoutput\x86\Release\win-x86\nfapinet.dll"
Copy-Item "$mainDir\translations\i18n" "$net_baseoutput\x86\Release\win-x86\i18n" -recurse
mkdir "$net_baseoutput\x86\Release\win-x86\mode"
Copy-Item "$mainDir\modes\mode\*.txt" "$net_baseoutput\x86\Release\win-x86\mode"
Write-Host 'x86 ALL DONE'
}
cd $mainDir\Netch
Build-NetFrameworkx64
Build-NetFrameworkx86
cd $mainDir

View File

@@ -25,8 +25,8 @@ Netch 是一款 Windows 平台的开源游戏加速工具Netch 可以实现
[![NyanCAT](sponsor/nyancat.jpg)](https://nyancat.info)
NyanCAT Network全中转高质量节点多条低倍率节点保证流量无忧节点极低延迟涵盖五大洲。Netflix 视频党,游戏党,海外回国党必备,无需年付,月付 19 元起
[Telegram 群组](https://t.me/NyanCaaaat)
NyanCAT Network全中转高质量节点多条低倍率节点保证流量无忧节点极低延迟涵盖五大洲。Netflix 视频党,游戏党,海外回国党必备,无需年付,月付 19 元起。[测速图](https://t.me/BGP2020/935)
[加入 Telegram 群组](https://t.me/NyanCaaaat)
[![ManSora](sponsor/mansora.jpg)](https://www.mansora.net/cart.php)

2
modes

Submodule modes updated: 8d6f98d43e...678fd2be58