Compare commits

...

67 Commits
1.4.0 ... 1.4.2

Author SHA1 Message Date
Amazing_DM
4e6bcdcf88 Update UpdateChecker.cs
又又又忘了改版本号
2020-04-23 15:09:00 +08:00
Amazing_DM
f244212cdf :wastebasket:cleanup 2020-04-23 14:56:12 +08:00
Amazing_DM
6649a1fce9 :poop:fix a dns bug? 2020-04-23 14:24:42 +08:00
Amazing_DM
c31338ee1f :sparkles:添加使用代理更新ACL功能
:art:启动后允许打开Netch设置及大部分部分工具栏
2020-04-21 16:58:06 +08:00
Amazing_DM
5f3a300ccc 添加自定义ACL及更新ACL功能 2020-04-16 18:30:36 +08:00
Amazing_DM
bc0e88ae5e Merge pull request #258 from zhuzai123/zhuzai123-patch-1
Update SSRController.cs
2020-04-14 10:14:10 +08:00
Amazing_DM
fac28ca88b Update SSRController.cs 2020-04-14 10:13:59 +08:00
He Houzhu
5efd88b60c Update SSRController.cs
添加ssr启动参数-t 600解决tcp过早超时导致的cod16掉线问题
2020-04-13 10:02:11 +08:00
Amazing_DM
3f59a63766 Update TUNTAPController.cs 2020-04-11 14:08:49 +08:00
Amazing_DM
8f14b030bb 漏掉的版本号 2020-04-08 11:47:45 +08:00
Amazing_DM
f941df0af2 :art:优化驱动更新
:art:Redirector正常启动失败后将尝试停止驱动服务再重新启动
2020-04-08 10:07:25 +08:00
Amazing_DM
13a66d0648 Update NFController.cs 2020-04-05 16:08:58 +08:00
Amazing_DM
9548a3d03a Update NFController.cs 2020-04-04 23:34:58 -05:00
Amazing_DM
c2f33ba15b 2020-04-01 14:37:29 +08:00
Amazing_DM
2895989b13 Update VMessController.cs 2020-04-01 13:20:46 +08:00
Amazing_DM
7cddb75cef Revert "Change STUN Server"
This reverts commit c39b758fe6.
2020-03-31 00:50:36 +08:00
Amazing_DM
f05ae498c6 :art:安装Tap driver时留出一点时间 防止找不到适配器ID 2020-03-30 16:00:27 +08:00
Amazing_DM
ff0fe2ab9f Update submodule 2020-03-30 15:41:45 +08:00
Amazing_DM
764e78d662 Update UpdateChecker.cs 2020-03-30 15:31:34 +08:00
Amazing_DM
bdaab4f1ac 此处修复一个诡异的BUG 感谢@ColinWood Tap模式 Mux不能为Null 否则Netch内存占用极大 2020-03-27 12:03:31 +08:00
Amazing_DM
9ad5e16f47 Update submodule 2020-03-26 14:48:30 +08:00
Amazing_DM
c861ed4116 Merge pull request #256 from VCStardust/master
Change STUN Test Server
2020-03-25 21:57:45 -05:00
Col. Schwi
c39b758fe6 Change STUN Server 2020-03-25 21:28:15 +08:00
Amazing_DM
e1901587a5 :art:订阅更新超时改为10s
:art:微调设置界面
2020-03-24 18:29:46 +08:00
Amazing_DM
8aea21a2c6 :bug:fix a bug. catch复制链接按钮 2020-03-23 14:43:38 +08:00
Amazing_DM
d97d461354 :art:改进SSR链接解析 2020-03-23 14:40:22 +08:00
Amazing_DM
d8f3bdaa78 :sparkles:添加启动后Tcping设置 2020-03-23 11:18:17 +08:00
Amazing_DM
7516ecf946 Update submodule 2020-03-22 14:23:17 +08:00
Amazing_DM
69d6397383 Merge pull request #255 from henning724/master
解决MainForm Design页面报错问题 ver2
2020-03-22 14:20:40 +08:00
Amazing_DM
7854a91fef Update submodule 2020-03-22 14:17:27 +08:00
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
henning724
499898fdf5 将部分界面元素放到table中
修复配置数为0时部分系统上的显示bug
2020-03-20 20:24:35 +08:00
henning724
5874bf7599 解决MainForm Design页面报错问题 ver2 2020-03-20 18:15:56 +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
40 changed files with 1739 additions and 598 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

@@ -3,24 +3,40 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16 # Visual Studio Version 16
VisualStudioVersion = 16.0.29009.5 VisualStudioVersion = 16.0.29009.5
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Netch", "Netch\Netch.csproj", "{4B041B91-5790-4571-8C58-C63FFE4BC9F8}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Netch", "Netch\Netch.csproj", "{4B041B91-5790-4571-8C58-C63FFE4BC9F8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetchLib", "NetchLib\NetchLib.csproj", "{A8715AF4-ACC6-43F9-9381-4294C5360623}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64 Debug|x64 = Debug|x64
Debug|x86 = Debug|x86 Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64 Release|x64 = Release|x64
Release|x86 = Release|x86 Release|x86 = Release|x86
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4B041B91-5790-4571-8C58-C63FFE4BC9F8}.Debug|Any CPU.ActiveCfg = Debug|x86
{4B041B91-5790-4571-8C58-C63FFE4BC9F8}.Debug|x64.ActiveCfg = Debug|x64 {4B041B91-5790-4571-8C58-C63FFE4BC9F8}.Debug|x64.ActiveCfg = Debug|x64
{4B041B91-5790-4571-8C58-C63FFE4BC9F8}.Debug|x64.Build.0 = Debug|x64 {4B041B91-5790-4571-8C58-C63FFE4BC9F8}.Debug|x64.Build.0 = Debug|x64
{4B041B91-5790-4571-8C58-C63FFE4BC9F8}.Debug|x86.ActiveCfg = Debug|x86 {4B041B91-5790-4571-8C58-C63FFE4BC9F8}.Debug|x86.ActiveCfg = Debug|x86
{4B041B91-5790-4571-8C58-C63FFE4BC9F8}.Debug|x86.Build.0 = Debug|x86 {4B041B91-5790-4571-8C58-C63FFE4BC9F8}.Debug|x86.Build.0 = Debug|x86
{4B041B91-5790-4571-8C58-C63FFE4BC9F8}.Release|Any CPU.ActiveCfg = Release|x86
{4B041B91-5790-4571-8C58-C63FFE4BC9F8}.Release|x64.ActiveCfg = Release|x64 {4B041B91-5790-4571-8C58-C63FFE4BC9F8}.Release|x64.ActiveCfg = Release|x64
{4B041B91-5790-4571-8C58-C63FFE4BC9F8}.Release|x64.Build.0 = Release|x64 {4B041B91-5790-4571-8C58-C63FFE4BC9F8}.Release|x64.Build.0 = Release|x64
{4B041B91-5790-4571-8C58-C63FFE4BC9F8}.Release|x86.ActiveCfg = Release|x86 {4B041B91-5790-4571-8C58-C63FFE4BC9F8}.Release|x86.ActiveCfg = Release|x86
{4B041B91-5790-4571-8C58-C63FFE4BC9F8}.Release|x86.Build.0 = Release|x86 {4B041B91-5790-4571-8C58-C63FFE4BC9F8}.Release|x86.Build.0 = Release|x86
{A8715AF4-ACC6-43F9-9381-4294C5360623}.Debug|Any CPU.ActiveCfg = Debug|x86
{A8715AF4-ACC6-43F9-9381-4294C5360623}.Debug|x64.ActiveCfg = Debug|x64
{A8715AF4-ACC6-43F9-9381-4294C5360623}.Debug|x64.Build.0 = Debug|x64
{A8715AF4-ACC6-43F9-9381-4294C5360623}.Debug|x86.ActiveCfg = Debug|x86
{A8715AF4-ACC6-43F9-9381-4294C5360623}.Debug|x86.Build.0 = Debug|x86
{A8715AF4-ACC6-43F9-9381-4294C5360623}.Release|Any CPU.ActiveCfg = Release|x86
{A8715AF4-ACC6-43F9-9381-4294C5360623}.Release|x64.ActiveCfg = Release|x64
{A8715AF4-ACC6-43F9-9381-4294C5360623}.Release|x64.Build.0 = Release|x64
{A8715AF4-ACC6-43F9-9381-4294C5360623}.Release|x86.ActiveCfg = Release|x86
{A8715AF4-ACC6-43F9-9381-4294C5360623}.Release|x86.Build.0 = Release|x86
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View File

@@ -2,8 +2,6 @@
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using System.Net;
using System.Threading;
namespace Netch.Controllers namespace Netch.Controllers
{ {
@@ -15,23 +13,23 @@ namespace Netch.Controllers
public Process Instance; public Process Instance;
/// <summary> /// <summary>
/// 启动NatTypeTester /// 启动DNS服务
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public bool Start() public bool Start()
{ {
MainForm.Instance.StatusText($"{Utils.i18N.Translate("Starting dns2tcp Service")}"); MainForm.Instance.StatusText($"{Utils.i18N.Translate("Starting dns Service")}");
try try
{ {
if (!File.Exists("bin\\dns2tcp.exe")) if (!File.Exists("bin\\unbound.exe") && !File.Exists("bin\\unbound-service.conf") && !File.Exists("bin\\forward-zone.conf"))
{ {
return false; return false;
} }
Instance = MainController.GetProcess(); Instance = MainController.GetProcess();
Instance.StartInfo.FileName = "bin\\dns2tcp.exe"; Instance.StartInfo.FileName = "bin\\unbound.exe";
Instance.StartInfo.Arguments = " -L 127.0.0.1:53 -R 1.1.1.1:53"; Instance.StartInfo.Arguments = "-c unbound-service.conf -v";
Instance.OutputDataReceived += OnOutputDataReceived; Instance.OutputDataReceived += OnOutputDataReceived;
Instance.ErrorDataReceived += OnOutputDataReceived; Instance.ErrorDataReceived += OnOutputDataReceived;
@@ -43,7 +41,7 @@ namespace Netch.Controllers
} }
catch (Exception) catch (Exception)
{ {
Utils.Logging.Info("dns2tcp 进程出错"); Utils.Logging.Info("dns-unbound 进程出错");
Stop(); Stop();
return false; return false;
} }
@@ -71,42 +69,12 @@ namespace Netch.Controllers
{ {
if (!string.IsNullOrWhiteSpace(e.Data)) if (!string.IsNullOrWhiteSpace(e.Data))
{ {
if (File.Exists("logging\\dns2tcp.log")) if (File.Exists("logging\\dns-unbound.log"))
{ {
File.Delete("logging\\dns2tcp.log"); File.Delete("logging\\dns-unbound.log");
} }
File.AppendAllText("logging\\dns2tcp.log", $"{e.Data}\r\n"); File.AppendAllText("logging\\dns-unbound.log", $"{e.Data}\r\n");
} }
} }
/* public static DNS.Server.DnsServer Server = new DNS.Server.DnsServer(new Resolver());
public bool Start()
{
MainForm.Instance.StatusText($"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Starting LocalDns service")}");
try
{
_ = Server.Listen(new IPEndPoint(IPAddress.IPv6Any, 53));
}
catch (Exception e)
{
Utils.Logging.Info(e.ToString());
return false;
}
return true;
}
public void Stop()
{
try
{
Server.Dispose();
}
catch (Exception e)
{
Utils.Logging.Info(e.ToString());
}
}*/
} }
} }

View File

@@ -1,5 +1,4 @@
using System; using System;
using Microsoft.Win32;
namespace Netch.Controllers namespace Netch.Controllers
{ {

View File

@@ -1,12 +1,16 @@
using System; using Netch.Forms;
using System;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using System.Runtime.InteropServices;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Netch.Controllers namespace Netch.Controllers
{ {
public class MainController public class MainController
{ {
[DllImport("dnsapi", EntryPoint = "DnsFlushResolverCache")]
public static extern UInt32 FlushDNSResolverCache();
public static Process GetProcess() public static Process GetProcess()
{ {
var process = new Process(); var process = new Process();
@@ -65,6 +69,8 @@ namespace Netch.Controllers
/// <returns>是否启动成功</returns> /// <returns>是否启动成功</returns>
public bool Start(Models.Server server, Models.Mode mode) public bool Start(Models.Server server, Models.Mode mode)
{ {
FlushDNSResolverCache();
var result = false; var result = false;
switch (server.Type) switch (server.Type)
{ {
@@ -117,12 +123,19 @@ namespace Netch.Controllers
pNTTController = new NTTController(); pNTTController = new NTTController();
} }
// 进程代理模式,启动 NF 控制器 // 进程代理模式,启动 NF 控制器
result = pNFController.Start(server, mode); result = pNFController.Start(server, mode, false);
if (!result)
Task.Run(() =>
{ {
pNTTController.Start(); 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(() =>
{
pNTTController.Start();
});
} }
else if (mode.Type == 1) else if (mode.Type == 1)
@@ -137,11 +150,11 @@ namespace Netch.Controllers
} }
// TUN/TAP 黑名单代理模式,启动 TUN/TAP 控制器 // TUN/TAP 黑名单代理模式,启动 TUN/TAP 控制器
result = pTUNTAPController.Start(server, mode); result = pTUNTAPController.Start(server, mode);
if (result)
Task.Run(() => Task.Run(() =>
{ {
pNTTController.Start(); pNTTController.Start();
}); });
} }
else if (mode.Type == 2) else if (mode.Type == 2)
{ {
@@ -155,11 +168,11 @@ namespace Netch.Controllers
} }
// TUN/TAP 白名单代理模式,启动 TUN/TAP 控制器 // TUN/TAP 白名单代理模式,启动 TUN/TAP 控制器
result = pTUNTAPController.Start(server, mode); result = pTUNTAPController.Start(server, mode);
if (result)
Task.Run(() => Task.Run(() =>
{ {
pNTTController.Start(); pNTTController.Start();
}); });
} }
else if (mode.Type == 3 || mode.Type == 5) else if (mode.Type == 3 || mode.Type == 5)
{ {

View File

@@ -32,73 +32,98 @@ namespace Netch.Controllers
/// </summary> /// </summary>
public Models.State State = Models.State.Waiting; public Models.State State = Models.State.Waiting;
// 生成驱动文件路径
public string driverPath = string.Format("{0}\\drivers\\netfilter2.sys", Environment.SystemDirectory);
/// <summary> /// <summary>
/// 启动 /// 启动
/// </summary> /// </summary>
/// <param name="server">服务器</param> /// <param name="server">服务器</param>
/// <param name="mode">模式</param> /// <param name="mode">模式</param>
/// <param name="StopServiceAndRestart">先停止驱动服务再重新启动</param>
/// <returns>是否成功</returns> /// <returns>是否成功</returns>
public bool Start(Models.Server server, Models.Mode mode) public bool Start(Models.Server server, Models.Mode mode, bool StopServiceAndRestart)
{ {
MainForm.Instance.StatusText($"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Starting Redirector")}"); if (!StopServiceAndRestart)
if (!File.Exists("bin\\Redirector.exe")) MainForm.Instance.StatusText($"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Starting Redirector")}");
{
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()}"; var version = $"{Environment.OSVersion.Version.Major.ToString()}.{Environment.OSVersion.Version.Minor.ToString()}";
var driverName = "";
// 检查系统版本并复制对应驱动 switch (version)
try
{ {
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
{ {
case "10.0": var service = new ServiceController("netfilter2");
File.Copy("bin\\Win-10.sys", driver); if (service.Status == ServiceControllerStatus.Running)
Utils.Logging.Info("已复制 Win10 驱动"); {
break; service.Stop();
case "6.3": service.WaitForStatus(ServiceControllerStatus.Stopped);
case "6.2": }
File.Copy("bin\\Win-8.sys", driver); nfapinet.NFAPI.nf_unRegisterDriver("netfilter2");
Utils.Logging.Info("已复制 Win8 驱动");
break; //删除老驱动
case "6.1": File.Delete(driverPath);
case "6.0": if (!InstallDriver())
File.Copy("bin\\Win-7.sys", driver);
Utils.Logging.Info("已复制 Win7 驱动");
break;
default:
Utils.Logging.Info($"不支持的系统版本:{version}");
return false; return false;
Utils.Logging.Info($"驱动更新完毕,当前驱动版本:{BinFileVerInfo.FileVersion}");
} }
} catch (Exception)
catch (Exception e) {
{ Utils.Logging.Info($"更新驱动出错");
Utils.Logging.Info("复制驱动文件失败"); }
Utils.Logging.Info(e.ToString());
return false;
} }
// 注册驱动文件 }
var result = nfapinet.NFAPI.nf_registerDriver("netfilter2"); else
if (result != nfapinet.NF_STATUS.NF_STATUS_SUCCESS) {
{ if (!InstallDriver())
Utils.Logging.Info($"注册驱动失败,返回值:{result}");
return false; return false;
}
} }
try try
{ {
//启动驱动服务
var service = new ServiceController("netfilter2"); var service = new ServiceController("netfilter2");
if (service.Status == ServiceControllerStatus.Stopped) if (service.Status == ServiceControllerStatus.Running && StopServiceAndRestart)
{
//防止其他程序占用 重置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();
}
else if (service.Status == ServiceControllerStatus.Stopped)
{ {
MainForm.Instance.StatusText($"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Starting netfilter2 Service")}"); MainForm.Instance.StatusText($"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Starting netfilter2 Service")}");
service.Start(); service.Start();
@@ -116,7 +141,13 @@ namespace Netch.Controllers
} }
} }
var processes = "NTT.exe,"; var processes = "";
//开启进程白名单模式
if (!Global.Settings.ProcessBypassMode)
{
processes += "NTT.exe,";
}
foreach (var proc in mode.Rule) foreach (var proc in mode.Rule)
{ {
@@ -126,32 +157,91 @@ namespace Netch.Controllers
processes = processes.Substring(0, processes.Length - 1); processes = processes.Substring(0, processes.Length - 1);
Instance = MainController.GetProcess(); Instance = MainController.GetProcess();
Instance.StartInfo.FileName = "bin\\Redirector.exe";
var fallback = ""; 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 else
{ {
var result = Utils.DNS.Lookup(server.Hostname); if (!File.Exists("bin\\Redirector.exe"))
if (result == null)
{ {
Utils.Logging.Info("无法解析服务器 IP 地址");
return false; return false;
} }
Instance.StartInfo.FileName = "bin\\Redirector.exe";
fallback = $"-r {result}:{server.Port} -p \"{processes}\""; //开启进程白名单模式
if (Global.Settings.ProcessBypassMode)
if (!string.IsNullOrWhiteSpace(server.Username) && !string.IsNullOrWhiteSpace(server.Password))
{ {
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}\"";
}
} }
} }
Instance.StartInfo.Arguments = fallback; if (File.Exists("logging\\redirector.log"))
File.Delete("logging\\redirector.log");
Instance.StartInfo.Arguments = fallback + $" -tcport {Global.Settings.RedirectorTCPPort}";
Utils.Logging.Info(Instance.StartInfo.Arguments);
Instance.OutputDataReceived += OnOutputDataReceived; Instance.OutputDataReceived += OnOutputDataReceived;
Instance.ErrorDataReceived += OnOutputDataReceived; Instance.ErrorDataReceived += OnOutputDataReceived;
State = Models.State.Starting; State = Models.State.Starting;
@@ -159,14 +249,19 @@ namespace Netch.Controllers
Instance.BeginOutputReadLine(); Instance.BeginOutputReadLine();
Instance.BeginErrorReadLine(); Instance.BeginErrorReadLine();
for (var i = 0; i < 1000; i++) for (var i = 0; i < 10; i++)
{ {
Thread.Sleep(10); Thread.Sleep(1000);
if (State == Models.State.Started) if (State == Models.State.Started)
{ {
Utils.Logging.Info($"成功启动Redirector耗时:{i + 1}秒");
return true; return true;
} }
else
{
Utils.Logging.Info($"Redirector启动中已耗时:{i + 1}秒");
}
} }
Utils.Logging.Info("NF 进程启动超时"); Utils.Logging.Info("NF 进程启动超时");
@@ -192,6 +287,53 @@ namespace Netch.Controllers
Utils.Logging.Info(e.ToString()); Utils.Logging.Info(e.ToString());
} }
} }
public bool InstallDriver()
{
Utils.Logging.Info("安装驱动中");
// 生成系统版本
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) public void OnOutputDataReceived(object sender, DataReceivedEventArgs e)
{ {
@@ -205,7 +347,7 @@ namespace Netch.Controllers
{ {
State = Models.State.Stopped; 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; State = Models.State.Started;
} }
@@ -237,4 +379,4 @@ namespace Netch.Controllers
} }
} }
} }
} }

