Compare commits

...

17 Commits

Author SHA1 Message Date
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
17 changed files with 550 additions and 191 deletions

71
.github/workflows/dotnetcore.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}}

View File

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

View File

@@ -49,9 +49,26 @@ namespace Netch.Controllers
// 生成驱动文件路径
var driver = string.Format("{0}\\drivers\\netfilter2.sys", Environment.SystemDirectory);
// 检查驱动是否存在
if (!File.Exists(driver))
if (File.Exists(driver))
{
//为了防止小白一直问如何卸载老驱动核心,每次启动时卸载删除一次驱动,保证系统使用最新驱动核心(简单粗暴 但有效:D。增加启动成功率驱动在被其他加速器占用的情况下可能会导致启动失败
try
{
var service = new ServiceController("netfilter2");
if (service.Status == ServiceControllerStatus.Running)
{
service.Stop();
service.WaitForStatus(ServiceControllerStatus.Stopped);
}
nfapinet.NFAPI.nf_unRegisterDriver("netfilter2");
File.Delete(driver);
}
catch (Exception)
{
// 跳过
}
// 生成系统版本
var version = $"{Environment.OSVersion.Version.Major.ToString()}.{Environment.OSVersion.Version.Minor.ToString()}";
@@ -94,6 +111,10 @@ namespace Netch.Controllers
return false;
}
}
// 检查驱动是否存在
/*if (!File.Exists(driver))
{
}*/
try
{
@@ -205,7 +226,7 @@ namespace Netch.Controllers
{
State = Models.State.Stopped;
}
else if (e.Data.Contains("Redirect to"))
else if (e.Data.Contains("Started") || e.Data.Contains("Redirect to"))
{
State = Models.State.Started;
}

View File

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

View File

@@ -488,6 +488,7 @@ namespace Netch.Forms
if (Global.Settings.SubscribeLink.Count > 0)
{
StatusLabel.Text = $"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Starting update subscription")}";
DeletePictureBox.Enabled = false;
UpdateServersFromSubscribeLinksToolStripMenuItem.Enabled = false;
@@ -571,6 +572,7 @@ namespace Netch.Forms
NatTypeStatusLabel.Text = "";
}
Utils.Configuration.Save();
StatusLabel.Text = $"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Subscription updated")}";
}).ContinueWith(task =>
{
BeginInvoke(new Action(() =>
@@ -1225,7 +1227,14 @@ namespace Netch.Forms
}
public void NatTypeStatusText(string text)
{
NatTypeStatusLabel.Text = "NatType:" + text;
if (!string.IsNullOrWhiteSpace(text))
{
NatTypeStatusLabel.Text = "NAT" + Utils.i18N.Translate(": ") + text;
}
else
{
NatTypeStatusLabel.Text = "NAT" + Utils.i18N.Translate(": ") + Utils.i18N.Translate("Test failed");
}
}
}
}

View File

@@ -36,6 +36,7 @@
this.Socks5PortLabel = new System.Windows.Forms.Label();
this.Socks5PortTextBox = new System.Windows.Forms.TextBox();
this.TUNTAPGroupBox = new System.Windows.Forms.GroupBox();
this.TUNTAPProxyDNSCheckBox = new System.Windows.Forms.CheckBox();
this.TUNTAPUseCustomDNSCheckBox = new System.Windows.Forms.CheckBox();
this.TUNTAPDNSLabel = new System.Windows.Forms.Label();
this.TUNTAPDNSTextBox = new System.Windows.Forms.TextBox();
@@ -72,9 +73,11 @@
this.PortGroupBox.Controls.Add(this.HTTPPortTextBox);
this.PortGroupBox.Controls.Add(this.Socks5PortLabel);
this.PortGroupBox.Controls.Add(this.Socks5PortTextBox);
this.PortGroupBox.Location = new System.Drawing.Point(12, 12);
this.PortGroupBox.Location = new System.Drawing.Point(18, 18);
this.PortGroupBox.Margin = new System.Windows.Forms.Padding(4);
this.PortGroupBox.Name = "PortGroupBox";
this.PortGroupBox.Size = new System.Drawing.Size(420, 140);
this.PortGroupBox.Padding = new System.Windows.Forms.Padding(4);
this.PortGroupBox.Size = new System.Drawing.Size(630, 210);
this.PortGroupBox.TabIndex = 0;
this.PortGroupBox.TabStop = false;
this.PortGroupBox.Text = "Local Port";
@@ -82,9 +85,10 @@
// AllowDevicesCheckBox
//
this.AllowDevicesCheckBox.AutoSize = true;
this.AllowDevicesCheckBox.Location = new System.Drawing.Point(120, 80);
this.AllowDevicesCheckBox.Location = new System.Drawing.Point(180, 120);
this.AllowDevicesCheckBox.Margin = new System.Windows.Forms.Padding(4);
this.AllowDevicesCheckBox.Name = "AllowDevicesCheckBox";
this.AllowDevicesCheckBox.Size = new System.Drawing.Size(206, 21);
this.AllowDevicesCheckBox.Size = new System.Drawing.Size(301, 28);
this.AllowDevicesCheckBox.TabIndex = 5;
this.AllowDevicesCheckBox.Text = "Allow other Devices to connect";
this.AllowDevicesCheckBox.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
@@ -93,39 +97,44 @@
// HTTPPortLabel
//
this.HTTPPortLabel.AutoSize = true;
this.HTTPPortLabel.Location = new System.Drawing.Point(9, 54);
this.HTTPPortLabel.Location = new System.Drawing.Point(14, 81);
this.HTTPPortLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.HTTPPortLabel.Name = "HTTPPortLabel";
this.HTTPPortLabel.Size = new System.Drawing.Size(38, 17);
this.HTTPPortLabel.Size = new System.Drawing.Size(55, 24);
this.HTTPPortLabel.TabIndex = 3;
this.HTTPPortLabel.Text = "HTTP";
//
// HTTPPortTextBox
//
this.HTTPPortTextBox.Location = new System.Drawing.Point(120, 51);
this.HTTPPortTextBox.Location = new System.Drawing.Point(180, 76);
this.HTTPPortTextBox.Margin = new System.Windows.Forms.Padding(4);
this.HTTPPortTextBox.Name = "HTTPPortTextBox";
this.HTTPPortTextBox.Size = new System.Drawing.Size(294, 23);
this.HTTPPortTextBox.Size = new System.Drawing.Size(439, 31);
this.HTTPPortTextBox.TabIndex = 4;
this.HTTPPortTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// Socks5PortLabel
//
this.Socks5PortLabel.AutoSize = true;
this.Socks5PortLabel.Location = new System.Drawing.Point(9, 25);
this.Socks5PortLabel.Location = new System.Drawing.Point(14, 38);
this.Socks5PortLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.Socks5PortLabel.Name = "Socks5PortLabel";
this.Socks5PortLabel.Size = new System.Drawing.Size(49, 17);
this.Socks5PortLabel.Size = new System.Drawing.Size(69, 24);
this.Socks5PortLabel.TabIndex = 0;
this.Socks5PortLabel.Text = "Socks5";
//
// Socks5PortTextBox
//
this.Socks5PortTextBox.Location = new System.Drawing.Point(120, 22);
this.Socks5PortTextBox.Location = new System.Drawing.Point(180, 33);
this.Socks5PortTextBox.Margin = new System.Windows.Forms.Padding(4);
this.Socks5PortTextBox.Name = "Socks5PortTextBox";
this.Socks5PortTextBox.Size = new System.Drawing.Size(294, 23);
this.Socks5PortTextBox.Size = new System.Drawing.Size(439, 31);
this.Socks5PortTextBox.TabIndex = 1;
this.Socks5PortTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// TUNTAPGroupBox
//
this.TUNTAPGroupBox.Controls.Add(this.TUNTAPProxyDNSCheckBox);
this.TUNTAPGroupBox.Controls.Add(this.TUNTAPUseCustomDNSCheckBox);
this.TUNTAPGroupBox.Controls.Add(this.TUNTAPDNSLabel);
this.TUNTAPGroupBox.Controls.Add(this.TUNTAPDNSTextBox);
@@ -135,19 +144,33 @@
this.TUNTAPGroupBox.Controls.Add(this.TUNTAPNetmaskTextBox);
this.TUNTAPGroupBox.Controls.Add(this.TUNTAPAddressLabel);
this.TUNTAPGroupBox.Controls.Add(this.TUNTAPAddressTextBox);
this.TUNTAPGroupBox.Location = new System.Drawing.Point(12, 158);
this.TUNTAPGroupBox.Location = new System.Drawing.Point(18, 237);
this.TUNTAPGroupBox.Margin = new System.Windows.Forms.Padding(4);
this.TUNTAPGroupBox.Name = "TUNTAPGroupBox";
this.TUNTAPGroupBox.Size = new System.Drawing.Size(420, 164);
this.TUNTAPGroupBox.Padding = new System.Windows.Forms.Padding(4);
this.TUNTAPGroupBox.Size = new System.Drawing.Size(630, 281);
this.TUNTAPGroupBox.TabIndex = 3;
this.TUNTAPGroupBox.TabStop = false;
this.TUNTAPGroupBox.Text = "TUN/TAP";
//
// TUNTAPProxyDNSCheckBox
//
this.TUNTAPProxyDNSCheckBox.AutoSize = true;
this.TUNTAPProxyDNSCheckBox.Location = new System.Drawing.Point(180, 243);
this.TUNTAPProxyDNSCheckBox.Margin = new System.Windows.Forms.Padding(4);
this.TUNTAPProxyDNSCheckBox.Name = "TUNTAPProxyDNSCheckBox";
this.TUNTAPProxyDNSCheckBox.Size = new System.Drawing.Size(221, 28);
this.TUNTAPProxyDNSCheckBox.TabIndex = 10;
this.TUNTAPProxyDNSCheckBox.Text = "Proxy DNS in Mode 2";
this.TUNTAPProxyDNSCheckBox.UseVisualStyleBackColor = true;
//
// TUNTAPUseCustomDNSCheckBox
//
this.TUNTAPUseCustomDNSCheckBox.AutoSize = true;
this.TUNTAPUseCustomDNSCheckBox.Location = new System.Drawing.Point(120, 138);
this.TUNTAPUseCustomDNSCheckBox.Location = new System.Drawing.Point(180, 207);
this.TUNTAPUseCustomDNSCheckBox.Margin = new System.Windows.Forms.Padding(4);
this.TUNTAPUseCustomDNSCheckBox.Name = "TUNTAPUseCustomDNSCheckBox";
this.TUNTAPUseCustomDNSCheckBox.Size = new System.Drawing.Size(127, 21);
this.TUNTAPUseCustomDNSCheckBox.Size = new System.Drawing.Size(182, 28);
this.TUNTAPUseCustomDNSCheckBox.TabIndex = 9;
this.TUNTAPUseCustomDNSCheckBox.Text = "Use Custom DNS";
this.TUNTAPUseCustomDNSCheckBox.UseVisualStyleBackColor = true;
@@ -156,77 +179,86 @@
// TUNTAPDNSLabel
//
this.TUNTAPDNSLabel.AutoSize = true;
this.TUNTAPDNSLabel.Location = new System.Drawing.Point(9, 112);
this.TUNTAPDNSLabel.Location = new System.Drawing.Point(14, 168);
this.TUNTAPDNSLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.TUNTAPDNSLabel.Name = "TUNTAPDNSLabel";
this.TUNTAPDNSLabel.Size = new System.Drawing.Size(34, 17);
this.TUNTAPDNSLabel.Size = new System.Drawing.Size(49, 24);
this.TUNTAPDNSLabel.TabIndex = 7;
this.TUNTAPDNSLabel.Text = "DNS";
//
// TUNTAPDNSTextBox
//
this.TUNTAPDNSTextBox.Location = new System.Drawing.Point(120, 110);
this.TUNTAPDNSTextBox.Location = new System.Drawing.Point(180, 165);
this.TUNTAPDNSTextBox.Margin = new System.Windows.Forms.Padding(4);
this.TUNTAPDNSTextBox.Name = "TUNTAPDNSTextBox";
this.TUNTAPDNSTextBox.Size = new System.Drawing.Size(294, 23);
this.TUNTAPDNSTextBox.Size = new System.Drawing.Size(439, 31);
this.TUNTAPDNSTextBox.TabIndex = 8;
this.TUNTAPDNSTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// TUNTAPGatewayLabel
//
this.TUNTAPGatewayLabel.AutoSize = true;
this.TUNTAPGatewayLabel.Location = new System.Drawing.Point(9, 83);
this.TUNTAPGatewayLabel.Location = new System.Drawing.Point(14, 124);
this.TUNTAPGatewayLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.TUNTAPGatewayLabel.Name = "TUNTAPGatewayLabel";
this.TUNTAPGatewayLabel.Size = new System.Drawing.Size(57, 17);
this.TUNTAPGatewayLabel.Size = new System.Drawing.Size(84, 24);
this.TUNTAPGatewayLabel.TabIndex = 5;
this.TUNTAPGatewayLabel.Text = "Gateway";
//
// TUNTAPGatewayTextBox
//
this.TUNTAPGatewayTextBox.Location = new System.Drawing.Point(120, 80);
this.TUNTAPGatewayTextBox.Location = new System.Drawing.Point(180, 120);
this.TUNTAPGatewayTextBox.Margin = new System.Windows.Forms.Padding(4);
this.TUNTAPGatewayTextBox.Name = "TUNTAPGatewayTextBox";
this.TUNTAPGatewayTextBox.Size = new System.Drawing.Size(294, 23);
this.TUNTAPGatewayTextBox.Size = new System.Drawing.Size(439, 31);
this.TUNTAPGatewayTextBox.TabIndex = 6;
this.TUNTAPGatewayTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// TUNTAPNetmaskLabel
//
this.TUNTAPNetmaskLabel.AutoSize = true;
this.TUNTAPNetmaskLabel.Location = new System.Drawing.Point(9, 54);
this.TUNTAPNetmaskLabel.Location = new System.Drawing.Point(14, 81);
this.TUNTAPNetmaskLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.TUNTAPNetmaskLabel.Name = "TUNTAPNetmaskLabel";
this.TUNTAPNetmaskLabel.Size = new System.Drawing.Size(60, 17);
this.TUNTAPNetmaskLabel.Size = new System.Drawing.Size(87, 24);
this.TUNTAPNetmaskLabel.TabIndex = 3;
this.TUNTAPNetmaskLabel.Text = "Netmask";
//
// TUNTAPNetmaskTextBox
//
this.TUNTAPNetmaskTextBox.Location = new System.Drawing.Point(120, 51);
this.TUNTAPNetmaskTextBox.Location = new System.Drawing.Point(180, 76);
this.TUNTAPNetmaskTextBox.Margin = new System.Windows.Forms.Padding(4);
this.TUNTAPNetmaskTextBox.Name = "TUNTAPNetmaskTextBox";
this.TUNTAPNetmaskTextBox.Size = new System.Drawing.Size(294, 23);
this.TUNTAPNetmaskTextBox.Size = new System.Drawing.Size(439, 31);
this.TUNTAPNetmaskTextBox.TabIndex = 4;
this.TUNTAPNetmaskTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// TUNTAPAddressLabel
//
this.TUNTAPAddressLabel.AutoSize = true;
this.TUNTAPAddressLabel.Location = new System.Drawing.Point(9, 25);
this.TUNTAPAddressLabel.Location = new System.Drawing.Point(14, 38);
this.TUNTAPAddressLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.TUNTAPAddressLabel.Name = "TUNTAPAddressLabel";
this.TUNTAPAddressLabel.Size = new System.Drawing.Size(56, 17);
this.TUNTAPAddressLabel.Size = new System.Drawing.Size(80, 24);
this.TUNTAPAddressLabel.TabIndex = 1;
this.TUNTAPAddressLabel.Text = "Address";
//
// TUNTAPAddressTextBox
//
this.TUNTAPAddressTextBox.Location = new System.Drawing.Point(120, 22);
this.TUNTAPAddressTextBox.Location = new System.Drawing.Point(180, 33);
this.TUNTAPAddressTextBox.Margin = new System.Windows.Forms.Padding(4);
this.TUNTAPAddressTextBox.Name = "TUNTAPAddressTextBox";
this.TUNTAPAddressTextBox.Size = new System.Drawing.Size(294, 23);
this.TUNTAPAddressTextBox.Size = new System.Drawing.Size(439, 31);
this.TUNTAPAddressTextBox.TabIndex = 2;
this.TUNTAPAddressTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// ControlButton
//
this.ControlButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.ControlButton.Location = new System.Drawing.Point(357, 648);
this.ControlButton.Location = new System.Drawing.Point(536, 1018);
this.ControlButton.Margin = new System.Windows.Forms.Padding(4);
this.ControlButton.Name = "ControlButton";
this.ControlButton.Size = new System.Drawing.Size(75, 23);
this.ControlButton.Size = new System.Drawing.Size(112, 34);
this.ControlButton.TabIndex = 11;
this.ControlButton.Text = "Save";
this.ControlButton.UseVisualStyleBackColor = true;
@@ -235,9 +267,10 @@
// GlobalBypassIPsButton
//
this.GlobalBypassIPsButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.GlobalBypassIPsButton.Location = new System.Drawing.Point(12, 648);
this.GlobalBypassIPsButton.Location = new System.Drawing.Point(18, 1018);
this.GlobalBypassIPsButton.Margin = new System.Windows.Forms.Padding(4);
this.GlobalBypassIPsButton.Name = "GlobalBypassIPsButton";
this.GlobalBypassIPsButton.Size = new System.Drawing.Size(128, 23);
this.GlobalBypassIPsButton.Size = new System.Drawing.Size(192, 34);
this.GlobalBypassIPsButton.TabIndex = 10;
this.GlobalBypassIPsButton.Text = "Global Bypass IPs";
this.GlobalBypassIPsButton.UseVisualStyleBackColor = true;
@@ -257,63 +290,71 @@
this.BehaviorGroupBox.Controls.Add(this.StartWhenOpenedCheckBox);
this.BehaviorGroupBox.Controls.Add(this.StopWhenExitedCheckBox);
this.BehaviorGroupBox.Controls.Add(this.ExitWhenClosedCheckBox);
this.BehaviorGroupBox.Location = new System.Drawing.Point(12, 330);
this.BehaviorGroupBox.Location = new System.Drawing.Point(18, 526);
this.BehaviorGroupBox.Margin = new System.Windows.Forms.Padding(4);
this.BehaviorGroupBox.Name = "BehaviorGroupBox";
this.BehaviorGroupBox.Size = new System.Drawing.Size(420, 312);
this.BehaviorGroupBox.Padding = new System.Windows.Forms.Padding(4);
this.BehaviorGroupBox.Size = new System.Drawing.Size(630, 468);
this.BehaviorGroupBox.TabIndex = 8;
this.BehaviorGroupBox.TabStop = false;
this.BehaviorGroupBox.Text = "Behavior";
//
// STUN_ServerPortTextBox
//
this.STUN_ServerPortTextBox.Location = new System.Drawing.Point(120, 237);
this.STUN_ServerPortTextBox.Location = new System.Drawing.Point(180, 356);
this.STUN_ServerPortTextBox.Margin = new System.Windows.Forms.Padding(4);
this.STUN_ServerPortTextBox.Name = "STUN_ServerPortTextBox";
this.STUN_ServerPortTextBox.Size = new System.Drawing.Size(294, 23);
this.STUN_ServerPortTextBox.Size = new System.Drawing.Size(439, 31);
this.STUN_ServerPortTextBox.TabIndex = 8;
this.STUN_ServerPortTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(9, 243);
this.label2.Location = new System.Drawing.Point(14, 364);
this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(110, 17);
this.label2.Size = new System.Drawing.Size(157, 24);
this.label2.TabIndex = 12;
this.label2.Text = "STUN Server Port";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(9, 214);
this.label1.Location = new System.Drawing.Point(14, 321);
this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(82, 17);
this.label1.Size = new System.Drawing.Size(116, 24);
this.label1.TabIndex = 10;
this.label1.Text = "STUN Server";
//
// RunAtStartup
//
this.RunAtStartup.AutoSize = true;
this.RunAtStartup.Location = new System.Drawing.Point(120, 130);
this.RunAtStartup.Location = new System.Drawing.Point(180, 195);
this.RunAtStartup.Margin = new System.Windows.Forms.Padding(4);
this.RunAtStartup.Name = "RunAtStartup";
this.RunAtStartup.Size = new System.Drawing.Size(109, 21);
this.RunAtStartup.Size = new System.Drawing.Size(159, 28);
this.RunAtStartup.TabIndex = 11;
this.RunAtStartup.Text = "Run at startup";
this.RunAtStartup.UseVisualStyleBackColor = true;
//
// STUN_ServerTextBox
//
this.STUN_ServerTextBox.Location = new System.Drawing.Point(120, 211);
this.STUN_ServerTextBox.Location = new System.Drawing.Point(180, 316);
this.STUN_ServerTextBox.Margin = new System.Windows.Forms.Padding(4);
this.STUN_ServerTextBox.Name = "STUN_ServerTextBox";
this.STUN_ServerTextBox.Size = new System.Drawing.Size(294, 23);
this.STUN_ServerTextBox.Size = new System.Drawing.Size(439, 31);
this.STUN_ServerTextBox.TabIndex = 11;
this.STUN_ServerTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// MinimizeWhenStartedCheckBox
//
this.MinimizeWhenStartedCheckBox.AutoSize = true;
this.MinimizeWhenStartedCheckBox.Location = new System.Drawing.Point(120, 103);
this.MinimizeWhenStartedCheckBox.Location = new System.Drawing.Point(180, 154);
this.MinimizeWhenStartedCheckBox.Margin = new System.Windows.Forms.Padding(4);
this.MinimizeWhenStartedCheckBox.Name = "MinimizeWhenStartedCheckBox";
this.MinimizeWhenStartedCheckBox.Size = new System.Drawing.Size(158, 21);
this.MinimizeWhenStartedCheckBox.Size = new System.Drawing.Size(233, 28);
this.MinimizeWhenStartedCheckBox.TabIndex = 10;
this.MinimizeWhenStartedCheckBox.Text = "Minimize when started";
this.MinimizeWhenStartedCheckBox.UseVisualStyleBackColor = true;
@@ -321,26 +362,29 @@
// ProfileCount_Label
//
this.ProfileCount_Label.AutoSize = true;
this.ProfileCount_Label.Location = new System.Drawing.Point(9, 185);
this.ProfileCount_Label.Location = new System.Drawing.Point(14, 278);
this.ProfileCount_Label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.ProfileCount_Label.Name = "ProfileCount_Label";
this.ProfileCount_Label.Size = new System.Drawing.Size(79, 17);
this.ProfileCount_Label.Size = new System.Drawing.Size(117, 24);
this.ProfileCount_Label.TabIndex = 8;
this.ProfileCount_Label.Text = "ProfileCount";
//
// ProfileCount_TextBox
//
this.ProfileCount_TextBox.Location = new System.Drawing.Point(222, 182);
this.ProfileCount_TextBox.Location = new System.Drawing.Point(333, 273);
this.ProfileCount_TextBox.Margin = new System.Windows.Forms.Padding(4);
this.ProfileCount_TextBox.Name = "ProfileCount_TextBox";
this.ProfileCount_TextBox.Size = new System.Drawing.Size(192, 23);
this.ProfileCount_TextBox.Size = new System.Drawing.Size(286, 31);
this.ProfileCount_TextBox.TabIndex = 9;
this.ProfileCount_TextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// CheckUpdateWhenOpenedCheckBox
//
this.CheckUpdateWhenOpenedCheckBox.AutoSize = true;
this.CheckUpdateWhenOpenedCheckBox.Location = new System.Drawing.Point(120, 157);
this.CheckUpdateWhenOpenedCheckBox.Location = new System.Drawing.Point(180, 236);
this.CheckUpdateWhenOpenedCheckBox.Margin = new System.Windows.Forms.Padding(4);
this.CheckUpdateWhenOpenedCheckBox.Name = "CheckUpdateWhenOpenedCheckBox";
this.CheckUpdateWhenOpenedCheckBox.Size = new System.Drawing.Size(190, 21);
this.CheckUpdateWhenOpenedCheckBox.Size = new System.Drawing.Size(277, 28);
this.CheckUpdateWhenOpenedCheckBox.TabIndex = 8;
this.CheckUpdateWhenOpenedCheckBox.Text = "Check update when opened";
this.CheckUpdateWhenOpenedCheckBox.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
@@ -349,9 +393,10 @@
// StartWhenOpenedCheckBox
//
this.StartWhenOpenedCheckBox.AutoSize = true;
this.StartWhenOpenedCheckBox.Location = new System.Drawing.Point(120, 76);
this.StartWhenOpenedCheckBox.Location = new System.Drawing.Point(180, 114);
this.StartWhenOpenedCheckBox.Margin = new System.Windows.Forms.Padding(4);
this.StartWhenOpenedCheckBox.Name = "StartWhenOpenedCheckBox";
this.StartWhenOpenedCheckBox.Size = new System.Drawing.Size(137, 21);
this.StartWhenOpenedCheckBox.Size = new System.Drawing.Size(199, 28);
this.StartWhenOpenedCheckBox.TabIndex = 7;
this.StartWhenOpenedCheckBox.Text = "Start when opened";
this.StartWhenOpenedCheckBox.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
@@ -360,9 +405,10 @@
// StopWhenExitedCheckBox
//
this.StopWhenExitedCheckBox.AutoSize = true;
this.StopWhenExitedCheckBox.Location = new System.Drawing.Point(120, 49);
this.StopWhenExitedCheckBox.Location = new System.Drawing.Point(180, 74);
this.StopWhenExitedCheckBox.Margin = new System.Windows.Forms.Padding(4);
this.StopWhenExitedCheckBox.Name = "StopWhenExitedCheckBox";
this.StopWhenExitedCheckBox.Size = new System.Drawing.Size(127, 21);
this.StopWhenExitedCheckBox.Size = new System.Drawing.Size(185, 28);
this.StopWhenExitedCheckBox.TabIndex = 6;
this.StopWhenExitedCheckBox.Text = "Stop when exited";
this.StopWhenExitedCheckBox.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
@@ -371,9 +417,10 @@
// ExitWhenClosedCheckBox
//
this.ExitWhenClosedCheckBox.AutoSize = true;
this.ExitWhenClosedCheckBox.Location = new System.Drawing.Point(120, 22);
this.ExitWhenClosedCheckBox.Location = new System.Drawing.Point(180, 33);
this.ExitWhenClosedCheckBox.Margin = new System.Windows.Forms.Padding(4);
this.ExitWhenClosedCheckBox.Name = "ExitWhenClosedCheckBox";
this.ExitWhenClosedCheckBox.Size = new System.Drawing.Size(123, 21);
this.ExitWhenClosedCheckBox.Size = new System.Drawing.Size(178, 28);
this.ExitWhenClosedCheckBox.TabIndex = 5;
this.ExitWhenClosedCheckBox.Text = "Exit when closed";
this.ExitWhenClosedCheckBox.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
@@ -381,9 +428,9 @@
//
// SettingForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleDimensions = new System.Drawing.SizeF(144F, 144F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(444, 682);
this.ClientSize = new System.Drawing.Size(666, 1069);
this.Controls.Add(this.BehaviorGroupBox);
this.Controls.Add(this.PortGroupBox);
this.Controls.Add(this.GlobalBypassIPsButton);
@@ -392,7 +439,7 @@
this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.Margin = new System.Windows.Forms.Padding(4, 6, 4, 6);
this.MaximizeBox = false;
this.Name = "SettingForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
@@ -442,5 +489,6 @@
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox STUN_ServerTextBox;
private System.Windows.Forms.TextBox STUN_ServerPortTextBox;
private System.Windows.Forms.CheckBox TUNTAPProxyDNSCheckBox;
}
}

