Compare commits

...

13 Commits
1.8.8 ... 1.9.0

Author SHA1 Message Date
ChsBuffer
d829e347d3 Bump version to 1.9.0 2021-09-21 10:30:04 +08:00
ChsBuffer
a01761d2e2 Bump version to 1.8.9 2021-09-20 20:35:28 +08:00
ChsBuffer
68d87e2ff2 Remove Resolve Server Hostname setting 2021-09-20 20:34:23 +08:00
ChsBuffer
04d6933319 Rename TcpStatusLabel to HTTPStatusLabel 2021-09-20 19:08:01 +08:00
ChsBuffer
e46eef17d0 Create scripts\download\pcap2socks.ps1 2021-09-20 18:54:49 +08:00
ChsBuffer
d3c3958dab fix a typo 2021-09-20 18:20:59 +08:00
ChsBuffer
5ec8d38fd1 Fix build 2021-09-14 09:47:43 +08:00
ChsBuffer
2a8754ecfb Update build 2021-09-14 09:42:00 +08:00
ChsBuffer
cbc6822bff Refactor Cancel Connectivity Test 2021-09-14 08:49:37 +08:00
ChsBuffer
96bd7473ca Refactor AsyncLock 2021-09-14 08:41:30 +08:00
ChsBuffer
54b2b87dec Update Socks5ServerTestUtils.GetSimpleResult() 2021-09-12 03:18:35 +08:00
ChsBuffer
42baed8b8f Catch HttpConnectAsync's exception 2021-09-12 01:34:12 +08:00
ChsBuffer
f68aae6795 Update Setting.cs
- TUNTAP.UseCustomDNS true->false
- V2rayConfig.XrayCone false->true
- JsonIgnore Redirector.ChildProcessHandle
2021-09-12 01:32:48 +08:00
20 changed files with 144 additions and 124 deletions

View File