View File

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

View File

@@ -43,7 +43,7 @@ namespace Netch.Controllers
{ {
Instance.StartInfo.Arguments = $"-s {server.Hostname} -p {server.Port} -b {Global.Settings.LocalAddress} -l {Global.Settings.Socks5LocalPort} -m {server.EncryptMethod} -k \"{server.Password}\" -u"; Instance.StartInfo.Arguments = $"-s {server.Hostname} -p {server.Port} -b {Global.Settings.LocalAddress} -l {Global.Settings.Socks5LocalPort} -m {server.EncryptMethod} -k \"{server.Password}\" -u";
} }
if (mode.BypassChina) if (mode.BypassChina)
{ {
Instance.StartInfo.Arguments += " --acl default.acl"; Instance.StartInfo.Arguments += " --acl default.acl";

View File

@@ -34,7 +34,7 @@ namespace Netch.Controllers
Instance = MainController.GetProcess(); Instance = MainController.GetProcess();
Instance.StartInfo.FileName = "bin\\ShadowsocksR.exe"; Instance.StartInfo.FileName = "bin\\ShadowsocksR.exe";
Instance.StartInfo.Arguments = $"-s {server.Hostname} -p {server.Port} -k \"{server.Password}\" -m {server.EncryptMethod}"; Instance.StartInfo.Arguments = $"-s {server.Hostname} -p {server.Port} -k \"{server.Password}\" -m {server.EncryptMethod} -t 600";
if (!string.IsNullOrEmpty(server.Protocol)) if (!string.IsNullOrEmpty(server.Protocol))
{ {

View File

@@ -1,11 +1,12 @@
using System; using Netch.Forms;
using Netch.Utils;
using System;
using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using System.Net; using System.Net;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using Netch.Forms;
using Netch.Utils;
namespace Netch.Controllers namespace Netch.Controllers
{ {
@@ -37,6 +38,9 @@ namespace Netch.Controllers
/// </summary> /// </summary>
public DNSController pDNSController = new DNSController(); 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/16" };
/// <summary> /// <summary>
/// 配置 TUNTAP 适配器 /// 配置 TUNTAP 适配器
/// </summary> /// </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) // 处理仅规则内走直连 if (SavedMode.Type == 2) // 处理仅规则内走直连
{ {
// 将 TUN/TAP 网卡权重放到最高 // 将 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; 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) 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); 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) if (SavedMode.BypassChina)
{ {
@@ -311,7 +427,7 @@ namespace Netch.Controllers
else 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.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.CreateNoWindow = true;
Instance.StartInfo.RedirectStandardError = true; Instance.StartInfo.RedirectStandardError = true;

View File

@@ -1,10 +1,10 @@
using System; using Netch.Models.GitHubRelease;
using Newtonsoft.Json;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.Net.Http; using System.Net.Http;
using System.Threading.Tasks; using System.Threading.Tasks;
using Netch.Models.GitHubRelease;
using Newtonsoft.Json;
namespace Netch.Controllers namespace Netch.Controllers
{ {
@@ -26,7 +26,7 @@ namespace Netch.Controllers
public const string Name = @"Netch"; public const string Name = @"Netch";
public const string Copyright = @"Copyright © 2019 - 2020"; public const string Copyright = @"Copyright © 2019 - 2020";
public const string Version = @"1.4.0"; public const string Version = @"1.4.2";
public async void Check(bool notifyNoFound, bool isPreRelease) public async void Check(bool notifyNoFound, bool isPreRelease)
{ {

View File

@@ -126,14 +126,6 @@ namespace Netch.Controllers
{ {
enabled = server.UseMux enabled = server.UseMux
} }
},
new Models.Information.VMess.Outbounds
{
tag = "direct",
protocol = "freedom",
settings = null,
streamSettings = null,
mux = null
} }
}, },
routing = new Models.Information.VMess.Routing routing = new Models.Information.VMess.Routing
@@ -147,7 +139,7 @@ namespace Netch.Controllers
{ {
"geoip:cn", "geoip:cn",
"geoip:private" "geoip:private"
}, },
domain = new List<string> domain = new List<string>
{ {

View File

@@ -50,26 +50,32 @@ namespace Netch.Forms
this.RestartServiceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.RestartServiceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.UninstallServiceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.UninstallServiceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.CleanDNSCacheToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.CleanDNSCacheToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.UpdateACLToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.AboutToolStripButton = new System.Windows.Forms.ToolStripButton(); this.AboutToolStripButton = new System.Windows.Forms.ToolStripButton();
this.VersionLabel = new System.Windows.Forms.ToolStripLabel(); this.VersionLabel = new System.Windows.Forms.ToolStripLabel();
this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.ConfigurationGroupBox = new System.Windows.Forms.GroupBox(); this.ConfigurationGroupBox = new System.Windows.Forms.GroupBox();
this.CopyLinkPictureBox = new System.Windows.Forms.PictureBox(); this.configLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
this.DeleteModePictureBox = new System.Windows.Forms.PictureBox();
this.EditModePictureBox = new System.Windows.Forms.PictureBox();
this.ProfileNameText = new System.Windows.Forms.TextBox();
this.ProfileLabel = new System.Windows.Forms.Label(); this.ProfileLabel = new System.Windows.Forms.Label();
this.SpeedPictureBox = new System.Windows.Forms.PictureBox();
this.DeletePictureBox = new System.Windows.Forms.PictureBox();
this.EditPictureBox = new System.Windows.Forms.PictureBox();
this.ModeLabel = new System.Windows.Forms.Label(); this.ModeLabel = new System.Windows.Forms.Label();
this.ServerLabel = new System.Windows.Forms.Label();
this.ProfileNameText = new System.Windows.Forms.TextBox();
this.ModeComboBox = new System.Windows.Forms.SearchComboBox(); this.ModeComboBox = new System.Windows.Forms.SearchComboBox();
this.ServerComboBox = new System.Windows.Forms.ComboBox(); this.ServerComboBox = new System.Windows.Forms.ComboBox();
this.ServerLabel = new System.Windows.Forms.Label(); this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
this.EditPictureBox = new System.Windows.Forms.PictureBox();
this.CopyLinkPictureBox = new System.Windows.Forms.PictureBox();
this.DeletePictureBox = new System.Windows.Forms.PictureBox();
this.SpeedPictureBox = new System.Windows.Forms.PictureBox();
this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel();
this.EditModePictureBox = new System.Windows.Forms.PictureBox();
this.DeleteModePictureBox = new System.Windows.Forms.PictureBox();
this.StatusStrip = new System.Windows.Forms.StatusStrip(); this.StatusStrip = new System.Windows.Forms.StatusStrip();
this.StatusLabel = new System.Windows.Forms.ToolStripStatusLabel(); this.StatusLabel = new System.Windows.Forms.ToolStripStatusLabel();
this.UsedBandwidthLabel = new System.Windows.Forms.ToolStripStatusLabel(); this.UsedBandwidthLabel = new System.Windows.Forms.ToolStripStatusLabel();
this.DownloadSpeedLabel = new System.Windows.Forms.ToolStripStatusLabel(); this.DownloadSpeedLabel = new System.Windows.Forms.ToolStripStatusLabel();
this.UploadSpeedLabel = new System.Windows.Forms.ToolStripStatusLabel(); this.UploadSpeedLabel = new System.Windows.Forms.ToolStripStatusLabel();
this.NatTypeStatusLabel = new System.Windows.Forms.ToolStripStatusLabel();
this.ControlButton = new System.Windows.Forms.Button(); this.ControlButton = new System.Windows.Forms.Button();
this.NotifyIcon = new System.Windows.Forms.NotifyIcon(this.components); this.NotifyIcon = new System.Windows.Forms.NotifyIcon(this.components);
this.NotifyMenu = new System.Windows.Forms.ContextMenuStrip(this.components); this.NotifyMenu = new System.Windows.Forms.ContextMenuStrip(this.components);
@@ -78,15 +84,18 @@ namespace Netch.Forms
this.SettingsButton = new System.Windows.Forms.Button(); this.SettingsButton = new System.Windows.Forms.Button();
this.ProfileGroupBox = new System.Windows.Forms.GroupBox(); this.ProfileGroupBox = new System.Windows.Forms.GroupBox();
this.ProfileTable = new System.Windows.Forms.TableLayoutPanel(); this.ProfileTable = new System.Windows.Forms.TableLayoutPanel();
this.NatTypeStatusLabel = new System.Windows.Forms.ToolStripStatusLabel(); this.updateACLWithProxyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.MenuStrip.SuspendLayout(); this.MenuStrip.SuspendLayout();
this.ConfigurationGroupBox.SuspendLayout(); this.ConfigurationGroupBox.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.CopyLinkPictureBox)).BeginInit(); this.configLayoutPanel.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.DeleteModePictureBox)).BeginInit(); this.tableLayoutPanel2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.EditModePictureBox)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.SpeedPictureBox)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.DeletePictureBox)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.EditPictureBox)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.EditPictureBox)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.CopyLinkPictureBox)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.DeletePictureBox)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.SpeedPictureBox)).BeginInit();
this.tableLayoutPanel3.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.EditModePictureBox)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.DeleteModePictureBox)).BeginInit();
this.StatusStrip.SuspendLayout(); this.StatusStrip.SuspendLayout();
this.NotifyMenu.SuspendLayout(); this.NotifyMenu.SuspendLayout();
this.ProfileGroupBox.SuspendLayout(); this.ProfileGroupBox.SuspendLayout();
@@ -102,7 +111,8 @@ namespace Netch.Forms
this.SubscribeToolStripMenuItem, this.SubscribeToolStripMenuItem,
this.OptionsToolStripMenuItem, this.OptionsToolStripMenuItem,
this.AboutToolStripButton, this.AboutToolStripButton,
this.VersionLabel}); this.VersionLabel,
this.exitToolStripMenuItem});
this.MenuStrip.Location = new System.Drawing.Point(0, 0); this.MenuStrip.Location = new System.Drawing.Point(0, 0);
this.MenuStrip.Name = "MenuStrip"; this.MenuStrip.Name = "MenuStrip";
this.MenuStrip.RenderMode = System.Windows.Forms.ToolStripRenderMode.Professional; this.MenuStrip.RenderMode = System.Windows.Forms.ToolStripRenderMode.Professional;
@@ -211,7 +221,9 @@ namespace Netch.Forms
this.ReloadModesToolStripMenuItem, this.ReloadModesToolStripMenuItem,
this.RestartServiceToolStripMenuItem, this.RestartServiceToolStripMenuItem,
this.UninstallServiceToolStripMenuItem, this.UninstallServiceToolStripMenuItem,
this.CleanDNSCacheToolStripMenuItem}); this.CleanDNSCacheToolStripMenuItem,
this.UpdateACLToolStripMenuItem,
this.updateACLWithProxyToolStripMenuItem});
this.OptionsToolStripMenuItem.Margin = new System.Windows.Forms.Padding(0, 0, 0, 1); this.OptionsToolStripMenuItem.Margin = new System.Windows.Forms.Padding(0, 0, 0, 1);
this.OptionsToolStripMenuItem.Name = "OptionsToolStripMenuItem"; this.OptionsToolStripMenuItem.Name = "OptionsToolStripMenuItem";
this.OptionsToolStripMenuItem.Size = new System.Drawing.Size(66, 21); this.OptionsToolStripMenuItem.Size = new System.Drawing.Size(66, 21);
@@ -220,31 +232,38 @@ namespace Netch.Forms
// ReloadModesToolStripMenuItem // ReloadModesToolStripMenuItem
// //
this.ReloadModesToolStripMenuItem.Name = "ReloadModesToolStripMenuItem"; this.ReloadModesToolStripMenuItem.Name = "ReloadModesToolStripMenuItem";
this.ReloadModesToolStripMenuItem.Size = new System.Drawing.Size(177, 22); this.ReloadModesToolStripMenuItem.Size = new System.Drawing.Size(209, 22);
this.ReloadModesToolStripMenuItem.Text = "Reload Modes"; this.ReloadModesToolStripMenuItem.Text = "Reload Modes";
this.ReloadModesToolStripMenuItem.Click += new System.EventHandler(this.ReloadModesToolStripMenuItem_Click); this.ReloadModesToolStripMenuItem.Click += new System.EventHandler(this.ReloadModesToolStripMenuItem_Click);
// //
// RestartServiceToolStripMenuItem // RestartServiceToolStripMenuItem
// //
this.RestartServiceToolStripMenuItem.Name = "RestartServiceToolStripMenuItem"; this.RestartServiceToolStripMenuItem.Name = "RestartServiceToolStripMenuItem";
this.RestartServiceToolStripMenuItem.Size = new System.Drawing.Size(177, 22); this.RestartServiceToolStripMenuItem.Size = new System.Drawing.Size(209, 22);
this.RestartServiceToolStripMenuItem.Text = "Restart Service"; this.RestartServiceToolStripMenuItem.Text = "Restart Service";
this.RestartServiceToolStripMenuItem.Click += new System.EventHandler(this.RestartServiceToolStripMenuItem_Click); this.RestartServiceToolStripMenuItem.Click += new System.EventHandler(this.RestartServiceToolStripMenuItem_Click);
// //
// UninstallServiceToolStripMenuItem // UninstallServiceToolStripMenuItem
// //
this.UninstallServiceToolStripMenuItem.Name = "UninstallServiceToolStripMenuItem"; this.UninstallServiceToolStripMenuItem.Name = "UninstallServiceToolStripMenuItem";
this.UninstallServiceToolStripMenuItem.Size = new System.Drawing.Size(177, 22); this.UninstallServiceToolStripMenuItem.Size = new System.Drawing.Size(209, 22);
this.UninstallServiceToolStripMenuItem.Text = "Uninstall Service"; this.UninstallServiceToolStripMenuItem.Text = "Uninstall Service";
this.UninstallServiceToolStripMenuItem.Click += new System.EventHandler(this.UninstallServiceToolStripMenuItem_Click); this.UninstallServiceToolStripMenuItem.Click += new System.EventHandler(this.UninstallServiceToolStripMenuItem_Click);
// //
// CleanDNSCacheToolStripMenuItem // CleanDNSCacheToolStripMenuItem
// //
this.CleanDNSCacheToolStripMenuItem.Name = "CleanDNSCacheToolStripMenuItem"; this.CleanDNSCacheToolStripMenuItem.Name = "CleanDNSCacheToolStripMenuItem";
this.CleanDNSCacheToolStripMenuItem.Size = new System.Drawing.Size(177, 22); this.CleanDNSCacheToolStripMenuItem.Size = new System.Drawing.Size(209, 22);
this.CleanDNSCacheToolStripMenuItem.Text = "Clean DNS Cache"; this.CleanDNSCacheToolStripMenuItem.Text = "Clean DNS Cache";
this.CleanDNSCacheToolStripMenuItem.Click += new System.EventHandler(this.CleanDNSCacheToolStripMenuItem_Click); this.CleanDNSCacheToolStripMenuItem.Click += new System.EventHandler(this.CleanDNSCacheToolStripMenuItem_Click);
// //
// UpdateACLToolStripMenuItem
//
this.UpdateACLToolStripMenuItem.Name = "UpdateACLToolStripMenuItem";
this.UpdateACLToolStripMenuItem.Size = new System.Drawing.Size(209, 22);
this.UpdateACLToolStripMenuItem.Text = "Update ACL";
this.UpdateACLToolStripMenuItem.Click += new System.EventHandler(this.updateACLToolStripMenuItem_Click);
//
// AboutToolStripButton // AboutToolStripButton
// //
this.AboutToolStripButton.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right; this.AboutToolStripButton.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;
@@ -267,48 +286,189 @@ namespace Netch.Forms
this.VersionLabel.Text = "x.x.x"; this.VersionLabel.Text = "x.x.x";
this.VersionLabel.Click += new System.EventHandler(this.VersionLabel_Click); this.VersionLabel.Click += new System.EventHandler(this.VersionLabel_Click);
// //
// exitToolStripMenuItem
//
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
this.exitToolStripMenuItem.Size = new System.Drawing.Size(40, 22);
this.exitToolStripMenuItem.Text = "Exit";
this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
//
// ConfigurationGroupBox // ConfigurationGroupBox
// //
this.ConfigurationGroupBox.Controls.Add(this.CopyLinkPictureBox); this.ConfigurationGroupBox.Controls.Add(this.configLayoutPanel);
this.ConfigurationGroupBox.Controls.Add(this.DeleteModePictureBox);
this.ConfigurationGroupBox.Controls.Add(this.EditModePictureBox);
this.ConfigurationGroupBox.Controls.Add(this.ProfileNameText);
this.ConfigurationGroupBox.Controls.Add(this.ProfileLabel);
this.ConfigurationGroupBox.Controls.Add(this.SpeedPictureBox);
this.ConfigurationGroupBox.Controls.Add(this.DeletePictureBox);
this.ConfigurationGroupBox.Controls.Add(this.EditPictureBox);
this.ConfigurationGroupBox.Controls.Add(this.ModeLabel);
this.ConfigurationGroupBox.Controls.Add(this.ModeComboBox);
this.ConfigurationGroupBox.Controls.Add(this.ServerComboBox);
this.ConfigurationGroupBox.Controls.Add(this.ServerLabel);
this.ConfigurationGroupBox.Location = new System.Drawing.Point(12, 28); this.ConfigurationGroupBox.Location = new System.Drawing.Point(12, 28);
this.ConfigurationGroupBox.Name = "ConfigurationGroupBox"; this.ConfigurationGroupBox.Name = "ConfigurationGroupBox";
this.ConfigurationGroupBox.Size = new System.Drawing.Size(605, 113); this.ConfigurationGroupBox.Size = new System.Drawing.Size(605, 115);
this.ConfigurationGroupBox.TabIndex = 1; this.ConfigurationGroupBox.TabIndex = 1;
this.ConfigurationGroupBox.TabStop = false; this.ConfigurationGroupBox.TabStop = false;
this.ConfigurationGroupBox.Text = "Configuration"; this.ConfigurationGroupBox.Text = "Configuration";
// //
// configLayoutPanel
//
this.configLayoutPanel.ColumnCount = 3;
this.configLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.configLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.configLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.configLayoutPanel.Controls.Add(this.ProfileLabel, 0, 2);
this.configLayoutPanel.Controls.Add(this.ModeLabel, 0, 1);
this.configLayoutPanel.Controls.Add(this.ServerLabel, 0, 0);
this.configLayoutPanel.Controls.Add(this.ProfileNameText, 1, 2);
this.configLayoutPanel.Controls.Add(this.ModeComboBox, 1, 1);
this.configLayoutPanel.Controls.Add(this.ServerComboBox, 1, 0);
this.configLayoutPanel.Controls.Add(this.tableLayoutPanel2, 2, 0);
this.configLayoutPanel.Controls.Add(this.tableLayoutPanel3, 2, 1);
this.configLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill;
this.configLayoutPanel.Location = new System.Drawing.Point(3, 19);
this.configLayoutPanel.Name = "configLayoutPanel";
this.configLayoutPanel.RowCount = 3;
this.configLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this.configLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this.configLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this.configLayoutPanel.Size = new System.Drawing.Size(599, 93);
this.configLayoutPanel.TabIndex = 15;
//
// ProfileLabel
//
this.ProfileLabel.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.ProfileLabel.AutoSize = true;
this.ProfileLabel.Location = new System.Drawing.Point(3, 69);
this.ProfileLabel.Name = "ProfileLabel";
this.ProfileLabel.Size = new System.Drawing.Size(45, 17);
this.ProfileLabel.TabIndex = 10;
this.ProfileLabel.Text = "Profile";
//
// ModeLabel
//
this.ModeLabel.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.ModeLabel.AutoSize = true;
this.ModeLabel.Location = new System.Drawing.Point(3, 38);
this.ModeLabel.Name = "ModeLabel";
this.ModeLabel.Size = new System.Drawing.Size(43, 17);
this.ModeLabel.TabIndex = 3;
this.ModeLabel.Text = "Mode";
//
// ServerLabel
//
this.ServerLabel.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.ServerLabel.AutoSize = true;
this.ServerLabel.Location = new System.Drawing.Point(3, 7);
this.ServerLabel.Name = "ServerLabel";
this.ServerLabel.Size = new System.Drawing.Size(45, 17);
this.ServerLabel.TabIndex = 0;
this.ServerLabel.Text = "Server";
//
// ProfileNameText
//
this.ProfileNameText.Dock = System.Windows.Forms.DockStyle.Fill;
this.ProfileNameText.Location = new System.Drawing.Point(54, 65);
this.ProfileNameText.Name = "ProfileNameText";
this.ProfileNameText.Size = new System.Drawing.Size(442, 23);
this.ProfileNameText.TabIndex = 11;
//
// ModeComboBox
//
this.ModeComboBox.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest;
this.ModeComboBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.ModeComboBox.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
this.ModeComboBox.FormattingEnabled = true;
this.ModeComboBox.IntegralHeight = false;
this.ModeComboBox.Location = new System.Drawing.Point(54, 34);
this.ModeComboBox.Name = "ModeComboBox";
this.ModeComboBox.Size = new System.Drawing.Size(442, 24);
this.ModeComboBox.TabIndex = 2;
this.ModeComboBox.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.ComboBox_DrawItem);
//
// ServerComboBox
//
this.ServerComboBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.ServerComboBox.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
this.ServerComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.ServerComboBox.FormattingEnabled = true;
this.ServerComboBox.IntegralHeight = false;
this.ServerComboBox.Location = new System.Drawing.Point(54, 3);
this.ServerComboBox.MaxDropDownItems = 16;
this.ServerComboBox.Name = "ServerComboBox";
this.ServerComboBox.Size = new System.Drawing.Size(442, 24);
this.ServerComboBox.TabIndex = 1;
this.ServerComboBox.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.ComboBox_DrawItem);
//
// tableLayoutPanel2
//
this.tableLayoutPanel2.ColumnCount = 4;
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.tableLayoutPanel2.Controls.Add(this.EditPictureBox, 0, 0);
this.tableLayoutPanel2.Controls.Add(this.CopyLinkPictureBox, 3, 0);
this.tableLayoutPanel2.Controls.Add(this.DeletePictureBox, 1, 0);
this.tableLayoutPanel2.Controls.Add(this.SpeedPictureBox, 2, 0);
this.tableLayoutPanel2.Location = new System.Drawing.Point(502, 3);
this.tableLayoutPanel2.Name = "tableLayoutPanel2";
this.tableLayoutPanel2.RowCount = 1;
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel2.Size = new System.Drawing.Size(94, 24);
this.tableLayoutPanel2.TabIndex = 12;
//
// EditPictureBox
//
this.EditPictureBox.Cursor = System.Windows.Forms.Cursors.Hand;
this.EditPictureBox.Image = ((System.Drawing.Image)(resources.GetObject("EditPictureBox.Image")));
this.EditPictureBox.Location = new System.Drawing.Point(3, 3);
this.EditPictureBox.Name = "EditPictureBox";
this.EditPictureBox.Size = new System.Drawing.Size(16, 16);
this.EditPictureBox.TabIndex = 7;
this.EditPictureBox.TabStop = false;
this.EditPictureBox.Click += new System.EventHandler(this.EditPictureBox_Click);
//
// CopyLinkPictureBox // CopyLinkPictureBox
// //
this.CopyLinkPictureBox.Cursor = System.Windows.Forms.Cursors.Hand; this.CopyLinkPictureBox.Cursor = System.Windows.Forms.Cursors.Hand;
this.CopyLinkPictureBox.Image = global::Netch.Properties.Resources.CopyLink; this.CopyLinkPictureBox.Image = global::Netch.Properties.Resources.CopyLink;
this.CopyLinkPictureBox.Location = new System.Drawing.Point(582, 25); this.CopyLinkPictureBox.Location = new System.Drawing.Point(72, 3);
this.CopyLinkPictureBox.Name = "CopyLinkPictureBox"; this.CopyLinkPictureBox.Name = "CopyLinkPictureBox";
this.CopyLinkPictureBox.Size = new System.Drawing.Size(18, 18); this.CopyLinkPictureBox.Size = new System.Drawing.Size(18, 18);
this.CopyLinkPictureBox.TabIndex = 14; this.CopyLinkPictureBox.TabIndex = 14;
this.CopyLinkPictureBox.TabStop = false; this.CopyLinkPictureBox.TabStop = false;
this.CopyLinkPictureBox.Click += new System.EventHandler(this.CopyLinkPictureBox_Click); this.CopyLinkPictureBox.Click += new System.EventHandler(this.CopyLinkPictureBox_Click);
// //
// DeleteModePictureBox // DeletePictureBox
// //
this.DeleteModePictureBox.Cursor = System.Windows.Forms.Cursors.Hand; this.DeletePictureBox.Cursor = System.Windows.Forms.Cursors.Hand;
this.DeleteModePictureBox.Image = global::Netch.Properties.Resources.delete; this.DeletePictureBox.Image = ((System.Drawing.Image)(resources.GetObject("DeletePictureBox.Image")));
this.DeleteModePictureBox.Location = new System.Drawing.Point(540, 57); this.DeletePictureBox.Location = new System.Drawing.Point(26, 3);
this.DeleteModePictureBox.Name = "DeleteModePictureBox"; this.DeletePictureBox.Name = "DeletePictureBox";
this.DeleteModePictureBox.Size = new System.Drawing.Size(16, 16); this.DeletePictureBox.Size = new System.Drawing.Size(16, 16);
this.DeleteModePictureBox.TabIndex = 13; this.DeletePictureBox.TabIndex = 8;
this.DeleteModePictureBox.TabStop = false; this.DeletePictureBox.TabStop = false;
this.DeleteModePictureBox.Click += new System.EventHandler(this.DeleteModePictureBox_Click); this.DeletePictureBox.Click += new System.EventHandler(this.DeletePictureBox_Click);
//
// SpeedPictureBox
//
this.SpeedPictureBox.Cursor = System.Windows.Forms.Cursors.Hand;
this.SpeedPictureBox.Image = ((System.Drawing.Image)(resources.GetObject("SpeedPictureBox.Image")));
this.SpeedPictureBox.Location = new System.Drawing.Point(49, 3);
this.SpeedPictureBox.Name = "SpeedPictureBox";
this.SpeedPictureBox.Size = new System.Drawing.Size(16, 16);
this.SpeedPictureBox.TabIndex = 9;
this.SpeedPictureBox.TabStop = false;
this.SpeedPictureBox.Click += new System.EventHandler(this.SpeedPictureBox_Click);
//
// tableLayoutPanel3
//
this.tableLayoutPanel3.ColumnCount = 4;
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.tableLayoutPanel3.Controls.Add(this.EditModePictureBox, 0, 0);
this.tableLayoutPanel3.Controls.Add(this.DeleteModePictureBox, 1, 0);
this.tableLayoutPanel3.Location = new System.Drawing.Point(502, 34);
this.tableLayoutPanel3.Name = "tableLayoutPanel3";
this.tableLayoutPanel3.RowCount = 1;
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel3.Size = new System.Drawing.Size(94, 24);
this.tableLayoutPanel3.TabIndex = 13;
// //
// EditModePictureBox // EditModePictureBox
// //
@@ -316,104 +476,23 @@ namespace Netch.Forms
this.EditModePictureBox.ErrorImage = global::Netch.Properties.Resources.edit; this.EditModePictureBox.ErrorImage = global::Netch.Properties.Resources.edit;
this.EditModePictureBox.Image = global::Netch.Properties.Resources.edit; this.EditModePictureBox.Image = global::Netch.Properties.Resources.edit;
this.EditModePictureBox.InitialImage = global::Netch.Properties.Resources.edit; this.EditModePictureBox.InitialImage = global::Netch.Properties.Resources.edit;
this.EditModePictureBox.Location = new System.Drawing.Point(518, 56); this.EditModePictureBox.Location = new System.Drawing.Point(3, 3);
this.EditModePictureBox.Name = "EditModePictureBox"; this.EditModePictureBox.Name = "EditModePictureBox";
this.EditModePictureBox.Size = new System.Drawing.Size(16, 16); this.EditModePictureBox.Size = new System.Drawing.Size(16, 16);
this.EditModePictureBox.TabIndex = 12; this.EditModePictureBox.TabIndex = 12;
this.EditModePictureBox.TabStop = false; this.EditModePictureBox.TabStop = false;
this.EditModePictureBox.Click += new System.EventHandler(this.EditModePictureBox_Click); this.EditModePictureBox.Click += new System.EventHandler(this.EditModePictureBox_Click);
// //
// ProfileNameText // DeleteModePictureBox
// //
this.ProfileNameText.Location = new System.Drawing.Point(57, 83); this.DeleteModePictureBox.Cursor = System.Windows.Forms.Cursors.Hand;
this.ProfileNameText.Name = "ProfileNameText"; this.DeleteModePictureBox.Image = global::Netch.Properties.Resources.delete;
this.ProfileNameText.Size = new System.Drawing.Size(455, 23); this.DeleteModePictureBox.Location = new System.Drawing.Point(26, 3);
this.ProfileNameText.TabIndex = 11; this.DeleteModePictureBox.Name = "DeleteModePictureBox";
// this.DeleteModePictureBox.Size = new System.Drawing.Size(16, 16);
// ProfileLabel this.DeleteModePictureBox.TabIndex = 13;
// this.DeleteModePictureBox.TabStop = false;
this.ProfileLabel.AutoSize = true; this.DeleteModePictureBox.Click += new System.EventHandler(this.DeleteModePictureBox_Click);
this.ProfileLabel.Location = new System.Drawing.Point(6, 86);
this.ProfileLabel.Name = "ProfileLabel";
this.ProfileLabel.Size = new System.Drawing.Size(45, 17);
this.ProfileLabel.TabIndex = 10;
this.ProfileLabel.Text = "Profile";
//
// SpeedPictureBox
//
this.SpeedPictureBox.Cursor = System.Windows.Forms.Cursors.Hand;
this.SpeedPictureBox.Image = ((System.Drawing.Image)(resources.GetObject("SpeedPictureBox.Image")));
this.SpeedPictureBox.Location = new System.Drawing.Point(562, 26);
this.SpeedPictureBox.Name = "SpeedPictureBox";
this.SpeedPictureBox.Size = new System.Drawing.Size(16, 16);
this.SpeedPictureBox.TabIndex = 9;
this.SpeedPictureBox.TabStop = false;
this.SpeedPictureBox.Click += new System.EventHandler(this.SpeedPictureBox_Click);
//
// DeletePictureBox
//
this.DeletePictureBox.Cursor = System.Windows.Forms.Cursors.Hand;
this.DeletePictureBox.Image = ((System.Drawing.Image)(resources.GetObject("DeletePictureBox.Image")));
this.DeletePictureBox.Location = new System.Drawing.Point(540, 26);
this.DeletePictureBox.Name = "DeletePictureBox";
this.DeletePictureBox.Size = new System.Drawing.Size(16, 16);
this.DeletePictureBox.TabIndex = 8;
this.DeletePictureBox.TabStop = false;
this.DeletePictureBox.Click += new System.EventHandler(this.DeletePictureBox_Click);
//
// EditPictureBox
//
this.EditPictureBox.Cursor = System.Windows.Forms.Cursors.Hand;
this.EditPictureBox.Image = ((System.Drawing.Image)(resources.GetObject("EditPictureBox.Image")));
this.EditPictureBox.Location = new System.Drawing.Point(518, 26);
this.EditPictureBox.Name = "EditPictureBox";
this.EditPictureBox.Size = new System.Drawing.Size(16, 16);
this.EditPictureBox.TabIndex = 7;
this.EditPictureBox.TabStop = false;
this.EditPictureBox.Click += new System.EventHandler(this.EditPictureBox_Click);
//
// ModeLabel
//
this.ModeLabel.AutoSize = true;
this.ModeLabel.Location = new System.Drawing.Point(6, 56);
this.ModeLabel.Name = "ModeLabel";
this.ModeLabel.Size = new System.Drawing.Size(43, 17);
this.ModeLabel.TabIndex = 3;
this.ModeLabel.Text = "Mode";
//
// ModeComboBox
//
this.ModeComboBox.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest;
this.ModeComboBox.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
this.ModeComboBox.FormattingEnabled = true;
this.ModeComboBox.IntegralHeight = false;
this.ModeComboBox.Location = new System.Drawing.Point(57, 53);
this.ModeComboBox.Name = "ModeComboBox";
this.ModeComboBox.Size = new System.Drawing.Size(455, 24);
this.ModeComboBox.TabIndex = 2;
this.ModeComboBox.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.ComboBox_DrawItem);
//
// ServerComboBox
//
this.ServerComboBox.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
this.ServerComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.ServerComboBox.FormattingEnabled = true;
this.ServerComboBox.IntegralHeight = false;
this.ServerComboBox.Location = new System.Drawing.Point(57, 22);
this.ServerComboBox.MaxDropDownItems = 16;
this.ServerComboBox.Name = "ServerComboBox";
this.ServerComboBox.Size = new System.Drawing.Size(455, 24);
this.ServerComboBox.TabIndex = 1;
this.ServerComboBox.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.ComboBox_DrawItem);
//
// ServerLabel
//
this.ServerLabel.AutoSize = true;
this.ServerLabel.Location = new System.Drawing.Point(6, 26);
this.ServerLabel.Name = "ServerLabel";
this.ServerLabel.Size = new System.Drawing.Size(45, 17);
this.ServerLabel.TabIndex = 0;
this.ServerLabel.Text = "Server";
// //
// StatusStrip // StatusStrip
// //
@@ -424,7 +503,7 @@ namespace Netch.Forms
this.DownloadSpeedLabel, this.DownloadSpeedLabel,
this.UploadSpeedLabel, this.UploadSpeedLabel,
this.NatTypeStatusLabel}); this.NatTypeStatusLabel});
this.StatusStrip.Location = new System.Drawing.Point(0, 254); this.StatusStrip.Location = new System.Drawing.Point(0, 250);
this.StatusStrip.Name = "StatusStrip"; this.StatusStrip.Name = "StatusStrip";
this.StatusStrip.Size = new System.Drawing.Size(629, 22); this.StatusStrip.Size = new System.Drawing.Size(629, 22);
this.StatusStrip.SizingGrip = false; this.StatusStrip.SizingGrip = false;
@@ -458,9 +537,15 @@ namespace Netch.Forms
this.UploadSpeedLabel.Text = "↑: 0 KB/s"; this.UploadSpeedLabel.Text = "↑: 0 KB/s";
this.UploadSpeedLabel.Visible = false; this.UploadSpeedLabel.Visible = false;
// //
// NatTypeStatusLabel
//
this.NatTypeStatusLabel.Name = "NatTypeStatusLabel";
this.NatTypeStatusLabel.Size = new System.Drawing.Size(0, 17);
//
// ControlButton // ControlButton
// //
this.ControlButton.Location = new System.Drawing.Point(542, 219); this.ControlButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.ControlButton.Location = new System.Drawing.Point(542, 215);
this.ControlButton.Name = "ControlButton"; this.ControlButton.Name = "ControlButton";
this.ControlButton.Size = new System.Drawing.Size(75, 27); this.ControlButton.Size = new System.Drawing.Size(75, 27);
this.ControlButton.TabIndex = 3; this.ControlButton.TabIndex = 3;
@@ -502,7 +587,8 @@ namespace Netch.Forms
// //
// SettingsButton // SettingsButton
// //
this.SettingsButton.Location = new System.Drawing.Point(12, 219); this.SettingsButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.SettingsButton.Location = new System.Drawing.Point(12, 215);
this.SettingsButton.Name = "SettingsButton"; this.SettingsButton.Name = "SettingsButton";
this.SettingsButton.Size = new System.Drawing.Size(72, 27); this.SettingsButton.Size = new System.Drawing.Size(72, 27);
this.SettingsButton.TabIndex = 4; this.SettingsButton.TabIndex = 4;
@@ -513,7 +599,7 @@ namespace Netch.Forms
// ProfileGroupBox // ProfileGroupBox
// //
this.ProfileGroupBox.Controls.Add(this.ProfileTable); this.ProfileGroupBox.Controls.Add(this.ProfileTable);
this.ProfileGroupBox.Location = new System.Drawing.Point(12, 147); this.ProfileGroupBox.Location = new System.Drawing.Point(12, 146);
this.ProfileGroupBox.Name = "ProfileGroupBox"; this.ProfileGroupBox.Name = "ProfileGroupBox";
this.ProfileGroupBox.Size = new System.Drawing.Size(605, 65); this.ProfileGroupBox.Size = new System.Drawing.Size(605, 65);
this.ProfileGroupBox.TabIndex = 13; this.ProfileGroupBox.TabIndex = 13;
@@ -536,17 +622,18 @@ namespace Netch.Forms
this.ProfileTable.Size = new System.Drawing.Size(599, 43); this.ProfileTable.Size = new System.Drawing.Size(599, 43);
this.ProfileTable.TabIndex = 0; this.ProfileTable.TabIndex = 0;
// //
// NatTypeStatusLabel // updateACLWithProxyToolStripMenuItem
// //
this.NatTypeStatusLabel.Name = "NatTypeStatusLabel"; this.updateACLWithProxyToolStripMenuItem.Name = "updateACLWithProxyToolStripMenuItem";
this.NatTypeStatusLabel.Size = new System.Drawing.Size(109, 17); this.updateACLWithProxyToolStripMenuItem.Size = new System.Drawing.Size(209, 22);
this.NatTypeStatusLabel.Text = ""; this.updateACLWithProxyToolStripMenuItem.Text = "Update ACL with proxy";
this.updateACLWithProxyToolStripMenuItem.Click += new System.EventHandler(this.updateACLWithProxyToolStripMenuItem_Click);
// //
// MainForm // MainForm
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(629, 276); this.ClientSize = new System.Drawing.Size(629, 272);
this.Controls.Add(this.ProfileGroupBox); this.Controls.Add(this.ProfileGroupBox);
this.Controls.Add(this.SettingsButton); this.Controls.Add(this.SettingsButton);
this.Controls.Add(this.ControlButton); this.Controls.Add(this.ControlButton);
@@ -566,13 +653,16 @@ namespace Netch.Forms
this.MenuStrip.ResumeLayout(false); this.MenuStrip.ResumeLayout(false);
this.MenuStrip.PerformLayout(); this.MenuStrip.PerformLayout();
this.ConfigurationGroupBox.ResumeLayout(false); this.ConfigurationGroupBox.ResumeLayout(false);
this.ConfigurationGroupBox.PerformLayout(); this.configLayoutPanel.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.CopyLinkPictureBox)).EndInit(); this.configLayoutPanel.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.DeleteModePictureBox)).EndInit(); this.tableLayoutPanel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.EditModePictureBox)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.SpeedPictureBox)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.DeletePictureBox)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.EditPictureBox)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.EditPictureBox)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.CopyLinkPictureBox)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.DeletePictureBox)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.SpeedPictureBox)).EndInit();
this.tableLayoutPanel3.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.EditModePictureBox)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.DeleteModePictureBox)).EndInit();
this.StatusStrip.ResumeLayout(false); this.StatusStrip.ResumeLayout(false);
this.StatusStrip.PerformLayout(); this.StatusStrip.PerformLayout();
this.NotifyMenu.ResumeLayout(false); this.NotifyMenu.ResumeLayout(false);
@@ -632,5 +722,11 @@ namespace Netch.Forms
private System.Windows.Forms.PictureBox DeleteModePictureBox; private System.Windows.Forms.PictureBox DeleteModePictureBox;
private System.Windows.Forms.PictureBox CopyLinkPictureBox; private System.Windows.Forms.PictureBox CopyLinkPictureBox;
private System.Windows.Forms.ToolStripStatusLabel NatTypeStatusLabel; private System.Windows.Forms.ToolStripStatusLabel NatTypeStatusLabel;
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;
} }
} }