View File

@@ -52,6 +52,7 @@ namespace Netch.Forms
TUNTAPNetmaskLabel.Text = Utils.i18N.Translate(TUNTAPNetmaskLabel.Text);
TUNTAPGatewayLabel.Text = Utils.i18N.Translate(TUNTAPGatewayLabel.Text);
TUNTAPUseCustomDNSCheckBox.Text = Utils.i18N.Translate(TUNTAPUseCustomDNSCheckBox.Text);
TUNTAPProxyDNSCheckBox.Text = Utils.i18N.Translate(TUNTAPProxyDNSCheckBox.Text);
GlobalBypassIPsButton.Text = Utils.i18N.Translate(GlobalBypassIPsButton.Text);
ControlButton.Text = Utils.i18N.Translate(ControlButton.Text);
@@ -70,6 +71,7 @@ namespace Netch.Forms
TUNTAPGatewayTextBox.Text = Global.Settings.TUNTAP.Gateway;
TUNTAPUseCustomDNSCheckBox.Checked = Global.Settings.TUNTAP.UseCustomDNS;
TUNTAPProxyDNSCheckBox.Checked = Global.Settings.TUNTAP.ProxyDNS;
BehaviorGroupBox.Text = Utils.i18N.Translate(BehaviorGroupBox.Text);
ExitWhenClosedCheckBox.Text = Utils.i18N.Translate(ExitWhenClosedCheckBox.Text);
@@ -320,10 +322,12 @@ namespace Netch.Forms
}
Global.Settings.TUNTAP.UseCustomDNS = TUNTAPUseCustomDNSCheckBox.Checked;
Global.Settings.TUNTAP.ProxyDNS = TUNTAPProxyDNSCheckBox.Checked;
Utils.Configuration.Save();
MessageBox.Show(Utils.i18N.Translate("Saved"), Utils.i18N.Translate("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
Close();
}
}
}