@@ -29,8 +29,8 @@ Global
{4B041B91-5790-4571-8C58-C63FFE4BC9F8}.Release|x64.Build.0 = Release|x64
{38240783-9AD2-4A01-84C1-1A3E5F05720F}.Debug|x64.ActiveCfg = Debug|x64
{38240783-9AD2-4A01-84C1-1A3E5F05720F}.Debug|x64.Build.0 = Debug|x64
{38240783-9AD2-4A01-84C1-1A3E5F05720F}.Release|x64.ActiveCfg = Release|Any CPU
{38240783-9AD2-4A01-84C1-1A3E5F05720F}.Release|x64.Build.0 = Release|Any CPU
{38240783-9AD2-4A01-84C1-1A3E5F05720F}.Release|x64.ActiveCfg = Release|x64
{38240783-9AD2-4A01-84C1-1A3E5F05720F}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@@ -28,13 +28,17 @@ namespace Netch.Controllers
public static ModeFeature ModeFeatures { get; private set; }
private static readonly AsyncSemaphore Lock = new(1);
public static async Task StartAsync(Server server, Mode mode)
{
using var _ = await Lock.EnterAsync();
Log.Information("Start MainController: {Server} {Mode}", $"{server.Type}", $"[{(int)mode.Type}]{mode.Remark}");
if (await DnsUtils.LookupAsync(server.Hostname) == null)
throw new MessageException(i18N.Translate("Lookup Server hostname failed"));
// TODO Disable NAT Type Test setting
// cache STUN Server ip to prevent "Wrong STUN Server"
DnsUtils.LookupAsync(Global.Settings.STUN_Server).Forget();
@@ -59,34 +63,28 @@ namespace Netch.Controllers
if (modePort != null)
TryReleaseTcpPort((ushort)modePort, portName);
switch (Server)
if (Server is Socks5Server socks5 && (!socks5.Auth() || ModeFeatures.HasFlag(ModeFeature.SupportSocks5Auth)))
{
case Socks5Server socks5 when !socks5.Auth():
case Socks5Server socks5B when socks5B.Auth() && ModeFeatures.HasFlag(ModeFeature.SupportSocks5Auth):
// Directly Start ModeController
Socks5Server = (Socks5Server)Server;
Global.MainForm.StatusText(i18N.TranslateFormat("Starting {0}", ModeController.Name));
await ModeController.StartAsync(Socks5Server, mode);
break;
default:
// Start Server Controller to get a local socks5 server
Log.Debug("Server Information: {Data}", $"{server.Type} {server.MaskedData()}");
ServerController = ServerHelper.GetUtilByTypeName(server.Type).GetController();
Global.MainForm.StatusText(i18N.TranslateFormat("Starting {0}", ServerController.Name));
TryReleaseTcpPort(ServerController.Socks5LocalPort(), "Socks5");
Socks5Server = await ServerController.StartAsync(server);
StatusPortInfoText.Socks5Port = Socks5Server.Port;
StatusPortInfoText.UpdateShareLan();
// Start Mode Controller
Global.MainForm.StatusText(i18N.TranslateFormat("Starting {0}", ModeController.Name));
await ModeController.StartAsync(Socks5Server, mode);
break;
Socks5Server = socks5;
}
else
{
// Start Server Controller to get a local socks5 server
Log.Debug("Server Information: {Data}", $"{server.Type} {server.MaskedData()}");
ServerController = ServerHelper.GetUtilByTypeName(server.Type).GetController();
Global.MainForm.StatusText(i18N.TranslateFormat("Starting {0}", ServerController.Name));
TryReleaseTcpPort(ServerController.Socks5LocalPort(), "Socks5");
Socks5Server = await ServerController.StartAsync(server);
StatusPortInfoText.Socks5Port = Socks5Server.Port;
StatusPortInfoText.UpdateShareLan();
}
// Start Mode Controller
Global.MainForm.StatusText(i18N.TranslateFormat("Starting {0}", ModeController.Name));
await ModeController.StartAsync(Socks5Server, mode);
}
catch (Exception e)
{
@@ -109,6 +107,14 @@ namespace Netch.Controllers
public static async Task StopAsync()
{
if (Lock.CurrentCount == 0)
{
(await Lock.EnterAsync()).Dispose();
return;
}
using var _ = await Lock.EnterAsync();
if (ServerController == null && ModeController == null)
return;
@@ -182,7 +188,20 @@ namespace Netch.Controllers
public static async Task<int?> HttpConnectAsync(CancellationToken ctx = default)
{
Debug.Assert(Socks5Server != null, nameof(Socks5Server) + " != null");
return await Socks5ServerTestUtils.HttpConnectAsync(Socks5Server, ctx);
try
{
return await Socks5ServerTestUtils.HttpConnectAsync(Socks5Server, ctx);
}
catch (OperationCanceledException)
{
// ignored
}
catch (Exception e)
{
Log.Warning(e, "Unhandled Socks5ServerTestUtils.HttpConnectAsync Exception");
}
return null;
}
}
}

View File

@@ -20,7 +20,7 @@ namespace Netch.Controllers
public const string Name = @"Netch";
public const string Copyright = @"Copyright © 2019 - 2021";
public const string AssemblyVersion = @"1.8.8";
public const string AssemblyVersion = @"1.9.0";
private const string Suffix = @"";
public static readonly string Version = $"{AssemblyVersion}{(string.IsNullOrEmpty(Suffix) ? "" : $"-{Suffix}")}";

View File