View File

@@ -325,10 +325,12 @@ namespace Netch.Forms
ManageSubscribeLinksToolStripMenuItem.Text = Utils.i18N.Translate(ManageSubscribeLinksToolStripMenuItem.Text); ManageSubscribeLinksToolStripMenuItem.Text = Utils.i18N.Translate(ManageSubscribeLinksToolStripMenuItem.Text);
UpdateServersFromSubscribeLinksToolStripMenuItem.Text = Utils.i18N.Translate(UpdateServersFromSubscribeLinksToolStripMenuItem.Text); UpdateServersFromSubscribeLinksToolStripMenuItem.Text = Utils.i18N.Translate(UpdateServersFromSubscribeLinksToolStripMenuItem.Text);
OptionsToolStripMenuItem.Text = Utils.i18N.Translate(OptionsToolStripMenuItem.Text); OptionsToolStripMenuItem.Text = Utils.i18N.Translate(OptionsToolStripMenuItem.Text);
exitToolStripMenuItem.Text = Utils.i18N.Translate(exitToolStripMenuItem.Text);
RestartServiceToolStripMenuItem.Text = Utils.i18N.Translate(RestartServiceToolStripMenuItem.Text); RestartServiceToolStripMenuItem.Text = Utils.i18N.Translate(RestartServiceToolStripMenuItem.Text);
UninstallServiceToolStripMenuItem.Text = Utils.i18N.Translate(UninstallServiceToolStripMenuItem.Text); UninstallServiceToolStripMenuItem.Text = Utils.i18N.Translate(UninstallServiceToolStripMenuItem.Text);
ReloadModesToolStripMenuItem.Text = Utils.i18N.Translate(ReloadModesToolStripMenuItem.Text); ReloadModesToolStripMenuItem.Text = Utils.i18N.Translate(ReloadModesToolStripMenuItem.Text);
CleanDNSCacheToolStripMenuItem.Text = Utils.i18N.Translate(CleanDNSCacheToolStripMenuItem.Text); CleanDNSCacheToolStripMenuItem.Text = Utils.i18N.Translate(CleanDNSCacheToolStripMenuItem.Text);
UpdateACLToolStripMenuItem.Text = Utils.i18N.Translate(UpdateACLToolStripMenuItem.Text);
AboutToolStripButton.Text = Utils.i18N.Translate(AboutToolStripButton.Text); AboutToolStripButton.Text = Utils.i18N.Translate(AboutToolStripButton.Text);
ConfigurationGroupBox.Text = Utils.i18N.Translate(ConfigurationGroupBox.Text); ConfigurationGroupBox.Text = Utils.i18N.Translate(ConfigurationGroupBox.Text);
ServerLabel.Text = Utils.i18N.Translate(ServerLabel.Text); ServerLabel.Text = Utils.i18N.Translate(ServerLabel.Text);
@@ -488,6 +490,7 @@ namespace Netch.Forms
if (Global.Settings.SubscribeLink.Count > 0) if (Global.Settings.SubscribeLink.Count > 0)
{ {
StatusLabel.Text = $"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Starting update subscription")}";
DeletePictureBox.Enabled = false; DeletePictureBox.Enabled = false;
UpdateServersFromSubscribeLinksToolStripMenuItem.Enabled = false; UpdateServersFromSubscribeLinksToolStripMenuItem.Enabled = false;
@@ -571,6 +574,7 @@ namespace Netch.Forms
NatTypeStatusLabel.Text = ""; NatTypeStatusLabel.Text = "";
} }
Utils.Configuration.Save(); Utils.Configuration.Save();
StatusLabel.Text = $"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Subscription updated")}";
}).ContinueWith(task => }).ContinueWith(task =>
{ {
BeginInvoke(new Action(() => BeginInvoke(new Action(() =>
@@ -789,7 +793,14 @@ namespace Netch.Forms
return; return;
} }
MenuStrip.Enabled = ConfigurationGroupBox.Enabled = ControlButton.Enabled = SettingsButton.Enabled = false; //MenuStrip.Enabled = ConfigurationGroupBox.Enabled = ControlButton.Enabled = SettingsButton.Enabled = false;
//关闭启动按钮
ControlButton.Enabled = false;
//关闭使用代理更新ACL
updateACLWithProxyToolStripMenuItem.Enabled = false;
UpdateServersFromSubscribeLinksToolStripMenuItem.Enabled = false;
ControlButton.Text = "..."; ControlButton.Text = "...";
StatusLabel.Text = $"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Starting")}"; StatusLabel.Text = $"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Starting")}";
State = Models.State.Starting; State = Models.State.Starting;
@@ -873,6 +884,28 @@ namespace Netch.Forms
} }
State = Models.State.Started; State = Models.State.Started;
if (Global.Settings.StartedTcping)
{
// 自动检测延迟
Task.Run(() =>
{
while (true)
{
if (State == Models.State.Started)
{
server.Test();
// 重载服务器列表
InitServer();
Thread.Sleep(Global.Settings.StartedTcping_Interval * 1000);
}
else
{
break;
}
}
});
}
} }
else else
{ {
@@ -1016,6 +1049,10 @@ namespace Netch.Forms
{ {
MessageBox.Show(Utils.i18N.Translate("Please select an mode first"), Utils.i18N.Translate("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); 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 else
{ {
SaveProfile(index); SaveProfile(index);
@@ -1024,6 +1061,11 @@ namespace Netch.Forms
} }
else 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 try
{ {
ProfileNameText.Text = LoadProfile(index); ProfileNameText.Text = LoadProfile(index);
@@ -1069,6 +1111,15 @@ namespace Netch.Forms
public void InitProfile() public void InitProfile()
{ {
var num_profile = Global.Settings.ProfileCount; var num_profile = Global.Settings.ProfileCount;
if (num_profile == 0)
{
ProfileGroupBox.Size = new Size(0, 0);
ConfigurationGroupBox.Size -= new Size(0, 25);
this.Size -= new Size(0, 70 + 25);
configLayoutPanel.RowStyles[2].Height = 0;
return;
}
ProfileTable.ColumnCount = num_profile; ProfileTable.ColumnCount = num_profile;
while (Global.Settings.profiles.Count < num_profile) while (Global.Settings.profiles.Count < num_profile)
@@ -1212,7 +1263,15 @@ namespace Netch.Forms
if (ServerComboBox.SelectedIndex != -1) if (ServerComboBox.SelectedIndex != -1)
{ {
var selectedMode = (Models.Server)ServerComboBox.SelectedItem; var selectedMode = (Models.Server)ServerComboBox.SelectedItem;
Clipboard.SetText(Utils.ShareLink.GetShareLink(selectedMode)); try
{
//听说巨硬BUG经常会炸所以Catch一下 :D
Clipboard.SetText(Utils.ShareLink.GetShareLink(selectedMode));
}
catch (Exception)
{
}
} }
else else
{ {
@@ -1225,7 +1284,135 @@ namespace Netch.Forms
} }
public void NatTypeStatusText(string text) 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");
}
}
private void updateACLToolStripMenuItem_Click(object sender, EventArgs e)
{
using var client = new Override.WebClient();
client.DownloadFileTaskAsync(Global.Settings.ACL, "bin\\default.acl");
client.DownloadFileCompleted += ((sender, args) =>
{
try
{
if (args.Error == null)
{
NotifyIcon.ShowBalloonTip(5,
UpdateChecker.Name, Utils.i18N.Translate("ACL updated successfully"),
ToolTipIcon.Info);
//MessageBox.Show(Utils.i18N.Translate("ACL updated successfully"));
}
else
{
Utils.Logging.Info("ACL更新失败" + args.Error);
NotifyIcon.ShowBalloonTip(5,
UpdateChecker.Name,
Utils.i18N.Translate("ACL update failed"),
ToolTipIcon.Error);
//MessageBox.Show(Utils.i18N.Translate("ACL update failed"));
}
}
finally
{
StatusText($"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Waiting for command")}");
}
});
}
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
{
// 当前状态如果不是已停止状态
if (State != Models.State.Waiting && State != Models.State.Stopped)
{
// 如果未勾选退出时停止,要求先点击停止按钮
if (!Global.Settings.StopWhenExited)
{
MessageBox.Show(Utils.i18N.Translate("Please press Stop button first"), Utils.i18N.Translate("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
Visible = true;
ShowInTaskbar = true; // 显示在系统任务栏
WindowState = FormWindowState.Normal; // 还原窗体
NotifyIcon.Visible = true; // 托盘图标隐藏
return;
}
// 否则直接调用停止按钮的方法
ControlButton_Click(sender, e);
}
SaveConfigs();
State = Models.State.Terminating;
NotifyIcon.Visible = false;
Close();
Dispose();
Environment.Exit(Environment.ExitCode);
}
private void updateACLWithProxyToolStripMenuItem_Click(object sender, EventArgs e)
{
updateACLWithProxyToolStripMenuItem.Enabled = false;
if (Global.Settings.UseProxyToUpdateSubscription)
{
// 当前 ServerComboBox 中至少有一项
if (ServerComboBox.SelectedIndex == -1)
{
MessageBox.Show(Utils.i18N.Translate("Please select a server first"), Utils.i18N.Translate("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
MenuStrip.Enabled = ConfigurationGroupBox.Enabled = ControlButton.Enabled = SettingsButton.Enabled = false;
ControlButton.Text = "...";
}
Task.Run(() =>
{
var mode = new Models.Mode
{
Remark = "ProxyUpdate",
Type = 5
};
MainController = new MainController();
MainController.Start(ServerComboBox.SelectedItem as Models.Server, mode);
using var client = new Override.WebClient();
client.Proxy = new System.Net.WebProxy($"http://127.0.0.1:{Global.Settings.HTTPLocalPort}");
StatusText($"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Updating in the background")}");
try
{
client.DownloadFile(Global.Settings.ACL, "bin\\default.acl");
NotifyIcon.ShowBalloonTip(5,
UpdateChecker.Name, Utils.i18N.Translate("ACL updated successfully"),
ToolTipIcon.Info);
}
catch (Exception e)
{
Utils.Logging.Info("ACL更新失败" + e.Message);
NotifyIcon.ShowBalloonTip(5,
UpdateChecker.Name,
Utils.i18N.Translate("ACL update failed"),
ToolTipIcon.Error);
}
finally
{
updateACLWithProxyToolStripMenuItem.Enabled = true;
StatusText($"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Waiting for command")}");
MainController.Stop();
}
});
} }
} }
} }

View File

@@ -121,20 +121,18 @@
<value>17, 17</value> <value>17, 17</value>
</metadata> </metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="SpeedPictureBox.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="EditPictureBox.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAk9JREFUOE9N iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAg9JREFUOE+F
k19ojWEcx8+xsRgzbSlaJouGRCNuXIyMXJ1LpVyYFAttqylEsdKQC1yZpF24oJQrN0q5UJKUlP3DWTPz U81uElEYnTdw58qFunBlYnwAE7e+QhMT38CNcefWxKWufADjiqqtmsZIW2gRulBTY4fGGGmLMFOGn5aB
pzmm2Tk753nf9+fzfd/3nJ2nPr3v8z7P7/d7nu/v+ybMbBUsA703wwk/sKcPJz07POzszOg8HXAKBr55 GYa5c+f4nTsINKF6kkPIxz3nO/f7Llas1IXXGyW8Wi9h+T/kmVx+C7WGA8F14S2LxR8HdfjDAMMwFI7O
bLMmWKOgxZCEBfH7zg9/fev55Gw8G9jUXGC/IFMI7HXGt7ZBZ9fGHNtsJVQogYIrQMFVOc8GLn5x4eby YQg/CI14pVDGKIoGYnDZomMgB4gk0VAqgUoWkxjHMd5t7eCkTz2uWIxGd601nHYPR66H+nH7LKXW9LrG
UWB6k8AXU75N5gJ9aoBkMYGqL4JLbHB9bFRA+Xj207Pr0fcbTNtgC1QWE1TC6t/5INvF0UdmwgqlkZ4N JBrHeL+9g1N/gDRNl4wBoxHhKDJxmWierPG3lGeiaGrQ9DpPjMFADJjA7fSko4ff0nWerDntWQJegQbl
rJvvP3JBmul6OArSrloJ6mAz3H383bMHE6FApZFlqitpbcbZhTnfWrzA9rNUDfVKsAFSY1Q5+9mFopWP XRsLEiweZMAEEoFn1opl9GXopa97sFaLlWmCY0nAjo2WdCYn3ednIGvHodPCSIw+2z9hrRQqZoWzBLOu
IU6TGnJ2nrXetCslY6hwnRLo/q1XWVTr/iHwdCECQS2PFpl81IUnBLZ+LNit8bALRyA8gTTY0f816vVl jBvJ1MlYyARK+LGl8LCWYq+vsyvMttA17oduiwOaru4vEhGvdzSuVRUu2THu7KvJDCYJxrHKugr5XdZk
Klwh2UneH5GweJ53076d5pv04SrSQiLWKkEVbFUl9VtItPYRZ6/iVr7549sx5sORuP2wBw5BgxIsgY2w 6kSsgWJXo+pr7J5q3K7GeFoXA75EDuRfYOyCdLZFTDhhipyboDsIv2QGg6H5YREorvSyzgTFH7wEnh8g
DVZAlwLVc21/GwdTWRfvhXp4Cbv1rgRrQRbeDge466xaplO8x5FxMEvWCctBRTpgH4RGWgdyoRZuSyiJ 0frxdAbn4Vs/xYtmNguK10TcCXjF+JmUrlpvNj/lDxqu2cDZFxialb1sKly0FZYl8oZc4yRK+CYeiPie
qcrSIQ5+DgtBCXQCuXAphFaWjfVsnMD752iX2tQ5b6g7sAv0w20CiV50b3gCuTDB1ub7mGjvYCF0XRzc 8IYlH3dz+W3zuub5Vv5x33/V8VwG9aimsCniMEl92dZN0SxRB+D+Hw2grtB8iuYFAAAAAElFTkSuQmCC
B/rrGkGqK7BYVI5MaFILSdzVdI9WHuRvG42Cj4Mc2g4toEJKUAMZSJlZzX8eY2N9ZDKIEQAAAABJRU5E
rkJggg==
</value> </value>
</data> </data>
<data name="DeletePictureBox.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="DeletePictureBox.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
@@ -151,18 +149,20 @@
R+QMmWB7l2jP55IkExaBIP+X+VaqtcbLMAynmftgqMOzv61mlBRRiHFjAAAAAElFTkSuQmCC R+QMmWB7l2jP55IkExaBIP+X+VaqtcbLMAynmftgqMOzv61mlBRRiHFjAAAAAElFTkSuQmCC
</value> </value>
</data> </data>
<data name="EditPictureBox.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="SpeedPictureBox.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAg9JREFUOE+F iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAk9JREFUOE9N
U81uElEYnTdw58qFunBlYnwAE7e+QhMT38CNcefWxKWufADjiqqtmsZIW2gRulBTY4fGGGmLMFOGn5aB k19ojWEcx8+xsRgzbSlaJouGRCNuXIyMXJ1LpVyYFAttqylEsdKQC1yZpF24oJQrN0q5UJKUlP3DWTPz
GYa5c+f4nTsINKF6kkPIxz3nO/f7Llas1IXXGyW8Wi9h+T/kmVx+C7WGA8F14S2LxR8HdfjDAMMwFI7O pzmm2Tk753nf9+fzfd/3nJ2nPr3v8z7P7/d7nu/v+ybMbBUsA703wwk/sKcPJz07POzszOg8HXAKBr55
YQg/CI14pVDGKIoGYnDZomMgB4gk0VAqgUoWkxjHMd5t7eCkTz2uWIxGd601nHYPR66H+nH7LKXW9LrG bLMmWKOgxZCEBfH7zg9/fev55Gw8G9jUXGC/IFMI7HXGt7ZBZ9fGHNtsJVQogYIrQMFVOc8GLn5x4eby
JBrHeL+9g1N/gDRNl4wBoxHhKDJxmWierPG3lGeiaGrQ9DpPjMFADJjA7fSko4ff0nWerDntWQJegQbl UWB6k8AXU75N5gJ9aoBkMYGqL4JLbHB9bFRA+Xj207Pr0fcbTNtgC1QWE1TC6t/5INvF0UdmwgqlkZ4N
XRsLEiweZMAEEoFn1opl9GXopa97sFaLlWmCY0nAjo2WdCYn3ednIGvHodPCSIw+2z9hrRQqZoWzBLOu rJvvP3JBmul6OArSrloJ6mAz3H383bMHE6FApZFlqitpbcbZhTnfWrzA9rNUDfVKsAFSY1Q5+9mFopWP
jBvJ1MlYyARK+LGl8LCWYq+vsyvMttA17oduiwOaru4vEhGvdzSuVRUu2THu7KvJDCYJxrHKugr5XdZk IU6TGnJ2nrXetCslY6hwnRLo/q1XWVTr/iHwdCECQS2PFpl81IUnBLZ+LNit8bALRyA8gTTY0f816vVl
6kSsgWJXo+pr7J5q3K7GeFoXA75EDuRfYOyCdLZFTDhhipyboDsIv2QGg6H5YREorvSyzgTFH7wEnh8g Klwh2UneH5GweJ53076d5pv04SrSQiLWKkEVbFUl9VtItPYRZ6/iVr7549sx5sORuP2wBw5BgxIsgY2w
0frxdAbn4Vs/xYtmNguK10TcCXjF+JmUrlpvNj/lDxqu2cDZFxialb1sKly0FZYl8oZc4yRK+CYeiPie DVZAlwLVc21/GwdTWRfvhXp4Cbv1rgRrQRbeDge466xaplO8x5FxMEvWCctBRTpgH4RGWgdyoRZuSyiJ
8IYlH3dz+W3zuub5Vv5x33/V8VwG9aimsCniMEl92dZN0SxRB+D+Hw2grtB8iuYFAAAAAElFTkSuQmCC qcrSIQ5+DgtBCXQCuXAphFaWjfVsnMD752iX2tQ5b6g7sAv0w20CiV50b3gCuTDB1ub7mGjvYCF0XRzc
B/rrGkGqK7BYVI5MaFILSdzVdI9WHuRvG42Cj4Mc2g4toEJKUAMZSJlZzX8eY2N9ZDKIEQAAAABJRU5E
rkJggg==
</value> </value>
</data> </data>
<metadata name="StatusStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="StatusStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">

View File

@@ -30,12 +30,15 @@
{ {
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SettingForm)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SettingForm));
this.PortGroupBox = new System.Windows.Forms.GroupBox(); this.PortGroupBox = new System.Windows.Forms.GroupBox();
this.RedirectorLabel = new System.Windows.Forms.Label();
this.RedirectorTextBox = new System.Windows.Forms.TextBox();
this.AllowDevicesCheckBox = new System.Windows.Forms.CheckBox(); this.AllowDevicesCheckBox = new System.Windows.Forms.CheckBox();
this.HTTPPortLabel = new System.Windows.Forms.Label(); this.HTTPPortLabel = new System.Windows.Forms.Label();
this.HTTPPortTextBox = new System.Windows.Forms.TextBox(); this.HTTPPortTextBox = new System.Windows.Forms.TextBox();
this.Socks5PortLabel = new System.Windows.Forms.Label(); this.Socks5PortLabel = new System.Windows.Forms.Label();
this.Socks5PortTextBox = new System.Windows.Forms.TextBox(); this.Socks5PortTextBox = new System.Windows.Forms.TextBox();
this.TUNTAPGroupBox = new System.Windows.Forms.GroupBox(); this.TUNTAPGroupBox = new System.Windows.Forms.GroupBox();
this.TUNTAPProxyDNSCheckBox = new System.Windows.Forms.CheckBox();
this.TUNTAPUseCustomDNSCheckBox = new System.Windows.Forms.CheckBox(); this.TUNTAPUseCustomDNSCheckBox = new System.Windows.Forms.CheckBox();
this.TUNTAPDNSLabel = new System.Windows.Forms.Label(); this.TUNTAPDNSLabel = new System.Windows.Forms.Label();
this.TUNTAPDNSTextBox = new System.Windows.Forms.TextBox(); this.TUNTAPDNSTextBox = new System.Windows.Forms.TextBox();
@@ -48,6 +51,13 @@
this.ControlButton = new System.Windows.Forms.Button(); this.ControlButton = new System.Windows.Forms.Button();
this.GlobalBypassIPsButton = new System.Windows.Forms.Button(); this.GlobalBypassIPsButton = new System.Windows.Forms.Button();
this.BehaviorGroupBox = new System.Windows.Forms.GroupBox(); this.BehaviorGroupBox = new System.Windows.Forms.GroupBox();
this.DetectionInterval_Label = new System.Windows.Forms.Label();
this.DetectionInterval_TextBox = new System.Windows.Forms.TextBox();
this.EnableStartedTcping_CheckBox = new System.Windows.Forms.CheckBox();
this.DelayTestAfterStartup_Label = new System.Windows.Forms.Label();
this.BypassModeCheckBox = new System.Windows.Forms.CheckBox();
this.Redirector2checkBox = new System.Windows.Forms.CheckBox();
this.ExperimentalFunction_Label = new System.Windows.Forms.Label();
this.STUN_ServerPortTextBox = new System.Windows.Forms.TextBox(); this.STUN_ServerPortTextBox = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
@@ -60,6 +70,8 @@
this.StartWhenOpenedCheckBox = new System.Windows.Forms.CheckBox(); this.StartWhenOpenedCheckBox = new System.Windows.Forms.CheckBox();
this.StopWhenExitedCheckBox = new System.Windows.Forms.CheckBox(); this.StopWhenExitedCheckBox = new System.Windows.Forms.CheckBox();
this.ExitWhenClosedCheckBox = new System.Windows.Forms.CheckBox(); this.ExitWhenClosedCheckBox = new System.Windows.Forms.CheckBox();
this.AclAddr = new System.Windows.Forms.TextBox();
this.AclLabel = new System.Windows.Forms.Label();
this.PortGroupBox.SuspendLayout(); this.PortGroupBox.SuspendLayout();
this.TUNTAPGroupBox.SuspendLayout(); this.TUNTAPGroupBox.SuspendLayout();
this.BehaviorGroupBox.SuspendLayout(); this.BehaviorGroupBox.SuspendLayout();
@@ -67,6 +79,8 @@
// //
// PortGroupBox // PortGroupBox
// //
this.PortGroupBox.Controls.Add(this.RedirectorLabel);
this.PortGroupBox.Controls.Add(this.RedirectorTextBox);
this.PortGroupBox.Controls.Add(this.AllowDevicesCheckBox); this.PortGroupBox.Controls.Add(this.AllowDevicesCheckBox);
this.PortGroupBox.Controls.Add(this.HTTPPortLabel); this.PortGroupBox.Controls.Add(this.HTTPPortLabel);
this.PortGroupBox.Controls.Add(this.HTTPPortTextBox); this.PortGroupBox.Controls.Add(this.HTTPPortTextBox);
@@ -79,10 +93,27 @@
this.PortGroupBox.TabStop = false; this.PortGroupBox.TabStop = false;
this.PortGroupBox.Text = "Local Port"; this.PortGroupBox.Text = "Local Port";
// //
// RedirectorLabel
//
this.RedirectorLabel.AutoSize = true;
this.RedirectorLabel.Location = new System.Drawing.Point(9, 83);
this.RedirectorLabel.Name = "RedirectorLabel";
this.RedirectorLabel.Size = new System.Drawing.Size(95, 17);
this.RedirectorLabel.TabIndex = 6;
this.RedirectorLabel.Text = "Redirector TCP";
//
// RedirectorTextBox
//
this.RedirectorTextBox.Location = new System.Drawing.Point(120, 80);
this.RedirectorTextBox.Name = "RedirectorTextBox";
this.RedirectorTextBox.Size = new System.Drawing.Size(294, 23);
this.RedirectorTextBox.TabIndex = 7;
this.RedirectorTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// AllowDevicesCheckBox // AllowDevicesCheckBox
// //
this.AllowDevicesCheckBox.AutoSize = true; this.AllowDevicesCheckBox.AutoSize = true;
this.AllowDevicesCheckBox.Location = new System.Drawing.Point(120, 80); this.AllowDevicesCheckBox.Location = new System.Drawing.Point(120, 109);
this.AllowDevicesCheckBox.Name = "AllowDevicesCheckBox"; this.AllowDevicesCheckBox.Name = "AllowDevicesCheckBox";
this.AllowDevicesCheckBox.Size = new System.Drawing.Size(206, 21); this.AllowDevicesCheckBox.Size = new System.Drawing.Size(206, 21);
this.AllowDevicesCheckBox.TabIndex = 5; this.AllowDevicesCheckBox.TabIndex = 5;
@@ -126,6 +157,7 @@
// //
// TUNTAPGroupBox // TUNTAPGroupBox
// //
this.TUNTAPGroupBox.Controls.Add(this.TUNTAPProxyDNSCheckBox);
this.TUNTAPGroupBox.Controls.Add(this.TUNTAPUseCustomDNSCheckBox); this.TUNTAPGroupBox.Controls.Add(this.TUNTAPUseCustomDNSCheckBox);
this.TUNTAPGroupBox.Controls.Add(this.TUNTAPDNSLabel); this.TUNTAPGroupBox.Controls.Add(this.TUNTAPDNSLabel);
this.TUNTAPGroupBox.Controls.Add(this.TUNTAPDNSTextBox); this.TUNTAPGroupBox.Controls.Add(this.TUNTAPDNSTextBox);
@@ -137,11 +169,21 @@
this.TUNTAPGroupBox.Controls.Add(this.TUNTAPAddressTextBox); this.TUNTAPGroupBox.Controls.Add(this.TUNTAPAddressTextBox);
this.TUNTAPGroupBox.Location = new System.Drawing.Point(12, 158); this.TUNTAPGroupBox.Location = new System.Drawing.Point(12, 158);
this.TUNTAPGroupBox.Name = "TUNTAPGroupBox"; 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.TabIndex = 3;
this.TUNTAPGroupBox.TabStop = false; this.TUNTAPGroupBox.TabStop = false;
this.TUNTAPGroupBox.Text = "TUN/TAP"; 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 // TUNTAPUseCustomDNSCheckBox
// //
this.TUNTAPUseCustomDNSCheckBox.AutoSize = true; this.TUNTAPUseCustomDNSCheckBox.AutoSize = true;
@@ -224,7 +266,7 @@
// ControlButton // ControlButton
// //
this.ControlButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 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(781, 356);
this.ControlButton.Name = "ControlButton"; this.ControlButton.Name = "ControlButton";
this.ControlButton.Size = new System.Drawing.Size(75, 23); this.ControlButton.Size = new System.Drawing.Size(75, 23);
this.ControlButton.TabIndex = 11; this.ControlButton.TabIndex = 11;
@@ -235,7 +277,7 @@
// GlobalBypassIPsButton // GlobalBypassIPsButton
// //
this.GlobalBypassIPsButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); 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, 356);
this.GlobalBypassIPsButton.Name = "GlobalBypassIPsButton"; this.GlobalBypassIPsButton.Name = "GlobalBypassIPsButton";
this.GlobalBypassIPsButton.Size = new System.Drawing.Size(128, 23); this.GlobalBypassIPsButton.Size = new System.Drawing.Size(128, 23);
this.GlobalBypassIPsButton.TabIndex = 10; this.GlobalBypassIPsButton.TabIndex = 10;
@@ -245,6 +287,15 @@
// //
// BehaviorGroupBox // BehaviorGroupBox
// //
this.BehaviorGroupBox.Controls.Add(this.AclAddr);
this.BehaviorGroupBox.Controls.Add(this.AclLabel);
this.BehaviorGroupBox.Controls.Add(this.DetectionInterval_Label);
this.BehaviorGroupBox.Controls.Add(this.DetectionInterval_TextBox);
this.BehaviorGroupBox.Controls.Add(this.EnableStartedTcping_CheckBox);
this.BehaviorGroupBox.Controls.Add(this.DelayTestAfterStartup_Label);
this.BehaviorGroupBox.Controls.Add(this.BypassModeCheckBox);
this.BehaviorGroupBox.Controls.Add(this.Redirector2checkBox);
this.BehaviorGroupBox.Controls.Add(this.ExperimentalFunction_Label);
this.BehaviorGroupBox.Controls.Add(this.STUN_ServerPortTextBox); this.BehaviorGroupBox.Controls.Add(this.STUN_ServerPortTextBox);
this.BehaviorGroupBox.Controls.Add(this.label2); this.BehaviorGroupBox.Controls.Add(this.label2);
this.BehaviorGroupBox.Controls.Add(this.label1); this.BehaviorGroupBox.Controls.Add(this.label1);
@@ -257,16 +308,82 @@
this.BehaviorGroupBox.Controls.Add(this.StartWhenOpenedCheckBox); this.BehaviorGroupBox.Controls.Add(this.StartWhenOpenedCheckBox);
this.BehaviorGroupBox.Controls.Add(this.StopWhenExitedCheckBox); this.BehaviorGroupBox.Controls.Add(this.StopWhenExitedCheckBox);
this.BehaviorGroupBox.Controls.Add(this.ExitWhenClosedCheckBox); this.BehaviorGroupBox.Controls.Add(this.ExitWhenClosedCheckBox);
this.BehaviorGroupBox.Location = new System.Drawing.Point(12, 330); this.BehaviorGroupBox.Location = new System.Drawing.Point(438, 12);
this.BehaviorGroupBox.Name = "BehaviorGroupBox"; this.BehaviorGroupBox.Name = "BehaviorGroupBox";
this.BehaviorGroupBox.Size = new System.Drawing.Size(420, 312); this.BehaviorGroupBox.Size = new System.Drawing.Size(420, 333);
this.BehaviorGroupBox.TabIndex = 8; this.BehaviorGroupBox.TabIndex = 8;
this.BehaviorGroupBox.TabStop = false; this.BehaviorGroupBox.TabStop = false;
this.BehaviorGroupBox.Text = "Behavior"; this.BehaviorGroupBox.Text = "Behavior";
// //
// DetectionInterval_Label
//
this.DetectionInterval_Label.AutoSize = true;
this.DetectionInterval_Label.Location = new System.Drawing.Point(230, 151);
this.DetectionInterval_Label.Name = "DetectionInterval_Label";
this.DetectionInterval_Label.Size = new System.Drawing.Size(128, 17);
this.DetectionInterval_Label.TabIndex = 18;
this.DetectionInterval_Label.Text = "Detection interval(/s)";
//
// DetectionInterval_TextBox
//
this.DetectionInterval_TextBox.Location = new System.Drawing.Point(364, 148);
this.DetectionInterval_TextBox.Name = "DetectionInterval_TextBox";
this.DetectionInterval_TextBox.Size = new System.Drawing.Size(47, 23);
this.DetectionInterval_TextBox.TabIndex = 17;
this.DetectionInterval_TextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// EnableStartedTcping_CheckBox
//
this.EnableStartedTcping_CheckBox.AutoSize = true;
this.EnableStartedTcping_CheckBox.Location = new System.Drawing.Point(152, 150);
this.EnableStartedTcping_CheckBox.Name = "EnableStartedTcping_CheckBox";
this.EnableStartedTcping_CheckBox.Size = new System.Drawing.Size(66, 21);
this.EnableStartedTcping_CheckBox.TabIndex = 15;
this.EnableStartedTcping_CheckBox.Text = "Enable";
this.EnableStartedTcping_CheckBox.UseVisualStyleBackColor = true;
//
// DelayTestAfterStartup_Label
//
this.DelayTestAfterStartup_Label.AutoSize = true;
this.DelayTestAfterStartup_Label.Location = new System.Drawing.Point(6, 151);
this.DelayTestAfterStartup_Label.Name = "DelayTestAfterStartup_Label";
this.DelayTestAfterStartup_Label.Size = new System.Drawing.Size(141, 17);
this.DelayTestAfterStartup_Label.TabIndex = 16;
this.DelayTestAfterStartup_Label.Text = "Delay test after startup";
//
// BypassModeCheckBox
//
this.BypassModeCheckBox.AutoSize = true;
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;
this.BypassModeCheckBox.Text = "进程代理白名单模式";
this.BypassModeCheckBox.UseVisualStyleBackColor = true;
this.BypassModeCheckBox.CheckedChanged += new System.EventHandler(this.BypassModeCheckBox_CheckedChanged);
//
// Redirector2checkBox
//
this.Redirector2checkBox.AutoSize = true;
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;
this.Redirector2checkBox.Text = "是否启用2号核心";
this.Redirector2checkBox.UseVisualStyleBackColor = true;
//
// ExperimentalFunction_Label
//
this.ExperimentalFunction_Label.AutoSize = true;
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;
this.ExperimentalFunction_Label.Text = "Experimental function";
//
// STUN_ServerPortTextBox // STUN_ServerPortTextBox
// //
this.STUN_ServerPortTextBox.Location = new System.Drawing.Point(120, 237); this.STUN_ServerPortTextBox.Location = new System.Drawing.Point(117, 206);
this.STUN_ServerPortTextBox.Name = "STUN_ServerPortTextBox"; this.STUN_ServerPortTextBox.Name = "STUN_ServerPortTextBox";
this.STUN_ServerPortTextBox.Size = new System.Drawing.Size(294, 23); this.STUN_ServerPortTextBox.Size = new System.Drawing.Size(294, 23);
this.STUN_ServerPortTextBox.TabIndex = 8; this.STUN_ServerPortTextBox.TabIndex = 8;
@@ -275,7 +392,7 @@
// label2 // label2
// //
this.label2.AutoSize = true; this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(9, 243); this.label2.Location = new System.Drawing.Point(6, 209);
this.label2.Name = "label2"; this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(110, 17); this.label2.Size = new System.Drawing.Size(110, 17);
this.label2.TabIndex = 12; this.label2.TabIndex = 12;
@@ -284,7 +401,7 @@
// label1 // label1
// //
this.label1.AutoSize = true; this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(9, 214); this.label1.Location = new System.Drawing.Point(6, 180);
this.label1.Name = "label1"; this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(82, 17); this.label1.Size = new System.Drawing.Size(82, 17);
this.label1.TabIndex = 10; this.label1.TabIndex = 10;
@@ -293,7 +410,7 @@
// RunAtStartup // RunAtStartup
// //
this.RunAtStartup.AutoSize = true; this.RunAtStartup.AutoSize = true;
this.RunAtStartup.Location = new System.Drawing.Point(120, 130); this.RunAtStartup.Location = new System.Drawing.Point(12, 75);
this.RunAtStartup.Name = "RunAtStartup"; this.RunAtStartup.Name = "RunAtStartup";
this.RunAtStartup.Size = new System.Drawing.Size(109, 21); this.RunAtStartup.Size = new System.Drawing.Size(109, 21);
this.RunAtStartup.TabIndex = 11; this.RunAtStartup.TabIndex = 11;
@@ -302,7 +419,7 @@
// //
// STUN_ServerTextBox // STUN_ServerTextBox
// //
this.STUN_ServerTextBox.Location = new System.Drawing.Point(120, 211); this.STUN_ServerTextBox.Location = new System.Drawing.Point(117, 177);
this.STUN_ServerTextBox.Name = "STUN_ServerTextBox"; this.STUN_ServerTextBox.Name = "STUN_ServerTextBox";
this.STUN_ServerTextBox.Size = new System.Drawing.Size(294, 23); this.STUN_ServerTextBox.Size = new System.Drawing.Size(294, 23);
this.STUN_ServerTextBox.TabIndex = 11; this.STUN_ServerTextBox.TabIndex = 11;
@@ -311,7 +428,7 @@
// MinimizeWhenStartedCheckBox // MinimizeWhenStartedCheckBox
// //
this.MinimizeWhenStartedCheckBox.AutoSize = true; this.MinimizeWhenStartedCheckBox.AutoSize = true;
this.MinimizeWhenStartedCheckBox.Location = new System.Drawing.Point(120, 103); this.MinimizeWhenStartedCheckBox.Location = new System.Drawing.Point(206, 48);
this.MinimizeWhenStartedCheckBox.Name = "MinimizeWhenStartedCheckBox"; this.MinimizeWhenStartedCheckBox.Name = "MinimizeWhenStartedCheckBox";
this.MinimizeWhenStartedCheckBox.Size = new System.Drawing.Size(158, 21); this.MinimizeWhenStartedCheckBox.Size = new System.Drawing.Size(158, 21);
this.MinimizeWhenStartedCheckBox.TabIndex = 10; this.MinimizeWhenStartedCheckBox.TabIndex = 10;
@@ -321,7 +438,7 @@
// ProfileCount_Label // ProfileCount_Label
// //
this.ProfileCount_Label.AutoSize = true; this.ProfileCount_Label.AutoSize = true;
this.ProfileCount_Label.Location = new System.Drawing.Point(9, 185); this.ProfileCount_Label.Location = new System.Drawing.Point(6, 123);
this.ProfileCount_Label.Name = "ProfileCount_Label"; this.ProfileCount_Label.Name = "ProfileCount_Label";
this.ProfileCount_Label.Size = new System.Drawing.Size(79, 17); this.ProfileCount_Label.Size = new System.Drawing.Size(79, 17);
this.ProfileCount_Label.TabIndex = 8; this.ProfileCount_Label.TabIndex = 8;
@@ -329,16 +446,16 @@
// //
// ProfileCount_TextBox // ProfileCount_TextBox
// //
this.ProfileCount_TextBox.Location = new System.Drawing.Point(222, 182); this.ProfileCount_TextBox.Location = new System.Drawing.Point(203, 120);
this.ProfileCount_TextBox.Name = "ProfileCount_TextBox"; this.ProfileCount_TextBox.Name = "ProfileCount_TextBox";
this.ProfileCount_TextBox.Size = new System.Drawing.Size(192, 23); this.ProfileCount_TextBox.Size = new System.Drawing.Size(208, 23);
this.ProfileCount_TextBox.TabIndex = 9; this.ProfileCount_TextBox.TabIndex = 9;
this.ProfileCount_TextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; this.ProfileCount_TextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
// //
// CheckUpdateWhenOpenedCheckBox // CheckUpdateWhenOpenedCheckBox
// //
this.CheckUpdateWhenOpenedCheckBox.AutoSize = true; this.CheckUpdateWhenOpenedCheckBox.AutoSize = true;
this.CheckUpdateWhenOpenedCheckBox.Location = new System.Drawing.Point(120, 157); this.CheckUpdateWhenOpenedCheckBox.Location = new System.Drawing.Point(206, 75);
this.CheckUpdateWhenOpenedCheckBox.Name = "CheckUpdateWhenOpenedCheckBox"; this.CheckUpdateWhenOpenedCheckBox.Name = "CheckUpdateWhenOpenedCheckBox";
this.CheckUpdateWhenOpenedCheckBox.Size = new System.Drawing.Size(190, 21); this.CheckUpdateWhenOpenedCheckBox.Size = new System.Drawing.Size(190, 21);
this.CheckUpdateWhenOpenedCheckBox.TabIndex = 8; this.CheckUpdateWhenOpenedCheckBox.TabIndex = 8;
@@ -349,7 +466,7 @@
// StartWhenOpenedCheckBox // StartWhenOpenedCheckBox
// //
this.StartWhenOpenedCheckBox.AutoSize = true; this.StartWhenOpenedCheckBox.AutoSize = true;
this.StartWhenOpenedCheckBox.Location = new System.Drawing.Point(120, 76); this.StartWhenOpenedCheckBox.Location = new System.Drawing.Point(12, 48);
this.StartWhenOpenedCheckBox.Name = "StartWhenOpenedCheckBox"; this.StartWhenOpenedCheckBox.Name = "StartWhenOpenedCheckBox";
this.StartWhenOpenedCheckBox.Size = new System.Drawing.Size(137, 21); this.StartWhenOpenedCheckBox.Size = new System.Drawing.Size(137, 21);
this.StartWhenOpenedCheckBox.TabIndex = 7; this.StartWhenOpenedCheckBox.TabIndex = 7;
@@ -360,7 +477,7 @@
// StopWhenExitedCheckBox // StopWhenExitedCheckBox
// //
this.StopWhenExitedCheckBox.AutoSize = true; this.StopWhenExitedCheckBox.AutoSize = true;
this.StopWhenExitedCheckBox.Location = new System.Drawing.Point(120, 49); this.StopWhenExitedCheckBox.Location = new System.Drawing.Point(206, 22);
this.StopWhenExitedCheckBox.Name = "StopWhenExitedCheckBox"; this.StopWhenExitedCheckBox.Name = "StopWhenExitedCheckBox";
this.StopWhenExitedCheckBox.Size = new System.Drawing.Size(127, 21); this.StopWhenExitedCheckBox.Size = new System.Drawing.Size(127, 21);
this.StopWhenExitedCheckBox.TabIndex = 6; this.StopWhenExitedCheckBox.TabIndex = 6;
@@ -371,7 +488,7 @@
// ExitWhenClosedCheckBox // ExitWhenClosedCheckBox
// //
this.ExitWhenClosedCheckBox.AutoSize = true; this.ExitWhenClosedCheckBox.AutoSize = true;
this.ExitWhenClosedCheckBox.Location = new System.Drawing.Point(120, 22); this.ExitWhenClosedCheckBox.Location = new System.Drawing.Point(12, 21);
this.ExitWhenClosedCheckBox.Name = "ExitWhenClosedCheckBox"; this.ExitWhenClosedCheckBox.Name = "ExitWhenClosedCheckBox";
this.ExitWhenClosedCheckBox.Size = new System.Drawing.Size(123, 21); this.ExitWhenClosedCheckBox.Size = new System.Drawing.Size(123, 21);
this.ExitWhenClosedCheckBox.TabIndex = 5; this.ExitWhenClosedCheckBox.TabIndex = 5;
@@ -379,11 +496,28 @@
this.ExitWhenClosedCheckBox.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.ExitWhenClosedCheckBox.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.ExitWhenClosedCheckBox.UseVisualStyleBackColor = true; this.ExitWhenClosedCheckBox.UseVisualStyleBackColor = true;
// //
// AclAddr
//
this.AclAddr.Location = new System.Drawing.Point(117, 235);
this.AclAddr.Name = "AclAddr";
this.AclAddr.Size = new System.Drawing.Size(294, 23);
this.AclAddr.TabIndex = 19;
this.AclAddr.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// AclLabel
//
this.AclLabel.AutoSize = true;
this.AclLabel.Location = new System.Drawing.Point(6, 238);
this.AclLabel.Name = "AclLabel";
this.AclLabel.Size = new System.Drawing.Size(78, 17);
this.AclLabel.TabIndex = 20;
this.AclLabel.Text = "Custom ACL";
//
// SettingForm // SettingForm
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(444, 682); this.ClientSize = new System.Drawing.Size(868, 390);
this.Controls.Add(this.BehaviorGroupBox); this.Controls.Add(this.BehaviorGroupBox);
this.Controls.Add(this.PortGroupBox); this.Controls.Add(this.PortGroupBox);
this.Controls.Add(this.GlobalBypassIPsButton); this.Controls.Add(this.GlobalBypassIPsButton);
@@ -442,5 +576,17 @@
private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox STUN_ServerTextBox; private System.Windows.Forms.TextBox STUN_ServerTextBox;
private System.Windows.Forms.TextBox STUN_ServerPortTextBox; private System.Windows.Forms.TextBox STUN_ServerPortTextBox;
private System.Windows.Forms.CheckBox TUNTAPProxyDNSCheckBox;
private System.Windows.Forms.CheckBox Redirector2checkBox;
private System.Windows.Forms.Label ExperimentalFunction_Label;
private System.Windows.Forms.CheckBox BypassModeCheckBox;
private System.Windows.Forms.TextBox DetectionInterval_TextBox;
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;
} }
} }

