mirror of
https://github.com/netchx/netch.git
synced 2026-05-11 23:45:06 +08:00
Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d829e347d3 | ||
|
|
a01761d2e2 | ||
|
|
68d87e2ff2 | ||
|
|
04d6933319 | ||
|
|
e46eef17d0 | ||
|
|
d3c3958dab | ||
|
|
5ec8d38fd1 | ||
|
|
2a8754ecfb | ||
|
|
cbc6822bff | ||
|
|
96bd7473ca | ||
|
|
54b2b87dec | ||
|
|
42baed8b8f | ||
|
|
f68aae6795 |
@@ -29,8 +29,8 @@ Global
|
|||||||
{4B041B91-5790-4571-8C58-C63FFE4BC9F8}.Release|x64.Build.0 = Release|x64
|
{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.ActiveCfg = Debug|x64
|
||||||
{38240783-9AD2-4A01-84C1-1A3E5F05720F}.Debug|x64.Build.0 = 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.ActiveCfg = Release|x64
|
||||||
{38240783-9AD2-4A01-84C1-1A3E5F05720F}.Release|x64.Build.0 = Release|Any CPU
|
{38240783-9AD2-4A01-84C1-1A3E5F05720F}.Release|x64.Build.0 = Release|x64
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|||||||
@@ -28,13 +28,17 @@ namespace Netch.Controllers
|
|||||||
|
|
||||||
public static ModeFeature ModeFeatures { get; private set; }
|
public static ModeFeature ModeFeatures { get; private set; }
|
||||||
|
|
||||||
|
private static readonly AsyncSemaphore Lock = new(1);
|
||||||
|
|
||||||
public static async Task StartAsync(Server server, Mode mode)
|
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}");
|
Log.Information("Start MainController: {Server} {Mode}", $"{server.Type}", $"[{(int)mode.Type}]{mode.Remark}");
|
||||||
|
|
||||||
if (await DnsUtils.LookupAsync(server.Hostname) == null)
|
if (await DnsUtils.LookupAsync(server.Hostname) == null)
|
||||||
throw new MessageException(i18N.Translate("Lookup Server hostname failed"));
|
throw new MessageException(i18N.Translate("Lookup Server hostname failed"));
|
||||||
|
|
||||||
// TODO Disable NAT Type Test setting
|
// TODO Disable NAT Type Test setting
|
||||||
// cache STUN Server ip to prevent "Wrong STUN Server"
|
// cache STUN Server ip to prevent "Wrong STUN Server"
|
||||||
DnsUtils.LookupAsync(Global.Settings.STUN_Server).Forget();
|
DnsUtils.LookupAsync(Global.Settings.STUN_Server).Forget();
|
||||||
@@ -59,34 +63,28 @@ namespace Netch.Controllers
|
|||||||
if (modePort != null)
|
if (modePort != null)
|
||||||
TryReleaseTcpPort((ushort)modePort, portName);
|
TryReleaseTcpPort((ushort)modePort, portName);
|
||||||
|
|
||||||
|
if (Server is Socks5Server socks5 && (!socks5.Auth() || ModeFeatures.HasFlag(ModeFeature.SupportSocks5Auth)))
|
||||||
switch (Server)
|
|
||||||
{
|
{
|
||||||
case Socks5Server socks5 when !socks5.Auth():
|
Socks5Server = socks5;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
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)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@@ -109,6 +107,14 @@ namespace Netch.Controllers
|
|||||||
|
|
||||||
public static async Task StopAsync()
|
public static async Task StopAsync()
|
||||||
{
|
{
|
||||||
|
if (Lock.CurrentCount == 0)
|
||||||
|
{
|
||||||
|
(await Lock.EnterAsync()).Dispose();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
using var _ = await Lock.EnterAsync();
|
||||||
|
|
||||||
if (ServerController == null && ModeController == null)
|
if (ServerController == null && ModeController == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -182,7 +188,20 @@ namespace Netch.Controllers
|
|||||||
public static async Task<int?> HttpConnectAsync(CancellationToken ctx = default)
|
public static async Task<int?> HttpConnectAsync(CancellationToken ctx = default)
|
||||||
{
|
{
|
||||||
Debug.Assert(Socks5Server != null, nameof(Socks5Server) + " != null");
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -20,7 +20,7 @@ namespace Netch.Controllers
|
|||||||
public const string Name = @"Netch";
|
public const string Name = @"Netch";
|
||||||
public const string Copyright = @"Copyright © 2019 - 2021";
|
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 = @"";
|
private const string Suffix = @"";
|
||||||
|
|
||||||
public static readonly string Version = $"{AssemblyVersion}{(string.IsNullOrEmpty(Suffix) ? "" : $"-{Suffix}")}";
|
public static readonly string Version = $"{AssemblyVersion}{(string.IsNullOrEmpty(Suffix) ? "" : $"-{Suffix}")}";
|
||||||
|
|||||||
20
Netch/Forms/MainForm.Designer.cs
generated
20
Netch/Forms/MainForm.Designer.cs
generated
@@ -73,7 +73,7 @@
|
|||||||
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.blankToolStripStatusLabel = 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.NatTypeStatusLabel = new System.Windows.Forms.ToolStripStatusLabel();
|
||||||
this.NatTypeStatusLightLabel = new System.Windows.Forms.ToolStripStatusLabel();
|
this.NatTypeStatusLightLabel = new System.Windows.Forms.ToolStripStatusLabel();
|
||||||
this.ControlButton = new System.Windows.Forms.Button();
|
this.ControlButton = new System.Windows.Forms.Button();
|
||||||
@@ -522,7 +522,7 @@
|
|||||||
this.DownloadSpeedLabel,
|
this.DownloadSpeedLabel,
|
||||||
this.UploadSpeedLabel,
|
this.UploadSpeedLabel,
|
||||||
this.blankToolStripStatusLabel,
|
this.blankToolStripStatusLabel,
|
||||||
this.TcpStatusLabel,
|
this.HttpStatusLabel,
|
||||||
this.NatTypeStatusLabel,
|
this.NatTypeStatusLabel,
|
||||||
this.NatTypeStatusLightLabel});
|
this.NatTypeStatusLightLabel});
|
||||||
this.StatusStrip.Location = new System.Drawing.Point(0, 272);
|
this.StatusStrip.Location = new System.Drawing.Point(0, 272);
|
||||||
@@ -565,14 +565,14 @@
|
|||||||
this.blankToolStripStatusLabel.Size = new System.Drawing.Size(240, 17);
|
this.blankToolStripStatusLabel.Size = new System.Drawing.Size(240, 17);
|
||||||
this.blankToolStripStatusLabel.Spring = true;
|
this.blankToolStripStatusLabel.Spring = true;
|
||||||
//
|
//
|
||||||
// TcpStatusLabel
|
// HttpStatusLabel
|
||||||
//
|
//
|
||||||
this.TcpStatusLabel.Name = "TcpStatusLabel";
|
this.HttpStatusLabel.Name = "HttpStatusLabel";
|
||||||
this.TcpStatusLabel.Size = new System.Drawing.Size(33, 17);
|
this.HttpStatusLabel.Size = new System.Drawing.Size(41, 17);
|
||||||
this.TcpStatusLabel.Text = "TCP:";
|
this.HttpStatusLabel.Text = "HTTP:";
|
||||||
this.TcpStatusLabel.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
|
this.HttpStatusLabel.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
|
||||||
this.TcpStatusLabel.Visible = false;
|
this.HttpStatusLabel.Visible = false;
|
||||||
this.TcpStatusLabel.Click += new System.EventHandler(this.TcpStatusLabel_Click);
|
this.HttpStatusLabel.Click += new System.EventHandler(this.TcpStatusLabel_Click);
|
||||||
//
|
//
|
||||||
// NatTypeStatusLabel
|
// NatTypeStatusLabel
|
||||||
//
|
//
|
||||||
@@ -803,6 +803,6 @@
|
|||||||
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
|
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
|
||||||
private System.Windows.Forms.ContainerControl ButtomControlContainerControl;
|
private System.Windows.Forms.ContainerControl ButtomControlContainerControl;
|
||||||
private System.Windows.Forms.ToolStripMenuItem ShowHideConsoleToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem ShowHideConsoleToolStripMenuItem;
|
||||||
private System.Windows.Forms.ToolStripStatusLabel TcpStatusLabel;
|
private System.Windows.Forms.ToolStripStatusLabel HttpStatusLabel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1058,6 +1058,8 @@ namespace Netch.Forms
|
|||||||
private async Task StopCoreAsync()
|
private async Task StopCoreAsync()
|
||||||
{
|
{
|
||||||
State = State.Stopping;
|
State = State.Stopping;
|
||||||
|
_discoveryNatCts?.Cancel();
|
||||||
|
_httpConnectCts?.Cancel();
|
||||||
await MainController.StopAsync();
|
await MainController.StopAsync();
|
||||||
State = State.Stopped;
|
State = State.Stopped;
|
||||||
}
|
}
|
||||||
@@ -1082,9 +1084,10 @@ namespace Netch.Forms
|
|||||||
}
|
}
|
||||||
|
|
||||||
text ??= i18N.Translate(StateExtension.GetStatusString(State));
|
text ??= i18N.Translate(StateExtension.GetStatusString(State));
|
||||||
StatusLabel.Text = i18N.Translate("Status", ": ") + text;
|
|
||||||
if (_state == State.Started)
|
if (_state == State.Started)
|
||||||
StatusLabel.Text += StatusPortInfoText.Value;
|
text += StatusPortInfoText.Value;
|
||||||
|
|
||||||
|
StatusLabel.Text = i18N.Translate("Status", ": ") + text;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void BandwidthState(bool state)
|
public void BandwidthState(bool state)
|
||||||
@@ -1123,9 +1126,9 @@ namespace Netch.Forms
|
|||||||
private void ConnectivityStatusVisible(bool visible)
|
private void ConnectivityStatusVisible(bool visible)
|
||||||
{
|
{
|
||||||
if (!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>
|
/// <summary>
|
||||||
@@ -1164,19 +1167,20 @@ namespace Netch.Forms
|
|||||||
await DiscoveryNatTypeAsync();
|
await DiscoveryNatTypeAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private CancellationTokenSource? _discoveryNatCts;
|
||||||
|
|
||||||
private async Task DiscoveryNatTypeAsync()
|
private async Task DiscoveryNatTypeAsync()
|
||||||
{
|
{
|
||||||
NatTypeStatusLabel.Enabled = false;
|
NatTypeStatusLabel.Enabled = false;
|
||||||
NatTypeStatusLabel.Text = i18N.Translate("Testing NAT Type");
|
UpdateNatTypeStatusLabelText("Testing NAT Type");
|
||||||
|
|
||||||
using var cts = new CancellationTokenSource();
|
_discoveryNatCts = new CancellationTokenSource();
|
||||||
cts.CancelAfter(TimeSpan.FromSeconds(5));
|
|
||||||
|
|
||||||
var discoveryNatTypeAsync = MainController.DiscoveryNatTypeAsync(cts.Token);
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var res = await discoveryNatTypeAsync;
|
var res = await MainController.DiscoveryNatTypeAsync(_discoveryNatCts.Token);
|
||||||
|
if (_discoveryNatCts.IsCancellationRequested)
|
||||||
|
return;
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(res.PublicEnd))
|
if (!string.IsNullOrEmpty(res.PublicEnd))
|
||||||
{
|
{
|
||||||
@@ -1196,31 +1200,38 @@ namespace Netch.Forms
|
|||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
_discoveryNatCts.Dispose();
|
||||||
|
_discoveryNatCts = null;
|
||||||
NatTypeStatusLabel.Enabled = true;
|
NatTypeStatusLabel.Enabled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private CancellationTokenSource? _httpConnectCts;
|
||||||
|
|
||||||
private async Task HttpConnectAsync()
|
private async Task HttpConnectAsync()
|
||||||
{
|
{
|
||||||
TcpStatusLabel.Enabled = false;
|
HttpStatusLabel.Enabled = false;
|
||||||
|
|
||||||
using var cts = new CancellationTokenSource();
|
_httpConnectCts = new CancellationTokenSource();
|
||||||
cts.CancelAfter(TimeSpan.FromSeconds(5));
|
|
||||||
var httpConnectAsync = MainController.HttpConnectAsync(cts.Token);
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var httpRes = await httpConnectAsync;
|
var res = await MainController.HttpConnectAsync(_httpConnectCts.Token);
|
||||||
if (httpRes != null)
|
if (_httpConnectCts.IsCancellationRequested)
|
||||||
TcpStatusLabel.Text = $"TCP{i18N.Translate(": ")}{httpRes}ms";
|
return;
|
||||||
else
|
|
||||||
TcpStatusLabel.Text = $"TCP{i18N.Translate(": ", "Timeout")}";
|
|
||||||
|
|
||||||
TcpStatusLabel.Visible = true;
|
if (res != null)
|
||||||
|
HttpStatusLabel.Text = $"HTTP{i18N.Translate(": ")}{res}ms";
|
||||||
|
else
|
||||||
|
HttpStatusLabel.Text = $"HTTP{i18N.Translate(": ", "Timeout")}";
|
||||||
|
|
||||||
|
HttpStatusLabel.Visible = true;
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
TcpStatusLabel.Enabled = true;
|
_httpConnectCts.Dispose();
|
||||||
|
_httpConnectCts = null;
|
||||||
|
HttpStatusLabel.Enabled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
19
Netch/Forms/SettingForm.Designer.cs
generated
19
Netch/Forms/SettingForm.Designer.cs
generated
@@ -39,7 +39,6 @@ namespace Netch.Forms
|
|||||||
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.AllowDevicesCheckBox = new System.Windows.Forms.CheckBox();
|
this.AllowDevicesCheckBox = new System.Windows.Forms.CheckBox();
|
||||||
this.ResolveServerHostnameCheckBox = new System.Windows.Forms.CheckBox();
|
|
||||||
this.ServerPingTypeLabel = new System.Windows.Forms.Label();
|
this.ServerPingTypeLabel = new System.Windows.Forms.Label();
|
||||||
this.ICMPingRadioBtn = new System.Windows.Forms.RadioButton();
|
this.ICMPingRadioBtn = new System.Windows.Forms.RadioButton();
|
||||||
this.TCPingRadioBtn = 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.BackColor = System.Drawing.SystemColors.ButtonFace;
|
||||||
this.GeneralTabPage.Controls.Add(this.PortGroupBox);
|
this.GeneralTabPage.Controls.Add(this.PortGroupBox);
|
||||||
this.GeneralTabPage.Controls.Add(this.ResolveServerHostnameCheckBox);
|
|
||||||
this.GeneralTabPage.Controls.Add(this.ServerPingTypeLabel);
|
this.GeneralTabPage.Controls.Add(this.ServerPingTypeLabel);
|
||||||
this.GeneralTabPage.Controls.Add(this.ICMPingRadioBtn);
|
this.GeneralTabPage.Controls.Add(this.ICMPingRadioBtn);
|
||||||
this.GeneralTabPage.Controls.Add(this.TCPingRadioBtn);
|
this.GeneralTabPage.Controls.Add(this.TCPingRadioBtn);
|
||||||
@@ -224,20 +222,10 @@ namespace Netch.Forms
|
|||||||
this.AllowDevicesCheckBox.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
this.AllowDevicesCheckBox.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||||
this.AllowDevicesCheckBox.UseVisualStyleBackColor = true;
|
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
|
// ServerPingTypeLabel
|
||||||
//
|
//
|
||||||
this.ServerPingTypeLabel.AutoSize = true;
|
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.Name = "ServerPingTypeLabel";
|
||||||
this.ServerPingTypeLabel.Size = new System.Drawing.Size(86, 17);
|
this.ServerPingTypeLabel.Size = new System.Drawing.Size(86, 17);
|
||||||
this.ServerPingTypeLabel.TabIndex = 2;
|
this.ServerPingTypeLabel.TabIndex = 2;
|
||||||
@@ -246,7 +234,7 @@ namespace Netch.Forms
|
|||||||
// ICMPingRadioBtn
|
// ICMPingRadioBtn
|
||||||
//
|
//
|
||||||
this.ICMPingRadioBtn.AutoSize = true;
|
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.Name = "ICMPingRadioBtn";
|
||||||
this.ICMPingRadioBtn.Size = new System.Drawing.Size(75, 21);
|
this.ICMPingRadioBtn.Size = new System.Drawing.Size(75, 21);
|
||||||
this.ICMPingRadioBtn.TabIndex = 3;
|
this.ICMPingRadioBtn.TabIndex = 3;
|
||||||
@@ -257,7 +245,7 @@ namespace Netch.Forms
|
|||||||
// TCPingRadioBtn
|
// TCPingRadioBtn
|
||||||
//
|
//
|
||||||
this.TCPingRadioBtn.AutoSize = true;
|
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.Name = "TCPingRadioBtn";
|
||||||
this.TCPingRadioBtn.Size = new System.Drawing.Size(66, 21);
|
this.TCPingRadioBtn.Size = new System.Drawing.Size(66, 21);
|
||||||
this.TCPingRadioBtn.TabIndex = 4;
|
this.TCPingRadioBtn.TabIndex = 4;
|
||||||
@@ -1012,7 +1000,6 @@ namespace Netch.Forms
|
|||||||
private System.Windows.Forms.TextBox HTTPPortTextBox;
|
private System.Windows.Forms.TextBox HTTPPortTextBox;
|
||||||
private System.Windows.Forms.Label Socks5PortLabel;
|
private System.Windows.Forms.Label Socks5PortLabel;
|
||||||
private System.Windows.Forms.TextBox Socks5PortTextBox;
|
private System.Windows.Forms.TextBox Socks5PortTextBox;
|
||||||
private System.Windows.Forms.CheckBox ResolveServerHostnameCheckBox;
|
|
||||||
private System.Windows.Forms.GroupBox WinTUNGroupBox;
|
private System.Windows.Forms.GroupBox WinTUNGroupBox;
|
||||||
private System.Windows.Forms.CheckBox ProxyDNSCheckBox;
|
private System.Windows.Forms.CheckBox ProxyDNSCheckBox;
|
||||||
private System.Windows.Forms.CheckBox UseCustomDNSCheckBox;
|
private System.Windows.Forms.CheckBox UseCustomDNSCheckBox;
|
||||||
|
|||||||
@@ -40,8 +40,6 @@ namespace Netch.Forms
|
|||||||
c => Global.Settings.LocalAddress = AllowDevicesCheckBox.Checked ? "0.0.0.0" : "127.0.0.1",
|
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 });
|
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(ICMPingRadioBtn, _ => { }, !Global.Settings.ServerTCPing);
|
||||||
|
|
||||||
BindRadioBox(TCPingRadioBtn, c => Global.Settings.ServerTCPing = c, Global.Settings.ServerTCPing);
|
BindRadioBox(TCPingRadioBtn, c => Global.Settings.ServerTCPing = c, Global.Settings.ServerTCPing);
|
||||||
|
|||||||
@@ -111,7 +111,8 @@ namespace Netch.Models
|
|||||||
{
|
{
|
||||||
public static async Task<string> AutoResolveHostnameAsync(this Server server, AddressFamily inet = AddressFamily.Unspecified)
|
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)
|
public static bool IsInGroup(this Server server)
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ namespace Netch.Models
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 使用自定义 DNS 设置
|
/// 使用自定义 DNS 设置
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool UseCustomDNS { get; set; } = true;
|
public bool UseCustomDNS { get; set; } = false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 全局绕过 IP 列表
|
/// 全局绕过 IP 列表
|
||||||
@@ -72,7 +72,7 @@ namespace Netch.Models
|
|||||||
|
|
||||||
public bool V2rayNShareLink { get; set; } = true;
|
public bool V2rayNShareLink { get; set; } = true;
|
||||||
|
|
||||||
public bool XrayCone { get; set; } = false;
|
public bool XrayCone { get; set; } = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class AioDNSConfig
|
public class AioDNSConfig
|
||||||
@@ -109,6 +109,7 @@ namespace Netch.Models
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 是否代理子进程
|
/// 是否代理子进程
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonIgnore]
|
||||||
public bool ChildProcessHandle { get; set; } = false;
|
public bool ChildProcessHandle { get; set; } = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -191,11 +192,6 @@ namespace Netch.Models
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public int RequestTimeout { get; set; } = 10000;
|
public int RequestTimeout { get; set; } = 10000;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 解析服务器主机名
|
|
||||||
/// </summary>
|
|
||||||
public bool ResolveServerHostname { get; set; } = true;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 是否开机启动软件
|
/// 是否开机启动软件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ namespace Netch
|
|||||||
|
|
||||||
if (frameworkName.Version.Major != Environment.Version.Major)
|
if (frameworkName.Version.Major != Environment.Version.Major)
|
||||||
{
|
{
|
||||||
Log.Information("CLR: {OSVersion}", Environment.Version);
|
Log.Information("CLR: {Version}", Environment.Version);
|
||||||
Flags.NoSupport = true;
|
Flags.NoSupport = true;
|
||||||
if(!Global.Settings.NoSupportDialog)
|
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);
|
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);
|
||||||
|
|||||||
@@ -103,6 +103,7 @@
|
|||||||
"Please select a mode first": "请先选择一个模式",
|
"Please select a mode first": "请先选择一个模式",
|
||||||
"Please enter a profile name first": "请先为该配置设置一个名称",
|
"Please enter a profile name first": "请先为该配置设置一个名称",
|
||||||
"No saved profile here. Save a profile first by Ctrl+Click on the button": "当前按钮下没有保存配置,请先使用 CTRL + 左键 点击该按钮保存一个配置",
|
"No saved profile here. Save a profile first by Ctrl+Click on the button": "当前按钮下没有保存配置,请先使用 CTRL + 左键 点击该按钮保存一个配置",
|
||||||
|
"Lookup Server hostname failed": "解析服务器主机名失败",
|
||||||
|
|
||||||
"Used": "已使用",
|
"Used": "已使用",
|
||||||
"Testing": "测试中",
|
"Testing": "测试中",
|
||||||
@@ -154,14 +155,12 @@
|
|||||||
"Handle process's DNS Hijack": "被代理进程 DNS 劫持",
|
"Handle process's DNS Hijack": "被代理进程 DNS 劫持",
|
||||||
"Child Process Handle": "子进程代理",
|
"Child Process Handle": "子进程代理",
|
||||||
"ICMP Delay(ms)": "ICMP 延迟(毫秒)",
|
"ICMP Delay(ms)": "ICMP 延迟(毫秒)",
|
||||||
"Redirector built-in Shadowsocks support": "Redirector 内建 Shadowsocks 支持",
|
|
||||||
"Profile Count": "快捷配置数量",
|
"Profile Count": "快捷配置数量",
|
||||||
"Delay test after start(sec)": "启动后延迟测试(秒)",
|
"Delay test after start(sec)": "启动后延迟测试(秒)",
|
||||||
"Ping Protocol": "延迟测试协议",
|
"Ping Protocol": "延迟测试协议",
|
||||||
"Detection Tick(sec)": "检测心跳(秒)",
|
"Detection Tick(sec)": "检测心跳(秒)",
|
||||||
"STUN Server": "STUN 服务器",
|
"STUN Server": "STUN 服务器",
|
||||||
"Language": "语言",
|
"Language": "语言",
|
||||||
"Resolve Server Hostname": "解析服务器主机名",
|
|
||||||
"FullCone Support (Required Server Xray-core v1.3.0+)": "FullCone 支持(需服务端 Xray-core v1.3.0+)",
|
"FullCone Support (Required Server Xray-core v1.3.0+)": "FullCone 支持(需服务端 Xray-core v1.3.0+)",
|
||||||
"Disable Support Warning": "停用支持警告",
|
"Disable Support Warning": "停用支持警告",
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ namespace Netch.Servers
|
|||||||
},
|
},
|
||||||
ssl = new TrojanSSL
|
ssl = new TrojanSSL
|
||||||
{
|
{
|
||||||
sni = server.Host.ValueOrDefault() ?? (Global.Settings.ResolveServerHostname ? server.Hostname : "")
|
sni = server.Host.ValueOrDefault() ?? server.Hostname
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.Timers;
|
||||||
using Microsoft.VisualStudio.Threading;
|
using Microsoft.VisualStudio.Threading;
|
||||||
using Netch.Models;
|
using Netch.Models;
|
||||||
using Timer = System.Timers.Timer;
|
|
||||||
|
|
||||||
namespace Netch.Utils
|
namespace Netch.Utils
|
||||||
{
|
{
|
||||||
@@ -12,9 +11,9 @@ namespace Netch.Utils
|
|||||||
{
|
{
|
||||||
private static readonly Timer Timer;
|
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);
|
public static readonly NumberRange Range = new(0, int.MaxValue / 1000);
|
||||||
|
|
||||||
@@ -47,28 +46,21 @@ namespace Netch.Utils
|
|||||||
if (Lock.CurrentCount == 0)
|
if (Lock.CurrentCount == 0)
|
||||||
{
|
{
|
||||||
if (waitFinish)
|
if (waitFinish)
|
||||||
{
|
(await Lock.EnterAsync()).Dispose();
|
||||||
await Lock.WaitAsync();
|
|
||||||
Lock.Release();
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await Lock.WaitAsync();
|
using var _ = await Lock.EnterAsync();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var tasks = Global.Settings.Server.Select(async s =>
|
var tasks = Global.Settings.Server.Select(async s =>
|
||||||
{
|
{
|
||||||
await PoolLock.WaitAsync();
|
using (await PoolLock.EnterAsync())
|
||||||
try
|
|
||||||
{
|
{
|
||||||
await s.PingAsync();
|
await s.PingAsync();
|
||||||
}
|
}
|
||||||
finally
|
|
||||||
{
|
|
||||||
PoolLock.Release();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
await Task.WhenAll(tasks);
|
await Task.WhenAll(tasks);
|
||||||
@@ -77,10 +69,6 @@ namespace Netch.Utils
|
|||||||
{
|
{
|
||||||
// ignored
|
// ignored
|
||||||
}
|
}
|
||||||
finally
|
|
||||||
{
|
|
||||||
Lock.Release();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void UpdateTick(bool performTestAtOnce = false)
|
public static void UpdateTick(bool performTestAtOnce = false)
|
||||||
|
|||||||
@@ -66,6 +66,8 @@ namespace Netch.Utils
|
|||||||
{
|
{
|
||||||
switch (res.BindingTestResult, res.MappingBehavior, res.FilteringBehavior)
|
switch (res.BindingTestResult, res.MappingBehavior, res.FilteringBehavior)
|
||||||
{
|
{
|
||||||
|
case (BindingTestResult.Fail, _, _):
|
||||||
|
return "NoUDP";
|
||||||
case (not BindingTestResult.Success, _, _):
|
case (not BindingTestResult.Success, _, _):
|
||||||
return res.BindingTestResult.ToString();
|
return res.BindingTestResult.ToString();
|
||||||
case (_, MappingBehavior.Direct or MappingBehavior.EndpointIndependent, FilteringBehavior.EndpointIndependent):
|
case (_, MappingBehavior.Direct or MappingBehavior.EndpointIndependent, FilteringBehavior.EndpointIndependent):
|
||||||
@@ -74,6 +76,8 @@ namespace Netch.Utils
|
|||||||
return "2";
|
return "2";
|
||||||
case (_, MappingBehavior.AddressDependent or MappingBehavior.AddressAndPortDependent, _):
|
case (_, MappingBehavior.AddressDependent or MappingBehavior.AddressAndPortDependent, _):
|
||||||
return "3";
|
return "3";
|
||||||
|
case (_, MappingBehavior.Fail, _):
|
||||||
|
return MappingBehavior.Fail.ToString();
|
||||||
default:
|
default:
|
||||||
return res.FilteringBehavior.ToString();
|
return res.FilteringBehavior.ToString();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,14 +13,14 @@ namespace Netch.Utils
|
|||||||
var mc = new ManagementClass("Win32_SystemDriver");
|
var mc = new ManagementClass("Win32_SystemDriver");
|
||||||
foreach (var obj in mc.GetInstances().Cast<ManagementObject>())
|
foreach (var obj in mc.GetInstances().Cast<ManagementObject>())
|
||||||
{
|
{
|
||||||
if (!(bool) obj["Started"])
|
if (!(bool)obj["Started"])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
var path = obj["PathName"].ToString();
|
var path = obj["PathName"].ToString();
|
||||||
if (path == null)
|
if (path == null)
|
||||||
continue;
|
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;
|
var vendorName = FileVersionInfo.GetVersionInfo(path).LegalCopyright ?? string.Empty;
|
||||||
if (!allDriver && vendorExclude.Any(s => vendorName.Contains(s, StringComparison.OrdinalIgnoreCase)))
|
if (!allDriver && vendorExclude.Any(s => vendorName.Contains(s, StringComparison.OrdinalIgnoreCase)))
|
||||||
continue;
|
continue;
|
||||||
@@ -32,6 +32,7 @@ namespace Netch.Utils
|
|||||||
public static IEnumerable<string> Processes(bool mask)
|
public static IEnumerable<string> Processes(bool mask)
|
||||||
{
|
{
|
||||||
var hashset = new HashSet<string>();
|
var hashset = new HashSet<string>();
|
||||||
|
var windowsFolder = Environment.GetFolderPath(Environment.SpecialFolder.Windows);
|
||||||
foreach (var process in Process.GetProcesses())
|
foreach (var process in Process.GetProcesses())
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -39,8 +40,10 @@ namespace Netch.Utils
|
|||||||
if (process.Id is 0 or 4)
|
if (process.Id is 0 or 4)
|
||||||
continue;
|
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;
|
continue;
|
||||||
|
|
||||||
var path = process.MainModule.FileName;
|
var path = process.MainModule.FileName;
|
||||||
|
|
||||||
if (mask)
|
if (mask)
|
||||||
|
|||||||
@@ -22,7 +22,9 @@ param (
|
|||||||
$PublishSingleFile = $True
|
$PublishSingleFile = $True
|
||||||
)
|
)
|
||||||
|
|
||||||
# .\scripts\download.ps1 $OutputPath
|
Remove-Item -Recurse -Force $OutputPath -Confirm:$false -ErrorAction Ignore
|
||||||
|
|
||||||
|
.\scripts\download.ps1 $OutputPath
|
||||||
|
|
||||||
# if ( -Not $? ) {
|
# if ( -Not $? ) {
|
||||||
# Exit 1
|
# Exit 1
|
||||||
|
|||||||
@@ -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 mode | Out-Null
|
||||||
New-Item -ItemType Directory -Name i18n | 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 .\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 netchdata-master
|
||||||
Remove-Item -Recurse -Force netchmode-master
|
Remove-Item -Recurse -Force netchmode-master
|
||||||
@@ -31,9 +31,10 @@ Remove-Item -Force data.zip
|
|||||||
Remove-Item -Force mode.zip
|
Remove-Item -Force mode.zip
|
||||||
Remove-Item -Force i18n.zip
|
Remove-Item -Force i18n.zip
|
||||||
|
|
||||||
..\scripts\download\aiodns.ps1 -OutputPath bin
|
#..\scripts\download\aiodns.ps1 -OutputPath bin
|
||||||
..\scripts\download\cloak.ps1 -OutputPath bin
|
..\scripts\download\cloak.ps1 -OutputPath bin
|
||||||
..\scripts\download\xray-core.ps1 -OutputPath bin
|
..\scripts\download\xray-core.ps1 -OutputPath bin
|
||||||
|
..\scripts\download\pcap2socks.ps1 -OutputPath bin
|
||||||
|
|
||||||
Get-Item *
|
Get-Item *
|
||||||
Set-Location $last
|
Set-Location $last
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
param([string]$OutputPath)
|
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
|
Invoke-WebRequest -Uri $address -OutFile ck-client.exe
|
||||||
|
|
||||||
|
|||||||
11
scripts/download/pcap2socks.ps1
Normal file
11
scripts/download/pcap2socks.ps1
Normal 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
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
param([string]$OutputPath)
|
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
|
Invoke-WebRequest -Uri $address -OutFile xray-core.zip
|
||||||
Expand-Archive -Force -Path xray-core.zip -DestinationPath xray-core
|
Expand-Archive -Force -Path xray-core.zip -DestinationPath xray-core
|
||||||
|
|
||||||
Move-Item -Force xray-core\xray.exe $OutputPath
|
Move-Item -Force xray-core\xray.exe $OutputPath
|
||||||
Move-Item -Force xray-core\geoip.dat $OutputPath
|
# Move-Item -Force xray-core\geoip.dat $OutputPath
|
||||||
Move-Item -Force xray-core\geosite.dat $OutputPath
|
# Move-Item -Force xray-core\geosite.dat $OutputPath
|
||||||
|
|
||||||
Remove-Item -Recurse -Force xray-core
|
Remove-Item -Recurse -Force xray-core
|
||||||
Remove-Item -Recurse -Force xray-core.zip
|
Remove-Item -Recurse -Force xray-core.zip
|
||||||
|
|||||||
Reference in New Issue
Block a user