@@ -73,7 +73,7 @@
this.DownloadSpeedLabel = new System.Windows.Forms.ToolStripStatusLabel();
this.UploadSpeedLabel = new System.Windows.Forms.ToolStripStatusLabel();
this.blankToolStripStatusLabel = new System.Windows.Forms.ToolStripStatusLabel();
this.TcpStatusLabel = new System.Windows.Forms.ToolStripStatusLabel();
this.HttpStatusLabel = new System.Windows.Forms.ToolStripStatusLabel();
this.NatTypeStatusLabel = new System.Windows.Forms.ToolStripStatusLabel();
this.NatTypeStatusLightLabel = new System.Windows.Forms.ToolStripStatusLabel();
this.ControlButton = new System.Windows.Forms.Button();
@@ -522,7 +522,7 @@
this.DownloadSpeedLabel,
this.UploadSpeedLabel,
this.blankToolStripStatusLabel,
this.TcpStatusLabel,
this.HttpStatusLabel,
this.NatTypeStatusLabel,
this.NatTypeStatusLightLabel});
this.StatusStrip.Location = new System.Drawing.Point(0, 272);
@@ -565,14 +565,14 @@
this.blankToolStripStatusLabel.Size = new System.Drawing.Size(240, 17);
this.blankToolStripStatusLabel.Spring = true;
//
// TcpStatusLabel
// HttpStatusLabel
//
this.TcpStatusLabel.Name = "TcpStatusLabel";
this.TcpStatusLabel.Size = new System.Drawing.Size(33, 17);
this.TcpStatusLabel.Text = "TCP:";
this.TcpStatusLabel.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
this.TcpStatusLabel.Visible = false;
this.TcpStatusLabel.Click += new System.EventHandler(this.TcpStatusLabel_Click);
this.HttpStatusLabel.Name = "HttpStatusLabel";
this.HttpStatusLabel.Size = new System.Drawing.Size(41, 17);
this.HttpStatusLabel.Text = "HTTP:";
this.HttpStatusLabel.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
this.HttpStatusLabel.Visible = false;
this.HttpStatusLabel.Click += new System.EventHandler(this.TcpStatusLabel_Click);
//
// NatTypeStatusLabel
//
@@ -803,6 +803,6 @@
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
private System.Windows.Forms.ContainerControl ButtomControlContainerControl;
private System.Windows.Forms.ToolStripMenuItem ShowHideConsoleToolStripMenuItem;
private System.Windows.Forms.ToolStripStatusLabel TcpStatusLabel;
private System.Windows.Forms.ToolStripStatusLabel HttpStatusLabel;
}
}

View File