View File

@@ -1,5 +1,4 @@
using System; using System;
using System.Collections;
using System.Net; using System.Net;
using System.Windows.Forms; using System.Windows.Forms;
using TaskScheduler; using TaskScheduler;
@@ -52,6 +51,7 @@ namespace Netch.Forms
TUNTAPNetmaskLabel.Text = Utils.i18N.Translate(TUNTAPNetmaskLabel.Text); TUNTAPNetmaskLabel.Text = Utils.i18N.Translate(TUNTAPNetmaskLabel.Text);
TUNTAPGatewayLabel.Text = Utils.i18N.Translate(TUNTAPGatewayLabel.Text); TUNTAPGatewayLabel.Text = Utils.i18N.Translate(TUNTAPGatewayLabel.Text);
TUNTAPUseCustomDNSCheckBox.Text = Utils.i18N.Translate(TUNTAPUseCustomDNSCheckBox.Text); TUNTAPUseCustomDNSCheckBox.Text = Utils.i18N.Translate(TUNTAPUseCustomDNSCheckBox.Text);
TUNTAPProxyDNSCheckBox.Text = Utils.i18N.Translate(TUNTAPProxyDNSCheckBox.Text);
GlobalBypassIPsButton.Text = Utils.i18N.Translate(GlobalBypassIPsButton.Text); GlobalBypassIPsButton.Text = Utils.i18N.Translate(GlobalBypassIPsButton.Text);
ControlButton.Text = Utils.i18N.Translate(ControlButton.Text); ControlButton.Text = Utils.i18N.Translate(ControlButton.Text);
@@ -61,15 +61,21 @@ namespace Netch.Forms
CheckUpdateWhenOpenedCheckBox.Checked = Global.Settings.CheckUpdateWhenOpened; CheckUpdateWhenOpenedCheckBox.Checked = Global.Settings.CheckUpdateWhenOpened;
MinimizeWhenStartedCheckBox.Checked = Global.Settings.MinimizeWhenStarted; MinimizeWhenStartedCheckBox.Checked = Global.Settings.MinimizeWhenStarted;
RunAtStartup.Checked = Global.Settings.RunAtStartup; RunAtStartup.Checked = Global.Settings.RunAtStartup;
Redirector2checkBox.Checked = Global.Settings.UseRedirector2;
BypassModeCheckBox.Checked = Global.Settings.ProcessBypassMode;
EnableStartedTcping_CheckBox.Checked = Global.Settings.StartedTcping;
DetectionInterval_TextBox.Text = Global.Settings.StartedTcping_Interval.ToString();
Socks5PortTextBox.Text = Global.Settings.Socks5LocalPort.ToString(); Socks5PortTextBox.Text = Global.Settings.Socks5LocalPort.ToString();
HTTPPortTextBox.Text = Global.Settings.HTTPLocalPort.ToString(); HTTPPortTextBox.Text = Global.Settings.HTTPLocalPort.ToString();
RedirectorTextBox.Text = Global.Settings.RedirectorTCPPort.ToString();
TUNTAPAddressTextBox.Text = Global.Settings.TUNTAP.Address; TUNTAPAddressTextBox.Text = Global.Settings.TUNTAP.Address;
TUNTAPNetmaskTextBox.Text = Global.Settings.TUNTAP.Netmask; TUNTAPNetmaskTextBox.Text = Global.Settings.TUNTAP.Netmask;
TUNTAPGatewayTextBox.Text = Global.Settings.TUNTAP.Gateway; TUNTAPGatewayTextBox.Text = Global.Settings.TUNTAP.Gateway;
TUNTAPUseCustomDNSCheckBox.Checked = Global.Settings.TUNTAP.UseCustomDNS; TUNTAPUseCustomDNSCheckBox.Checked = Global.Settings.TUNTAP.UseCustomDNS;
TUNTAPProxyDNSCheckBox.Checked = Global.Settings.TUNTAP.ProxyDNS;
BehaviorGroupBox.Text = Utils.i18N.Translate(BehaviorGroupBox.Text); BehaviorGroupBox.Text = Utils.i18N.Translate(BehaviorGroupBox.Text);
ExitWhenClosedCheckBox.Text = Utils.i18N.Translate(ExitWhenClosedCheckBox.Text); ExitWhenClosedCheckBox.Text = Utils.i18N.Translate(ExitWhenClosedCheckBox.Text);
@@ -79,11 +85,19 @@ namespace Netch.Forms
RunAtStartup.Text = Utils.i18N.Translate(RunAtStartup.Text); RunAtStartup.Text = Utils.i18N.Translate(RunAtStartup.Text);
CheckUpdateWhenOpenedCheckBox.Text = Utils.i18N.Translate(CheckUpdateWhenOpenedCheckBox.Text); CheckUpdateWhenOpenedCheckBox.Text = Utils.i18N.Translate(CheckUpdateWhenOpenedCheckBox.Text);
ProfileCount_Label.Text = Utils.i18N.Translate(ProfileCount_Label.Text); ProfileCount_Label.Text = Utils.i18N.Translate(ProfileCount_Label.Text);
ExperimentalFunction_Label.Text = Utils.i18N.Translate(ExperimentalFunction_Label.Text);
DelayTestAfterStartup_Label.Text = Utils.i18N.Translate(DelayTestAfterStartup_Label.Text);
EnableStartedTcping_CheckBox.Text = Utils.i18N.Translate(EnableStartedTcping_CheckBox.Text);
DetectionInterval_Label.Text = Utils.i18N.Translate(DetectionInterval_Label.Text);
DelayTestAfterStartup_Label.Text = Utils.i18N.Translate(DelayTestAfterStartup_Label.Text);
ProfileCount_TextBox.Text = Global.Settings.ProfileCount.ToString(); ProfileCount_TextBox.Text = Global.Settings.ProfileCount.ToString();
STUN_ServerTextBox.Text = Global.Settings.STUN_Server.ToString(); STUN_ServerTextBox.Text = Global.Settings.STUN_Server.ToString();
STUN_ServerPortTextBox.Text = Global.Settings.STUN_Server_Port.ToString(); STUN_ServerPortTextBox.Text = Global.Settings.STUN_Server_Port.ToString();
AclLabel.Text = Utils.i18N.Translate(AclLabel.Text);
AclAddr.Text = Global.Settings.ACL.ToString();
if (Global.Settings.TUNTAP.DNS.Count > 0) if (Global.Settings.TUNTAP.DNS.Count > 0)
{ {
var dns = ""; var dns = "";
@@ -142,6 +156,9 @@ namespace Netch.Forms
Global.Settings.CheckUpdateWhenOpened = CheckUpdateWhenOpenedCheckBox.Checked; Global.Settings.CheckUpdateWhenOpened = CheckUpdateWhenOpenedCheckBox.Checked;
Global.Settings.MinimizeWhenStarted = MinimizeWhenStartedCheckBox.Checked; Global.Settings.MinimizeWhenStarted = MinimizeWhenStartedCheckBox.Checked;
Global.Settings.RunAtStartup = RunAtStartup.Checked; Global.Settings.RunAtStartup = RunAtStartup.Checked;
Global.Settings.UseRedirector2 = Redirector2checkBox.Checked;
Global.Settings.ProcessBypassMode = BypassModeCheckBox.Checked;
Global.Settings.StartedTcping = EnableStartedTcping_CheckBox.Checked;
// 开机自启判断 // 开机自启判断
TaskSchedulerClass scheduler = new TaskSchedulerClass(); TaskSchedulerClass scheduler = new TaskSchedulerClass();
@@ -224,6 +241,27 @@ namespace Netch.Forms
return; return;
} }
try
{
var RedirectorPort = int.Parse(RedirectorTextBox.Text);
if (RedirectorPort > 0 && RedirectorPort < 65536)
{
Global.Settings.RedirectorTCPPort = RedirectorPort;
}
else
{
throw new FormatException();
}
}
catch (FormatException)
{
RedirectorTextBox.Text = Global.Settings.RedirectorTCPPort.ToString();
MessageBox.Show(Utils.i18N.Translate("Port value illegal. Try again."), Utils.i18N.Translate("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
if (AllowDevicesCheckBox.Checked) if (AllowDevicesCheckBox.Checked)
{ {
Global.Settings.LocalAddress = "0.0.0.0"; Global.Settings.LocalAddress = "0.0.0.0";
@@ -269,7 +307,7 @@ namespace Netch.Forms
{ {
var ProfileCount = int.Parse(ProfileCount_TextBox.Text); var ProfileCount = int.Parse(ProfileCount_TextBox.Text);
if (ProfileCount > 0) if (ProfileCount > -1)
{ {
Global.Settings.ProfileCount = ProfileCount; Global.Settings.ProfileCount = ProfileCount;
} }
@@ -308,6 +346,30 @@ namespace Netch.Forms
return; return;
} }
try
{
Global.Settings.StartedTcping = EnableStartedTcping_CheckBox.Checked;
var DetectionInterval = int.Parse(DetectionInterval_TextBox.Text);
if (DetectionInterval > 0)
{
Global.Settings.StartedTcping_Interval = DetectionInterval;
}
else
{
throw new FormatException();
}
}
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);
return;
}
Global.Settings.ACL = AclAddr.Text;
Global.Settings.TUNTAP.Address = TUNTAPAddressTextBox.Text; Global.Settings.TUNTAP.Address = TUNTAPAddressTextBox.Text;
Global.Settings.TUNTAP.Netmask = TUNTAPNetmaskTextBox.Text; Global.Settings.TUNTAP.Netmask = TUNTAPNetmaskTextBox.Text;
@@ -320,10 +382,25 @@ namespace Netch.Forms
} }
Global.Settings.TUNTAP.UseCustomDNS = TUNTAPUseCustomDNSCheckBox.Checked; Global.Settings.TUNTAP.UseCustomDNS = TUNTAPUseCustomDNSCheckBox.Checked;
Global.Settings.TUNTAP.ProxyDNS = TUNTAPProxyDNSCheckBox.Checked;
Utils.Configuration.Save(); Utils.Configuration.Save();
MessageBox.Show(Utils.i18N.Translate("Saved"), Utils.i18N.Translate("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); MessageBox.Show(Utils.i18N.Translate("Saved"), Utils.i18N.Translate("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
Close(); Close();
} }
private void BypassModeCheckBox_CheckedChanged(object sender, EventArgs e)
{
if (BypassModeCheckBox.Checked)
{
Redirector2checkBox.Checked = false;
Redirector2checkBox.Enabled = false;
}
else
{
Redirector2checkBox.Enabled = true;
}
}
} }
} }

