mirror of
https://github.com/netchx/netch.git
synced 2026-05-11 23:45:06 +08:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aa5faa9af6 | ||
|
|
a92d1c8244 | ||
|
|
6bdcc7ce04 | ||
|
|
b5c7ca4c1a | ||
|
|
7c318a9e49 | ||
|
|
f9724f77c2 |
@@ -18,14 +18,29 @@ namespace Netch.Controllers
|
||||
private set => _serverController = value;
|
||||
}
|
||||
|
||||
public static IServerController UdpServerController
|
||||
{
|
||||
get => _udpServerController ?? _serverController;
|
||||
set => _udpServerController = value;
|
||||
}
|
||||
|
||||
/// TCP or Both Server
|
||||
public static Server Server;
|
||||
|
||||
public static Server UdpServer
|
||||
{
|
||||
get => _udpServer ?? Server;
|
||||
set => _udpServer = value;
|
||||
}
|
||||
|
||||
private static Server _udpServer;
|
||||
public static IModeController ModeController { get; private set; }
|
||||
|
||||
public static bool NttTested;
|
||||
|
||||
private static readonly NTTController NTTController = new NTTController();
|
||||
private static IServerController _serverController;
|
||||
private static IServerController _udpServerController;
|
||||
|
||||
/// <summary>
|
||||
/// 启动
|
||||
|
||||
@@ -56,16 +56,16 @@ namespace Netch.Controllers
|
||||
|
||||
aio_dial((int) NameList.TYPE_FILTERLOOPBACK, "false");
|
||||
aio_dial((int) NameList.TYPE_FILTERTCP, "true");
|
||||
aio_dial((int)NameList.TYPE_TCPLISN, Global.Settings.RedirectorTCPPort.ToString());
|
||||
aio_dial((int) NameList.TYPE_TCPLISN, Global.Settings.RedirectorTCPPort.ToString());
|
||||
if (Global.Settings.ProcessNoProxyForUdp)
|
||||
{
|
||||
aio_dial((int)NameList.TYPE_FILTERUDP, "false");
|
||||
SetServer(MainController.ServerController, PortType.TCP);
|
||||
aio_dial((int) NameList.TYPE_FILTERUDP, "false");
|
||||
SetServer(PortType.TCP);
|
||||
}
|
||||
else
|
||||
{
|
||||
aio_dial((int)NameList.TYPE_FILTERUDP, "true");
|
||||
SetServer(MainController.ServerController, PortType.Both);
|
||||
aio_dial((int) NameList.TYPE_FILTERUDP, "true");
|
||||
SetServer(PortType.Both);
|
||||
}
|
||||
|
||||
if (!CheckRule(mode.FullRule, out var list))
|
||||
@@ -184,18 +184,33 @@ namespace Netch.Controllers
|
||||
return InstallDriver();
|
||||
}
|
||||
|
||||
private void SetServer(in IServerController controller, in PortType portType)
|
||||
private void SetServer(in PortType portType)
|
||||
{
|
||||
if (portType == PortType.Both)
|
||||
{
|
||||
SetServer(controller, PortType.TCP);
|
||||
SetServer(controller, PortType.UDP);
|
||||
SetServer(PortType.TCP);
|
||||
SetServer(PortType.UDP);
|
||||
return;
|
||||
}
|
||||
|
||||
var offset = portType == PortType.UDP ? UdpNameListOffset : 0;
|
||||
int offset;
|
||||
Server server;
|
||||
IServerController controller;
|
||||
|
||||
if (MainController.Server is Socks5 socks5)
|
||||
if (portType == PortType.UDP)
|
||||
{
|
||||
offset = UdpNameListOffset;
|
||||
server = MainController.UdpServer;
|
||||
controller = MainController.UdpServerController;
|
||||
}
|
||||
else
|
||||
{
|
||||
offset = 0;
|
||||
server = MainController.Server;
|
||||
controller = MainController.ServerController;
|
||||
}
|
||||
|
||||
if (server is Socks5 socks5)
|
||||
{
|
||||
aio_dial((int) NameList.TYPE_TCPTYPE + offset, "Socks5");
|
||||
aio_dial((int) NameList.TYPE_TCPHOST + offset, $"{socks5.AutoResolveHostname()}:{socks5.Port}");
|
||||
@@ -203,7 +218,7 @@ namespace Netch.Controllers
|
||||
aio_dial((int) NameList.TYPE_TCPPASS + offset, socks5.Password ?? string.Empty);
|
||||
aio_dial((int) NameList.TYPE_TCPMETH + offset, string.Empty);
|
||||
}
|
||||
else if (MainController.Server is Shadowsocks shadowsocks && !shadowsocks.HasPlugin() && Global.Settings.RedirectorSS)
|
||||
else if (server is Shadowsocks shadowsocks && !shadowsocks.HasPlugin() && Global.Settings.RedirectorSS)
|
||||
{
|
||||
aio_dial((int) NameList.TYPE_TCPTYPE + offset, "Shadowsocks");
|
||||
aio_dial((int) NameList.TYPE_TCPHOST + offset, $"{shadowsocks.AutoResolveHostname()}:{shadowsocks.Port}");
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Netch.Controllers
|
||||
public const string Name = @"Netch";
|
||||
public const string Copyright = @"Copyright © 2019 - 2020";
|
||||
|
||||
public const string AssemblyVersion = @"1.6.8";
|
||||
public const string AssemblyVersion = @"1.6.9";
|
||||
private const string Suffix = @"";
|
||||
|
||||
public static readonly string Version = $"{AssemblyVersion}{(string.IsNullOrEmpty(Suffix) ? "" : $"-{Suffix}")}";
|
||||
|
||||
@@ -126,6 +126,6 @@ namespace Netch.Models
|
||||
public static bool TestNatRequired(this Mode mode) => mode.Type is 0 or 1 or 2;
|
||||
|
||||
/// Socks5 分流是否能被有效实施
|
||||
public static bool ClientRouting(this Mode mode) => mode.Type is not 1 or 2;
|
||||
public static bool ClientRouting(this Mode mode) => mode.Type is not (1 or 2);
|
||||
}
|
||||
}
|
||||
@@ -14,17 +14,17 @@ namespace Netch.Servers.VLESS
|
||||
/// <summary>
|
||||
/// 加密方式
|
||||
/// </summary>
|
||||
public new string EncryptMethod { get; set; } = "none";
|
||||
public override string EncryptMethod { get; set; } = "none";
|
||||
|
||||
/// <summary>
|
||||
/// 传输协议
|
||||
/// </summary>
|
||||
public new string TransferProtocol { get; set; } = VLESSGlobal.TransferProtocols[0];
|
||||
public override string TransferProtocol { get; set; } = VLESSGlobal.TransferProtocols[0];
|
||||
|
||||
/// <summary>
|
||||
/// 伪装类型
|
||||
/// </summary>
|
||||
public new string FakeType { get; set; } = VLESSGlobal.FakeTypes[0];
|
||||
public override string FakeType { get; set; } = VLESSGlobal.FakeTypes[0];
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
|
||||
@@ -24,18 +24,18 @@ namespace Netch.Servers.VMess
|
||||
/// <summary>
|
||||
/// 加密方式
|
||||
/// </summary>
|
||||
public string EncryptMethod { get; set; } = VMessGlobal.EncryptMethods[0];
|
||||
public virtual string EncryptMethod { get; set; } = VMessGlobal.EncryptMethods[0];
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 传输协议
|
||||
/// </summary>
|
||||
public string TransferProtocol { get; set; } = VMessGlobal.TransferProtocols[0];
|
||||
public virtual string TransferProtocol { get; set; } = VMessGlobal.TransferProtocols[0];
|
||||
|
||||
/// <summary>
|
||||
/// 伪装类型
|
||||
/// </summary>
|
||||
public string FakeType { get; set; } = VMessGlobal.FakeTypes[0];
|
||||
public virtual string FakeType { get; set; } = VMessGlobal.FakeTypes[0];
|
||||
|
||||
/// <summary>
|
||||
/// QUIC
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace Netch.Utils
|
||||
{
|
||||
static WebUtil()
|
||||
{
|
||||
ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12 | SecurityProtocolType.Tls13;
|
||||
ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12;
|
||||
}
|
||||
|
||||
public const string DefaultUserAgent =
|
||||
|
||||
Submodule translations updated: 45e50093e3...e7390dc01f
Reference in New Issue
Block a user