@@ -1058,6 +1058,8 @@ namespace Netch.Forms
private async Task StopCoreAsync()
{
State = State.Stopping;
_discoveryNatCts?.Cancel();
_httpConnectCts?.Cancel();
await MainController.StopAsync();
State = State.Stopped;
}
@@ -1082,9 +1084,10 @@ namespace Netch.Forms
}
text ??= i18N.Translate(StateExtension.GetStatusString(State));
StatusLabel.Text = i18N.Translate("Status", ": ") + text;
if (_state == State.Started)
StatusLabel.Text += StatusPortInfoText.Value;
text += StatusPortInfoText.Value;
StatusLabel.Text = i18N.Translate("Status", ": ") + text;
}
public void BandwidthState(bool state)
@@ -1123,9 +1126,9 @@ namespace Netch.Forms
private void ConnectivityStatusVisible(bool visible)
{
if (!visible)
TcpStatusLabel.Text = NatTypeStatusLabel.Text = "";
HttpStatusLabel.Text = NatTypeStatusLabel.Text = "";
TcpStatusLabel.Visible = NatTypeStatusLabel.Visible = NatTypeStatusLightLabel.Visible = visible;
HttpStatusLabel.Visible = NatTypeStatusLabel.Visible = NatTypeStatusLightLabel.Visible = visible;
}
/// <summary>
@@ -1164,19 +1167,20 @@ namespace Netch.Forms
await DiscoveryNatTypeAsync();
}
private CancellationTokenSource? _discoveryNatCts;
private async Task DiscoveryNatTypeAsync()
{
NatTypeStatusLabel.Enabled = false;
NatTypeStatusLabel.Text = i18N.Translate("Testing NAT Type");
UpdateNatTypeStatusLabelText("Testing NAT Type");
using var cts = new CancellationTokenSource();
cts.CancelAfter(TimeSpan.FromSeconds(5));
var discoveryNatTypeAsync = MainController.DiscoveryNatTypeAsync(cts.Token);
_discoveryNatCts = new CancellationTokenSource();
try
{
var res = await discoveryNatTypeAsync;
var res = await MainController.DiscoveryNatTypeAsync(_discoveryNatCts.Token);
if (_discoveryNatCts.IsCancellationRequested)
return;
if (!string.IsNullOrEmpty(res.PublicEnd))
{
@@ -1196,31 +1200,38 @@ namespace Netch.Forms
}
finally
{
_discoveryNatCts.Dispose();
_discoveryNatCts = null;
NatTypeStatusLabel.Enabled = true;
}
}
private CancellationTokenSource? _httpConnectCts;
private async Task HttpConnectAsync()
{
TcpStatusLabel.Enabled = false;
HttpStatusLabel.Enabled = false;
using var cts = new CancellationTokenSource();
cts.CancelAfter(TimeSpan.FromSeconds(5));
var httpConnectAsync = MainController.HttpConnectAsync(cts.Token);
_httpConnectCts = new CancellationTokenSource();
try
{
var httpRes = await httpConnectAsync;
if (httpRes != null)
TcpStatusLabel.Text = $"TCP{i18N.Translate(": ")}{httpRes}ms";
else
TcpStatusLabel.Text = $"TCP{i18N.Translate(": ", "Timeout")}";
var res = await MainController.HttpConnectAsync(_httpConnectCts.Token);
if (_httpConnectCts.IsCancellationRequested)
return;
TcpStatusLabel.Visible = true;
if (res != null)
HttpStatusLabel.Text = $"HTTP{i18N.Translate(": ")}{res}ms";
else
HttpStatusLabel.Text = $"HTTP{i18N.Translate(": ", "Timeout")}";
HttpStatusLabel.Visible = true;
}
finally
{
TcpStatusLabel.Enabled = true;
_httpConnectCts.Dispose();
_httpConnectCts = null;
HttpStatusLabel.Enabled = true;
}
}

View File

@@ -39,7 +39,6 @@ namespace Netch.Forms
this.HTTPPortLabel = new System.Windows.Forms.Label();
this.HTTPPortTextBox = new System.Windows.Forms.TextBox();
this.AllowDevicesCheckBox = new System.Windows.Forms.CheckBox();
this.ResolveServerHostnameCheckBox = new System.Windows.Forms.CheckBox();
this.ServerPingTypeLabel = new System.Windows.Forms.Label();
this.ICMPingRadioBtn = new System.Windows.Forms.RadioButton();
this.TCPingRadioBtn = new System.Windows.Forms.RadioButton();
@@ -144,7 +143,6 @@ namespace Netch.Forms
//
this.GeneralTabPage.BackColor = System.Drawing.SystemColors.ButtonFace;
this.GeneralTabPage.Controls.Add(this.PortGroupBox);
this.GeneralTabPage.Controls.Add(this.ResolveServerHostnameCheckBox);
this.GeneralTabPage.Controls.Add(this.ServerPingTypeLabel);
this.GeneralTabPage.Controls.Add(this.ICMPingRadioBtn);
this.GeneralTabPage.Controls.Add(this.TCPingRadioBtn);
@@ -224,20 +222,10 @@ namespace Netch.Forms
this.AllowDevicesCheckBox.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.AllowDevicesCheckBox.UseVisualStyleBackColor = true;
//
// ResolveServerHostnameCheckBox
//
this.ResolveServerHostnameCheckBox.AutoSize = true;
this.ResolveServerHostnameCheckBox.Location = new System.Drawing.Point(267, 15);
this.ResolveServerHostnameCheckBox.Name = "ResolveServerHostnameCheckBox";
this.ResolveServerHostnameCheckBox.Size = new System.Drawing.Size(176, 21);
this.ResolveServerHostnameCheckBox.TabIndex = 1;
this.ResolveServerHostnameCheckBox.Text = "Resolve Server Hostname";
this.ResolveServerHostnameCheckBox.UseVisualStyleBackColor = true;
//
// ServerPingTypeLabel
//
this.ServerPingTypeLabel.AutoSize = true;
this.ServerPingTypeLabel.Location = new System.Drawing.Point(267, 44);
this.ServerPingTypeLabel.Location = new System.Drawing.Point(267, 15);
this.ServerPingTypeLabel.Name = "ServerPingTypeLabel";
this.ServerPingTypeLabel.Size = new System.Drawing.Size(86, 17);
this.ServerPingTypeLabel.TabIndex = 2;
@@ -246,7 +234,7 @@ namespace Netch.Forms
// ICMPingRadioBtn
//
this.ICMPingRadioBtn.AutoSize = true;
this.ICMPingRadioBtn.Location = new System.Drawing.Point(268, 63);
this.ICMPingRadioBtn.Location = new System.Drawing.Point(268, 34);
this.ICMPingRadioBtn.Name = "ICMPingRadioBtn";
this.ICMPingRadioBtn.Size = new System.Drawing.Size(75, 21);
this.ICMPingRadioBtn.TabIndex = 3;
@@ -257,7 +245,7 @@ namespace Netch.Forms
// TCPingRadioBtn
//
this.TCPingRadioBtn.AutoSize = true;
this.TCPingRadioBtn.Location = new System.Drawing.Point(366, 64);
this.TCPingRadioBtn.Location = new System.Drawing.Point(366, 35);
this.TCPingRadioBtn.Name = "TCPingRadioBtn";
this.TCPingRadioBtn.Size = new System.Drawing.Size(66, 21);
this.TCPingRadioBtn.TabIndex = 4;
@@ -1012,7 +1000,6 @@ namespace Netch.Forms
private System.Windows.Forms.TextBox HTTPPortTextBox;
private System.Windows.Forms.Label Socks5PortLabel;
private System.Windows.Forms.TextBox Socks5PortTextBox;
private System.Windows.Forms.CheckBox ResolveServerHostnameCheckBox;
private System.Windows.Forms.GroupBox WinTUNGroupBox;
private System.Windows.Forms.CheckBox ProxyDNSCheckBox;
private System.Windows.Forms.CheckBox UseCustomDNSCheckBox;

View File

@@ -40,8 +40,6 @@ namespace Netch.Forms
c => Global.Settings.LocalAddress = AllowDevicesCheckBox.Checked ? "0.0.0.0" : "127.0.0.1",
Global.Settings.LocalAddress switch { "127.0.0.1" => false, "0.0.0.0" => true, _ => false });
BindCheckBox(ResolveServerHostnameCheckBox, c => Global.Settings.ResolveServerHostname = c, Global.Settings.ResolveServerHostname);
BindRadioBox(ICMPingRadioBtn, _ => { }, !Global.Settings.ServerTCPing);
BindRadioBox(TCPingRadioBtn, c => Global.Settings.ServerTCPing = c, Global.Settings.ServerTCPing);