View File

@@ -88,7 +88,7 @@
this.UserAgentLabel.AutoSize = true; this.UserAgentLabel.AutoSize = true;
this.UserAgentLabel.Location = new System.Drawing.Point(11, 77); this.UserAgentLabel.Location = new System.Drawing.Point(11, 77);
this.UserAgentLabel.Name = "UserAgentLabel"; this.UserAgentLabel.Name = "UserAgentLabel";
this.UserAgentLabel.Size = new System.Drawing.Size(73, 17); this.UserAgentLabel.Size = new System.Drawing.Size(74, 17);
this.UserAgentLabel.TabIndex = 5; this.UserAgentLabel.TabIndex = 5;
this.UserAgentLabel.Text = "User-Agent"; this.UserAgentLabel.Text = "User-Agent";
// //
@@ -150,6 +150,7 @@
this.SubscribeLinkListView.TabIndex = 0; this.SubscribeLinkListView.TabIndex = 0;
this.SubscribeLinkListView.UseCompatibleStateImageBehavior = false; this.SubscribeLinkListView.UseCompatibleStateImageBehavior = false;
this.SubscribeLinkListView.View = System.Windows.Forms.View.Details; this.SubscribeLinkListView.View = System.Windows.Forms.View.Details;
this.SubscribeLinkListView.SelectedIndexChanged += new System.EventHandler(this.SubscribeLinkListView_SelectedIndexChanged);
// //
// RemarkColumnHeader // RemarkColumnHeader
// //
@@ -169,23 +170,22 @@
// pContextMenuStrip // pContextMenuStrip
// //
this.pContextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.pContextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.DeleteToolStripMenuItem}); this.DeleteToolStripMenuItem,
this.pContextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.CopyLinkToolStripMenuItem}); this.CopyLinkToolStripMenuItem});
this.pContextMenuStrip.Name = "pContextMenuStrip"; this.pContextMenuStrip.Name = "pContextMenuStrip";
this.pContextMenuStrip.Size = new System.Drawing.Size(114, 26); this.pContextMenuStrip.Size = new System.Drawing.Size(130, 48);
// //
// DeleteToolStripMenuItem // DeleteToolStripMenuItem
// //
this.DeleteToolStripMenuItem.Name = "DeleteToolStripMenuItem"; this.DeleteToolStripMenuItem.Name = "DeleteToolStripMenuItem";
this.DeleteToolStripMenuItem.Size = new System.Drawing.Size(113, 22); this.DeleteToolStripMenuItem.Size = new System.Drawing.Size(129, 22);
this.DeleteToolStripMenuItem.Text = "Delete"; this.DeleteToolStripMenuItem.Text = "Delete";
this.DeleteToolStripMenuItem.Click += new System.EventHandler(this.DeleteToolStripMenuItem_Click); this.DeleteToolStripMenuItem.Click += new System.EventHandler(this.DeleteToolStripMenuItem_Click);
// //
// CopyLinkToolStripMenuItem // CopyLinkToolStripMenuItem
// //
this.CopyLinkToolStripMenuItem.Name = "CopyLinkToolStripMenuItem"; this.CopyLinkToolStripMenuItem.Name = "CopyLinkToolStripMenuItem";
this.CopyLinkToolStripMenuItem.Size = new System.Drawing.Size(113, 22); this.CopyLinkToolStripMenuItem.Size = new System.Drawing.Size(129, 22);
this.CopyLinkToolStripMenuItem.Text = "CopyLink"; this.CopyLinkToolStripMenuItem.Text = "CopyLink";
this.CopyLinkToolStripMenuItem.Click += new System.EventHandler(this.CopyLinkToolStripMenuItem_Click); this.CopyLinkToolStripMenuItem.Click += new System.EventHandler(this.CopyLinkToolStripMenuItem_Click);
// //