View File

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

View File

@@ -31,6 +31,11 @@ namespace Netch.Models
/// 使用自定义 DNS 设置
/// </summary>
public bool UseCustomDNS = false;
/// <summary>
/// 模式2下是否代理DNS
/// </summary>
public bool ProxyDNS = false;
}
/// <summary>
@@ -127,7 +132,7 @@ namespace Netch.Models
/// <summary>
/// 全局绕过 IP 列表
/// </summary>
public List<string> BypassIPs = new List<string>() { "10.0.0.0/8", "172.16.0.0/16", "192.168.0.0/24" };
public List<string> BypassIPs = new List<string>();
/// <summary>
/// 已保存的快捷配置

View File

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

View File

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

View File

@@ -26,6 +26,9 @@
"Starting netfilter2 Service": "正在启动netfilter2服务",
"Starting dns2tcp Service": "正在启动dns2tcp服务",
"SetupBypass": "设置绕行规则",
"Test failed": "测试失败",
"Starting update subscription": "正在更新订阅",
"Subscription updated": "订阅更新完毕",
"Server": "服务器",
"Import Servers From Clipboard": "从剪贴板导入服务器",
@@ -136,6 +139,7 @@
"Netmask": "子网掩码",
"Gateway": "网关",
"Use Custom DNS": "使用自定义 DNS",
"Proxy DNS in Mode 2": "在模式2下代理DNS",
"Behavior": "行为",
"Exit when closed": "关闭时退出",
"Stop when exited": "退出时停止",

View File

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

69
build.ps1 Normal file
View File

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

View File

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

2
modes

Submodule modes updated: 8d6f98d43e...b1366d48be