View File

@@ -111,7 +111,8 @@ namespace Netch.Models
{
public static async Task<string> AutoResolveHostnameAsync(this Server server, AddressFamily inet = AddressFamily.Unspecified)
{
return Global.Settings.ResolveServerHostname ? (await DnsUtils.LookupAsync(server.Hostname, inet))!.ToString() : server.Hostname;
// ! MainController cached
return (await DnsUtils.LookupAsync(server.Hostname, inet))!.ToString();
}
public static bool IsInGroup(this Server server)

View File

@@ -37,7 +37,7 @@ namespace Netch.Models
/// <summary>
/// 使用自定义 DNS 设置
/// </summary>
public bool UseCustomDNS { get; set; } = true;
public bool UseCustomDNS { get; set; } = false;
/// <summary>
/// 全局绕过 IP 列表
@@ -72,7 +72,7 @@ namespace Netch.Models
public bool V2rayNShareLink { get; set; } = true;
public bool XrayCone { get; set; } = false;
public bool XrayCone { get; set; } = true;
}
public class AioDNSConfig
@@ -109,6 +109,7 @@ namespace Netch.Models
/// <summary>
/// 是否代理子进程
/// </summary>
[JsonIgnore]
public bool ChildProcessHandle { get; set; } = false;
}
@@ -191,11 +192,6 @@ namespace Netch.Models
/// </summary>
public int RequestTimeout { get; set; } = 10000;
/// <summary>
/// 解析服务器主机名
/// </summary>
public bool ResolveServerHostname { get; set; } = true;
/// <summary>
/// 是否开机启动软件
/// </summary>

View File

@@ -130,7 +130,7 @@ namespace Netch
if (frameworkName.Version.Major != Environment.Version.Major)
{
Log.Information("CLR: {OSVersion}", Environment.Version);
Log.Information("CLR: {Version}", Environment.Version);
Flags.NoSupport = true;
if(!Global.Settings.NoSupportDialog)
MessageBoxX.Show(i18N.TranslateFormat("{0} won't get developers' support, Please do not report any issues or seek help from developers.", "CLR " + Environment.Version), LogLevel.WARNING);

View File

@@ -103,6 +103,7 @@
"Please select a mode first": "请先选择一个模式",
"Please enter a profile name first": "请先为该配置设置一个名称",
"No saved profile here. Save a profile first by Ctrl+Click on the button": "当前按钮下没有保存配置,请先使用 CTRL + 左键 点击该按钮保存一个配置",
"Lookup Server hostname failed": "解析服务器主机名失败",
"Used": "已使用",
"Testing": "测试中",
@@ -154,14 +155,12 @@
"Handle process's DNS Hijack": "被代理进程 DNS 劫持",
"Child Process Handle": "子进程代理",
"ICMP Delay(ms)": "ICMP 延迟(毫秒)",
"Redirector built-in Shadowsocks support": "Redirector 内建 Shadowsocks 支持",
"Profile Count": "快捷配置数量",
"Delay test after start(sec)": "启动后延迟测试(秒)",
"Ping Protocol": "延迟测试协议",
"Detection Tick(sec)": "检测心跳(秒)",
"STUN Server": "STUN 服务器",
"Language": "语言",
"Resolve Server Hostname": "解析服务器主机名",
"FullCone Support (Required Server Xray-core v1.3.0+)": "FullCone 支持(需服务端 Xray-core v1.3.0+",
"Disable Support Warning": "停用支持警告",

View File

@@ -41,7 +41,7 @@ namespace Netch.Servers
},
ssl = new TrojanSSL
{
sni = server.Host.ValueOrDefault() ?? (Global.Settings.ResolveServerHostname ? server.Hostname : "")
sni = server.Host.ValueOrDefault() ?? server.Hostname
}
};