View File

@@ -1,5 +1,4 @@
using Netch.Models; using System;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Windows.Forms; using System.Windows.Forms;
@@ -144,5 +143,15 @@ namespace Netch.Forms
MessageBox.Show(Utils.i18N.Translate("Successfully saved"), Utils.i18N.Translate("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); MessageBox.Show(Utils.i18N.Translate("Successfully saved"), Utils.i18N.Translate("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
Close(); Close();
} }
/// <summary>
/// 订阅列表选中节点
/// TODO 选中节点编辑
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void SubscribeLinkListView_SelectedIndexChanged(object sender, EventArgs e)
{
//MessageBox.Show(SubscribeLinkListView.SelectedItems + "", Utils.i18N.Translate("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
}
} }
} }

View File

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

View File

@@ -1,7 +1,7 @@
namespace Netch.Models namespace Netch.Models
{ {
public class Profile public class Profile
{ {
public string ServerRemark; public string ServerRemark;
public string ModeRemark; public string ModeRemark;
public string ProfileName; public string ProfileName;
@@ -24,5 +24,5 @@
} }
} }
} }

View File

@@ -31,6 +31,11 @@ namespace Netch.Models
/// 使用自定义 DNS 设置 /// 使用自定义 DNS 设置
/// </summary> /// </summary>
public bool UseCustomDNS = false; public bool UseCustomDNS = false;
/// <summary>
/// 模式2下是否代理DNS
/// </summary>
public bool ProxyDNS = false;
} }
/// <summary> /// <summary>
@@ -97,7 +102,7 @@ namespace Netch.Models
/// <summary> /// <summary>
/// Redirector TCP 占用端口 /// Redirector TCP 占用端口
/// </summary> /// </summary>
//public int RedirectorTCPPort = 2800; public int RedirectorTCPPort = 3901;
/// <summary> /// <summary>
/// HTTP 和 Socks5 本地代理地址 /// HTTP 和 Socks5 本地代理地址
@@ -127,7 +132,7 @@ namespace Netch.Models
/// <summary> /// <summary>
/// 全局绕过 IP 列表 /// 全局绕过 IP 列表
/// </summary> /// </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> /// <summary>
/// 已保存的快捷配置 /// 已保存的快捷配置
@@ -148,5 +153,31 @@ namespace Netch.Models
/// STUN测试服务器 /// STUN测试服务器
/// </summary> /// </summary>
public int STUN_Server_Port = 3478; public int STUN_Server_Port = 3478;
/// <summary>
/// 是否切换为2号核心
/// </summary>
public bool UseRedirector2 = false;
/// <summary>
/// 是否启用进程代理白名单模式
/// </summary>
public bool ProcessBypassMode = false;
/// <summary>
/// 是否启用启动后延迟测试
/// </summary>
public bool StartedTcping = false;
/// <summary>
/// 启动后延迟测试间隔/秒
/// </summary>
public int StartedTcping_Interval = 3;
/// <summary>
/// ACL规则
/// </summary>
public string ACL = "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/banAD.acl";
} }
} }

