Compare commits

...

6 Commits
1.6.8 ... 1.6.9

Author SHA1 Message Date
ChsBuffer
aa5faa9af6 bump version to 1.6.9 2020-12-22 22:21:23 +08:00
ChsBuffer
a92d1c8244 Update translations 2020-12-22 22:21:09 +08:00
ChsBuffer
6bdcc7ce04 Fix GenerateV2RayConfig 2020-12-22 20:59:29 +08:00
ChsBuffer
b5c7ca4c1a Refactor NFController SetServer 2020-12-22 16:59:32 +08:00
ChsBuffer
7c318a9e49 Remove hardcoded TLS1.3 2020-12-21 11:49:08 +08:00
ChsBuffer
f9724f77c2 Fix mode 1,2 did not ignore BypassChina 2020-12-20 17:34:45 +08:00
8 changed files with 51 additions and 21 deletions

View File

@@ -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>
/// 启动

View File

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

View File

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

View File

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

View File

@@ -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>
///

View File

@@ -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

View File

@@ -10,7 +10,7 @@ namespace Netch.Utils
{
static WebUtil()
{
ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12 | SecurityProtocolType.Tls13;
ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12;
}
public const string DefaultUserAgent =