View File

@@ -1,10 +1,9 @@
using System;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Timers;
using Microsoft.VisualStudio.Threading;
using Netch.Models;
using Timer = System.Timers.Timer;
namespace Netch.Utils
{
@@ -12,9 +11,9 @@ namespace Netch.Utils
{
private static readonly Timer Timer;
private static readonly SemaphoreSlim Lock = new(1, 1);
private static readonly AsyncSemaphore Lock = new(1);
private static readonly SemaphoreSlim PoolLock = new(16, 16);
private static readonly AsyncSemaphore PoolLock = new(16);
public static readonly NumberRange Range = new(0, int.MaxValue / 1000);
@@ -47,28 +46,21 @@ namespace Netch.Utils
if (Lock.CurrentCount == 0)
{
if (waitFinish)
{
await Lock.WaitAsync();
Lock.Release();
}
(await Lock.EnterAsync()).Dispose();
return;
}
await Lock.WaitAsync();
using var _ = await Lock.EnterAsync();
try
{
var tasks = Global.Settings.Server.Select(async s =>
{
await PoolLock.WaitAsync();
try
using (await PoolLock.EnterAsync())
{
await s.PingAsync();
}
finally
{
PoolLock.Release();
}
});
await Task.WhenAll(tasks);
@@ -77,10 +69,6 @@ namespace Netch.Utils
{
// ignored
}
finally
{
Lock.Release();
}
}
public static void UpdateTick(bool performTestAtOnce = false)

View File

@@ -66,6 +66,8 @@ namespace Netch.Utils
{
switch (res.BindingTestResult, res.MappingBehavior, res.FilteringBehavior)
{
case (BindingTestResult.Fail, _, _):
return "NoUDP";
case (not BindingTestResult.Success, _, _):
return res.BindingTestResult.ToString();
case (_, MappingBehavior.Direct or MappingBehavior.EndpointIndependent, FilteringBehavior.EndpointIndependent):
@@ -74,6 +76,8 @@ namespace Netch.Utils
return "2";
case (_, MappingBehavior.AddressDependent or MappingBehavior.AddressAndPortDependent, _):
return "3";
case (_, MappingBehavior.Fail, _):
return MappingBehavior.Fail.ToString();
default:
return res.FilteringBehavior.ToString();
}

View File

@@ -13,14 +13,14 @@ namespace Netch.Utils
var mc = new ManagementClass("Win32_SystemDriver");
foreach (var obj in mc.GetInstances().Cast<ManagementObject>())
{
if (!(bool) obj["Started"])
if (!(bool)obj["Started"])
continue;
var path = obj["PathName"].ToString();
if (path == null)
continue;
var vendorExclude = new[] {"microsoft", "intel", "amd", "nvidia", "realtek"};
var vendorExclude = new[] { "microsoft", "intel", "amd", "nvidia", "realtek" };
var vendorName = FileVersionInfo.GetVersionInfo(path).LegalCopyright ?? string.Empty;
if (!allDriver && vendorExclude.Any(s => vendorName.Contains(s, StringComparison.OrdinalIgnoreCase)))
continue;
@@ -32,6 +32,7 @@ namespace Netch.Utils
public static IEnumerable<string> Processes(bool mask)
{
var hashset = new HashSet<string>();
var windowsFolder = Environment.GetFolderPath(Environment.SpecialFolder.Windows);
foreach (var process in Process.GetProcesses())
{
try
@@ -39,8 +40,10 @@ namespace Netch.Utils
if (process.Id is 0 or 4)
continue;
if (process.MainModule!.FileName!.StartsWith(Environment.GetFolderPath(Environment.SpecialFolder.Windows), StringComparison.OrdinalIgnoreCase))
// ! NT Kernel & System
if (process.MainModule!.FileName!.StartsWith(windowsFolder, StringComparison.OrdinalIgnoreCase))
continue;
var path = process.MainModule.FileName;
if (mask)

View File

@@ -22,7 +22,9 @@ param (
$PublishSingleFile = $True
)
# .\scripts\download.ps1 $OutputPath
Remove-Item -Recurse -Force $OutputPath -Confirm:$false -ErrorAction Ignore
.\scripts\download.ps1 $OutputPath
# if ( -Not $? ) {
# Exit 1

View File

@@ -20,9 +20,9 @@ New-Item -ItemType Directory -Name bin | Out-Null
New-Item -ItemType Directory -Name mode | Out-Null
New-Item -ItemType Directory -Name i18n | Out-Null
Copy-Item -Recurse -Force .\netchdata-master\* .\bin
Copy-Item -Recurse -Force .\netchdata-master\* .\bin -Exclude @('tap2socks.bin')
Copy-Item -Recurse -Force .\netchmode-master\mode\* .\mode
Copy-Item -Recurse -Force .\netchi18n-master\i18n\* .\i18n
Copy-Item -Recurse -Force .\netchi18n-master\i18n\* .\i18n
Remove-Item -Recurse -Force netchdata-master
Remove-Item -Recurse -Force netchmode-master
@@ -31,9 +31,10 @@ Remove-Item -Force data.zip
Remove-Item -Force mode.zip
Remove-Item -Force i18n.zip
..\scripts\download\aiodns.ps1 -OutputPath bin
..\scripts\download\cloak.ps1 -OutputPath bin
..\scripts\download\xray-core.ps1 -OutputPath bin
#..\scripts\download\aiodns.ps1 -OutputPath bin
..\scripts\download\cloak.ps1 -OutputPath bin
..\scripts\download\xray-core.ps1 -OutputPath bin
..\scripts\download\pcap2socks.ps1 -OutputPath bin
Get-Item *
Set-Location $last

View File

@@ -1,5 +1,5 @@
param([string]$OutputPath)
$address="https://github.com/cbeuw/Cloak/releases/download/v2.5.4/ck-client-windows-amd64-v2.5.4.exe"
$address="https://github.com/cbeuw/Cloak/releases/download/v2.5.5/ck-client-windows-amd64-v2.5.5.exe"
Invoke-WebRequest -Uri $address -OutFile ck-client.exe

View File

@@ -0,0 +1,11 @@
param([string]$OutputPath)
$address="https://github.com/zhxie/pcap2socks/releases/download/v0.6.2/pcap2socks-v0.6.2-windows-amd64.zip"
Invoke-WebRequest -Uri $address -OutFile pcap2socks.zip
Expand-Archive -Force -Path pcap2socks.zip -DestinationPath pcap2socks
Move-Item -Force pcap2socks\pcap2socks.exe $OutputPath
Remove-Item -Recurse -Force pcap2socks
Remove-Item -Recurse -Force pcap2socks.zip
exit 0

View File

@@ -1,12 +1,12 @@
param([string]$OutputPath)
$address="https://github.com/XTLS/Xray-core/releases/download/v1.4.2/Xray-windows-64.zip"
$address="https://github.com/XTLS/Xray-core/releases/download/v1.4.3/Xray-windows-64.zip"
Invoke-WebRequest -Uri $address -OutFile xray-core.zip
Expand-Archive -Force -Path xray-core.zip -DestinationPath xray-core
Move-Item -Force xray-core\xray.exe $OutputPath
Move-Item -Force xray-core\geoip.dat $OutputPath
Move-Item -Force xray-core\geosite.dat $OutputPath
# Move-Item -Force xray-core\geoip.dat $OutputPath
# Move-Item -Force xray-core\geosite.dat $OutputPath
Remove-Item -Recurse -Force xray-core
Remove-Item -Recurse -Force xray-core.zip