View File

@@ -1,101 +1,114 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop"> <Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup> <PropertyGroup>
<OutputType>WinExe</OutputType> <OutputType>WinExe</OutputType>
<TargetFramework>net48</TargetFramework> <TargetFramework>net48</TargetFramework>
<UseWindowsForms>true</UseWindowsForms> <UseWindowsForms>true</UseWindowsForms>
<UseWPF>true</UseWPF> <UseWPF>true</UseWPF>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo> <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<StartupObject>Netch.Netch</StartupObject> <StartupObject>Netch.Netch</StartupObject>
<ApplicationManifest>App.manifest</ApplicationManifest> <ApplicationManifest>App.manifest</ApplicationManifest>
<ApplicationIcon>Netch.ico</ApplicationIcon> <ApplicationIcon>Netch.ico</ApplicationIcon>
<Platforms>x86;x64</Platforms> <Platforms>x86;x64</Platforms>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath> <AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<LangVersion>latest</LangVersion> <LangVersion>latest</LangVersion>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutputPath>bin\x64\Debug\</OutputPath> <OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants> <DefineConstants>DEBUG;TRACE</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors> <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<WarningsAsErrors /> <WarningsAsErrors />
<NoWarn /> <NoWarn />
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x86'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x86'">
<DefineConstants>DEBUG;TRACE</DefineConstants> <DefineConstants>DEBUG;TRACE</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<NoWarn /> <NoWarn />
<TreatWarningsAsErrors>false</TreatWarningsAsErrors> <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<WarningsAsErrors /> <WarningsAsErrors />
<OutputPath>bin\x86\Debug\</OutputPath> <OutputPath>bin\x86\Debug\</OutputPath>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x86'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x86'">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<NoWarn /> <NoWarn />
<TreatWarningsAsErrors>false</TreatWarningsAsErrors> <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<WarningsAsErrors /> <WarningsAsErrors />
<OutputPath>bin\x86\Release\</OutputPath> <OutputPath>bin\x86\Release\</OutputPath>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<NoWarn /> <NoWarn />
<TreatWarningsAsErrors>false</TreatWarningsAsErrors> <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<WarningsAsErrors /> <WarningsAsErrors />
<OutputPath>bin\x64\Release\</OutputPath> <OutputPath>bin\x64\Release\</OutputPath>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<None Remove=".gitignore" /> <None Remove=".gitignore" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<COMReference Include="TaskScheduler.dll"> <COMReference Include="TaskScheduler.dll">
<Guid>e34cb9f1-c7f7-424c-be29-027dcc09363a</Guid> <Guid>e34cb9f1-c7f7-424c-be29-027dcc09363a</Guid>
<VersionMajor>1</VersionMajor> <VersionMajor>1</VersionMajor>
<VersionMinor>0</VersionMinor> <VersionMinor>0</VersionMinor>
<WrapperTool>tlbimp</WrapperTool> <WrapperTool>tlbimp</WrapperTool>
<Lcid>0</Lcid> <Lcid>0</Lcid>
<Isolated>false</Isolated> <Isolated>false</Isolated>
<EmbedInteropTypes>false</EmbedInteropTypes> <EmbedInteropTypes>false</EmbedInteropTypes>
</COMReference> </COMReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="DNS" Version="5.0.0" /> <PackageReference Include="ini-parser" Version="2.5.2" />
<PackageReference Include="DnsClient" Version="1.2.0" /> <PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="ini-parser" Version="2.5.2" /> <PackageReference Include="System.Buffers" Version="4.5.0" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" /> <PackageReference Include="WindowsAPICodePack-Shell" Version="1.1.1" />
<PackageReference Include="System.Buffers" Version="4.5.0" /> </ItemGroup>
<PackageReference Include="WindowsAPICodePack-Shell" Version="1.1.1" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<Reference Include="System.Net.Http" /> <ProjectReference Include="..\NetchLib\NetchLib.csproj" />
<Reference Include="System.ServiceProcess" /> </ItemGroup>
<Reference Include="System.Web" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Update="Properties\Resources.Designer.cs"> <Reference Include="System.Net.Http" />
<DesignTime>True</DesignTime> <Reference Include="System.ServiceProcess" />
<AutoGen>True</AutoGen> <Reference Include="System.Web" />
<DependentUpon>Resources.resx</DependentUpon> </ItemGroup>
</Compile>
</ItemGroup>
<ItemGroup> <ItemGroup>
<EmbeddedResource Update="Properties\Resources.resx"> <Compile Update="Properties\Resources.Designer.cs">
<Generator>ResXFileCodeGenerator</Generator> <DesignTime>True</DesignTime>
<LastGenOutput>Resources.Designer.cs</LastGenOutput> <AutoGen>True</AutoGen>
</EmbeddedResource> <DependentUpon>Resources.resx</DependentUpon>
</ItemGroup> </Compile>
<Compile Update="Properties\Settings.Designer.cs">
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
</Compile>
</ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent"> <ItemGroup>
<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" /> <EmbeddedResource Update="Properties\Resources.resx">
</Target> <Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
</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>
<ProjectExtensions><VisualStudio><UserProperties /></VisualStudio></ProjectExtensions>
</Project>

View File

@@ -8,8 +8,8 @@ namespace Netch.Override
protected override WebRequest GetWebRequest(Uri address) protected override WebRequest GetWebRequest(Uri address)
{ {
var request = base.GetWebRequest(address); var request = base.GetWebRequest(address);
request.Timeout = 4000; request.Timeout = 10000;
((HttpWebRequest)request).ReadWriteTimeout = 4000; ((HttpWebRequest)request).ReadWriteTimeout = 10000;
return request; return request;
} }

View File

@@ -1,6 +1,6 @@
using System.Reflection; using Netch.Controllers;
using System.Reflection;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using Netch.Controllers;
// 有关程序集的一般信息由以下 // 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改 // 控制。更改这些特性值可修改

View File

@@ -1,30 +1,26 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <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> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
namespace Netch.Properties namespace Netch.Properties {
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.4.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{ private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); public static Settings Default {
get {
public static Settings Default return defaultInstance;
{ }
get }
{ }
return defaultInstance;
}
}
}
} }

View File

@@ -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);
}
}
}

View File

@@ -12,7 +12,7 @@
"Stop": "停止", "Stop": "停止",
"Waiting for command": "等待命令中", "Waiting for command": "等待命令中",
"Starting": "正在启动中", "Starting": "正在启动中",
"Start failed": "启动失败", "Start failed": "启动失败请打开软件目录logging文件夹查看日志",
"Started": "已启动", "Started": "已启动",
"Stopping": "正在停止中", "Stopping": "正在停止中",
"Stopped": "已停止", "Stopped": "已停止",
@@ -23,9 +23,14 @@
"Starting NatTester": "正在启动Nat测试", "Starting NatTester": "正在启动Nat测试",
"Starting LocalDns service": "正在启动本地DNS服务", "Starting LocalDns service": "正在启动本地DNS服务",
"Starting Redirector": "正在启动Redirector", "Starting Redirector": "正在启动Redirector",
"ReStarting Redirector": "正常启动失败正在尝试重新启动Redirector",
"Starting netfilter2 Service": "正在启动netfilter2服务", "Starting netfilter2 Service": "正在启动netfilter2服务",
"Starting dns2tcp Service": "正在启动dns2tcp服务", "Starting dns Service": "正在启动dns服务",
"SetupBypass": "设置绕行规则", "SetupBypass": "设置绕行规则",
"Test failed": "测试失败",
"Starting update subscription": "正在更新订阅",
"Subscription updated": "订阅更新完毕",
"Register driver": "正在注册驱动",
"Server": "服务器", "Server": "服务器",
"Import Servers From Clipboard": "从剪贴板导入服务器", "Import Servers From Clipboard": "从剪贴板导入服务器",
@@ -83,6 +88,9 @@
"Modes have been reload": "模式已重载", "Modes have been reload": "模式已重载",
"Clean DNS Cache": "清理 DNS 缓存", "Clean DNS Cache": "清理 DNS 缓存",
"DNS cache cleanup succeeded": "DNS 缓存清理成功", "DNS cache cleanup succeeded": "DNS 缓存清理成功",
"Update ACL": "更新ACL规则",
"ACL updated successfully": "ACL更新成功",
"ACL update failed": "ACL更新失败",
"About": "关于", "About": "关于",
"Telegram Channel": "Telegram 频道", "Telegram Channel": "Telegram 频道",
@@ -93,6 +101,8 @@
"Please press Stop button first": "请先点击停止按钮", "Please press Stop button first": "请先点击停止按钮",
"Please select a server first": "请先选择一个服务器", "Please select a server first": "请先选择一个服务器",
"Please select an mode 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": "已使用", "Used": "已使用",
"Status": "状态", "Status": "状态",
@@ -136,6 +146,7 @@
"Netmask": "子网掩码", "Netmask": "子网掩码",
"Gateway": "网关", "Gateway": "网关",
"Use Custom DNS": "使用自定义 DNS", "Use Custom DNS": "使用自定义 DNS",
"Proxy DNS in Mode 2": "在模式2下代理DNS",
"Behavior": "行为", "Behavior": "行为",
"Exit when closed": "关闭时退出", "Exit when closed": "关闭时退出",
"Stop when exited": "退出时停止", "Stop when exited": "退出时停止",
@@ -146,6 +157,11 @@
"ProfileCount value illegal. Try again.": "快捷配置数值非法。请重试。", "ProfileCount value illegal. Try again.": "快捷配置数值非法。请重试。",
"STUN_ServerPort value illegal. Try again.": "STUN端口数值非法。请重试。", "STUN_ServerPort value illegal. Try again.": "STUN端口数值非法。请重试。",
"TUN/TAP driver is not detected. Is it installed now?": "未检测到TUN/TAP驱动是否现在安装", "TUN/TAP driver is not detected. Is it installed now?": "未检测到TUN/TAP驱动是否现在安装",
"Experimental function": "实验性功能",
"Delay test after startup": "启动后延迟测试",
"Enable": "启用",
"Detection interval(/s)": "检测间隔(/秒)",
"Custom ACL": "自定义ACL规则",
"Profile": "配置名", "Profile": "配置名",
"Profiles": "配置", "Profiles": "配置",

View File

@@ -4,6 +4,7 @@ using System.IO;
using System.Net; using System.Net;
using System.Net.NetworkInformation; using System.Net.NetworkInformation;
using System.Net.Sockets; using System.Net.Sockets;
using System.Threading;
using System.Windows.Forms; using System.Windows.Forms;
namespace Netch.Utils namespace Netch.Utils
@@ -169,10 +170,13 @@ namespace Netch.Utils
installProcess.Start(); installProcess.Start();
installProcess.WaitForExit(); installProcess.WaitForExit();
installProcess.Close(); installProcess.Close();
//给点时间不然立马安装完毕就查找适配器可能会导致找不到适配器ID
Thread.Sleep(1000);
Global.TUNTAP.ComponentID = TUNTAP.GetComponentID(); Global.TUNTAP.ComponentID = TUNTAP.GetComponentID();
} }
else { else
{
return false; return false;
} }
//MessageBox.Show(i18N.Translate("Please install TAP-Windows and create an TUN/TAP adapter manually"), i18N.Translate("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); //MessageBox.Show(i18N.Translate("Please install TAP-Windows and create an TUN/TAP adapter manually"), i18N.Translate("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);

View File

@@ -1,12 +1,12 @@
using System; using Netch.Models;
using Netch.Models.SS;
using Newtonsoft.Json;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Web; using System.Web;
using Netch.Models;
using Netch.Models.SS;
using Newtonsoft.Json;
namespace Netch.Utils namespace Netch.Utils
{ {
@@ -290,80 +290,88 @@ namespace Netch.Utils
} }
else if (text.StartsWith("ssr://")) else if (text.StartsWith("ssr://"))
{ {
var data = new Server();
data.Type = "SSR";
text = text.Substring(6); list.Add(SsrServerFromLink(text));
var parser = new Regex(@"^(?<server>.+):(?<port>(-?\d+?)):(?<protocol>.+?):(?<method>.+?):(?<obfs>.+?):(?<password>.+?)/\?(?<info>.*)$"); /* var data = new Server();
var match = parser.Match(URLSafeBase64Decode(text)); data.Type = "SSR";
if (match.Success) text = text.Substring(6);
{
data.Hostname = match.Groups["server"].Value;
data.Port = int.Parse(match.Groups["port"].Value);
if (data.Port < 0)
{
data.Port += 65536;
}
data.Password = URLSafeBase64Decode(match.Groups["password"].Value);
data.EncryptMethod = match.Groups["method"].Value; var parser = new Regex(@"^(?<server>.+):(?<port>(-?\d+?)):(?<protocol>.+?):(?<method>.+?):(?<obfs>.+?):(?<password>.+?)/\?(?<info>.*)$");
if (!Global.EncryptMethods.SSR.Contains(data.EncryptMethod)) var parser2 = new Regex(@"^(?<server>.+):(?<port>(-?\d+?)):(?<protocol>.+?):(?<method>.+?):(?<obfs>.+?):(?<password>.+?)/$");
{ var match = parser2.Match(URLSafeBase64Decode(text));
Logging.Info(string.Format("不支持的 SSR 加密方式:{0}", data.EncryptMethod)); if (!match.Success)
return null; {
} match = parser2.Match(UnBase64String(text));
}
data.Protocol = match.Groups["protocol"].Value; if (match.Success)
if (!Global.Protocols.Contains(data.Protocol)) {
{ data.Hostname = match.Groups["server"].Value;
Logging.Info(string.Format("不支持的 SSR 协议:{0}", data.Protocol)); data.Port = int.Parse(match.Groups["port"].Value);
return null; if (data.Port < 0)
} {
data.Port += 65536;
}
data.Password = URLSafeBase64Decode(match.Groups["password"].Value);
data.OBFS = match.Groups["obfs"].Value; data.EncryptMethod = match.Groups["method"].Value;
if (data.OBFS == @"tls1.2_ticket_fastauth") if (!Global.EncryptMethods.SSR.Contains(data.EncryptMethod))
{ {
data.OBFS = @"tls1.2_ticket_auth"; Logging.Info(string.Format("不支持的 SSR 加密方式:{0}", data.EncryptMethod));
} return null;
if (!Global.OBFSs.Contains(data.OBFS)) }
{
Logging.Info(string.Format("不支持的 SSR 混淆:{0}", data.OBFS));
return null;
}
var info = match.Groups["info"].Value; data.Protocol = match.Groups["protocol"].Value;
var dict = new Dictionary<string, string>(); if (!Global.Protocols.Contains(data.Protocol))
foreach (var str in info.Split('&')) {
{ Logging.Info(string.Format("不支持的 SSR 协议:{0}", data.Protocol));
var splited = str.Split('='); return null;
dict.Add(splited[0], splited[1]); }
}
if (dict.ContainsKey("remarks")) data.OBFS = match.Groups["obfs"].Value;
{ if (data.OBFS == @"tls1.2_ticket_fastauth")
data.Remark = URLSafeBase64Decode(dict["remarks"]); {
} data.OBFS = @"tls1.2_ticket_auth";
}
if (!Global.OBFSs.Contains(data.OBFS))
{
Logging.Info(string.Format("不支持的 SSR 混淆:{0}", data.OBFS));
return null;
}
if (dict.ContainsKey("protoparam")) var info = match.Groups["info"].Value;
{ var dict = new Dictionary<string, string>();
data.ProtocolParam = URLSafeBase64Decode(dict["protoparam"]); foreach (var str in info.Split('&'))
} {
var splited = str.Split('=');
dict.Add(splited[0], splited[1]);
}
if (dict.ContainsKey("obfsparam")) if (dict.ContainsKey("remarks"))
{ {
data.OBFSParam = URLSafeBase64Decode(dict["obfsparam"]); data.Remark = URLSafeBase64Decode(dict["remarks"]);
} }
if (Global.EncryptMethods.SS.Contains(data.EncryptMethod) && data.Protocol == "origin" && data.OBFS == "plain") if (dict.ContainsKey("protoparam"))
{ {
data.OBFS = ""; data.ProtocolParam = URLSafeBase64Decode(dict["protoparam"]);
data.Type = "SS"; }
}
} if (dict.ContainsKey("obfsparam"))
{
data.OBFSParam = URLSafeBase64Decode(dict["obfsparam"]);
}
if (Global.EncryptMethods.SS.Contains(data.EncryptMethod) && data.Protocol == "origin" && data.OBFS == "plain")
{
data.OBFS = "";
data.Type = "SS";
}
list.Add(data);
}*/
list.Add(data);
} }
else if (text.StartsWith("vmess://")) else if (text.StartsWith("vmess://"))
{ {
@@ -517,5 +525,123 @@ namespace Netch.Utils
return list; return list;
} }
public static string UnBase64String(string value)
{
if (value == null || value == "")
{
return "";
}
byte[] bytes = Convert.FromBase64String(value);
return Encoding.UTF8.GetString(bytes);
}
public static string ToBase64String(string value)
{
if (value == null || value == "")
{
return "";
}
byte[] bytes = Encoding.UTF8.GetBytes(value);
return Convert.ToBase64String(bytes);
}
/// <summary>
/// SSR链接解析器
/// Copy From https://github.com/HMBSbige/ShadowsocksR-Windows/blob/d9dc8d032a6e04c14b9dc6c8f673c9cc5aa9f607/shadowsocks-csharp/Model/Server.cs#L428
/// Thx :D
/// </summary>
/// <param name="ssrUrl"></param>
/// <returns></returns>
public static Server SsrServerFromLink(string ssrUrl)
{
// ssr://host:port:protocol:method:obfs:base64pass/?obfsparam=base64&remarks=base64&group=base64&udpport=0&uot=1
var ssr = Regex.Match(ssrUrl, "ssr://([A-Za-z0-9_-]+)", RegexOptions.IgnoreCase);
if (!ssr.Success)
throw new FormatException();
var data = URLSafeBase64Decode(ssr.Groups[1].Value);
var params_dict = new Dictionary<string, string>();
var param_start_pos = data.IndexOf("?", StringComparison.Ordinal);
if (param_start_pos > 0)
{
params_dict = ParseParam(data.Substring(param_start_pos + 1));
data = data.Substring(0, param_start_pos);
}
if (data.IndexOf("/", StringComparison.Ordinal) >= 0)
{
data = data.Substring(0, data.LastIndexOf("/", StringComparison.Ordinal));
}
var UrlFinder = new Regex("^(.+):([^:]+):([^:]*):([^:]+):([^:]*):([^:]+)");
var match = UrlFinder.Match(data);
if (match == null || !match.Success)
throw new FormatException();
var serverAddr = match.Groups[1].Value;
var Server_Port = ushort.Parse(match.Groups[2].Value);
var Protocol = match.Groups[3].Value.Length == 0 ? "origin" : match.Groups[3].Value;
Protocol = Protocol.Replace("_compatible", "");
var Method = match.Groups[4].Value;
var obfs = match.Groups[5].Value.Length == 0 ? "plain" : match.Groups[5].Value;
obfs = obfs.Replace("_compatible", "");
var Password = URLSafeBase64Decode(match.Groups[6].Value);
var ProtocolParam = "";
var ObfsParam = "";
var Remarks = "";
var Group = "";
if (params_dict.ContainsKey("protoparam"))
{
ProtocolParam = URLSafeBase64Decode(params_dict["protoparam"]);
}
if (params_dict.ContainsKey("obfsparam"))
{
ObfsParam = URLSafeBase64Decode(params_dict["obfsparam"]);
}
if (params_dict.ContainsKey("remarks"))
{
Remarks = URLSafeBase64Decode(params_dict["remarks"]);
}
Group = params_dict.ContainsKey("group") ? URLSafeBase64Decode(params_dict["group"]) : string.Empty;
/*if (params_dict.ContainsKey("uot"))
{
UdpOverTcp = int.Parse(params_dict["uot"]) != 0;
}
if (params_dict.ContainsKey("udpport"))
{
Server_Udp_Port = ushort.Parse(params_dict["udpport"]);
}*/
Server server = new Server();
server.Type = "SSR";
server.Hostname = serverAddr;
server.Port = Server_Port;
server.Protocol = Protocol;
server.EncryptMethod = Method;
server.OBFS = obfs;
server.Password = Password;
server.ProtocolParam = ProtocolParam;
server.OBFSParam = ObfsParam;
server.Remark = Remarks;
server.Group = Group;
return server;
}
private static Dictionary<string, string> ParseParam(string paramStr)
{
var paramsDict = new Dictionary<string, string>();
var obfsParams = paramStr.Split('&');
foreach (var p in obfsParams)
{
if (p.IndexOf('=') > 0)
{
var index = p.IndexOf('=');
var key = p.Substring(0, index);
var val = p.Substring(index + 1);
paramsDict[key] = val;
}
}
return paramsDict;
}
} }
} }

3
NetchLib/.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
/bin
/obj
/NetchLib.csproj.user

67
NetchLib/NetchLib.csproj Normal file
View File

@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Platforms>x86;x64</Platforms>
<ProjectGuid>{A8715AF4-ACC6-43F9-9381-4294C5360623}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>NetchLib</RootNamespace>
<AssemblyName>NetchLib</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</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)'=='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'">
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SearchComboBox.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("NetchLib")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("NetchLib")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("a8715af4-acc6-43f9-9381-4294c5360623")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -1,6 +1,6 @@
# Netch # 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 Game accelerator
[简体中文](docs/README.zh-CN.md) (此版本内容更丰富) [简体中文](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](docs/sponsor/nyancat.jpg)](https://nyancat.info)
NyanCAT Network全中转高质量节点多条低倍率节点保证流量无忧节点极低延迟涵盖五大洲。Netflix 视频党,游戏党,海外回国党必备,无需年付,月付 19 元起 NyanCAT Network全中转高质量节点多条低倍率节点保证流量无忧节点极低延迟涵盖五大洲。Netflix 视频党,游戏党,海外回国党必备,无需年付,月付 19 元起。[测速图](https://t.me/BGP2020/935)
[Telegram 群组](https://t.me/NyanCaaaat) [加入 Telegram 群组](https://t.me/NyanCaaaat)
[![ManSora](docs/sponsor/mansora.jpg)](https://www.mansora.net/cart.php) [![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](sponsor/nyancat.jpg)](https://nyancat.info)
NyanCAT Network全中转高质量节点多条低倍率节点保证流量无忧节点极低延迟涵盖五大洲。Netflix 视频党,游戏党,海外回国党必备,无需年付,月付 19 元起 NyanCAT Network全中转高质量节点多条低倍率节点保证流量无忧节点极低延迟涵盖五大洲。Netflix 视频党,游戏党,海外回国党必备,无需年付,月付 19 元起。[测速图](https://t.me/BGP2020/935)
[Telegram 群组](https://t.me/NyanCaaaat) [加入 Telegram 群组](https://t.me/NyanCaaaat)
[![ManSora](sponsor/mansora.jpg)](https://www.mansora.net/cart.php) [![ManSora](sponsor/mansora.jpg)](https://www.mansora.net/cart.php)

2
modes

Submodule modes updated: 8d6f98d43e...a9329cd3f1