Add tls13 settings in the registry

pull/2077/head
2dust 2022-01-12 21:05:03 +08:00
parent 88e2288298
commit 0a1d4d5193
2 changed files with 29 additions and 4 deletions

View File

@ -176,6 +176,10 @@ namespace v2rayN
/// </summary>
public const string MyRegKeyLanguage = "CurrentLanguage";
/// <summary>
///
/// </summary>
public const string MyRegKeySecurityProtocolTls13 = "SecurityProtocolTls13";
/// <summary>
/// Icon
/// </summary>
public const string CustomIconName = "v2rayN.ico";

View File

@ -353,7 +353,7 @@ namespace v2rayN
return $"{string.Format("{0:f1}", result)} {unit}";
}
public static string UrlEncode(string url)
{
@ -717,8 +717,9 @@ namespace v2rayN
public static void SetSecurityProtocol()
{
//.NET Framework 4.8
if (GetDotNetRelease(528040))
string securityProtocolTls13 = RegReadValue(Global.MyRegPath, Global.MyRegKeySecurityProtocolTls13, "0");
if (securityProtocolTls13.Equals("1"))
{
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3
| SecurityProtocolType.Tls
@ -735,6 +736,26 @@ namespace v2rayN
}
ServicePointManager.DefaultConnectionLimit = 256;
}
public static bool PortInUse(int port)
{
bool inUse = false;
IPGlobalProperties ipProperties = IPGlobalProperties.GetIPGlobalProperties();
IPEndPoint[] ipEndPoints = ipProperties.GetActiveTcpListeners();
var lstIpEndPoints = new List<IPEndPoint>(IPGlobalProperties.GetIPGlobalProperties().GetActiveTcpListeners());
foreach (IPEndPoint endPoint in ipEndPoints)
{
if (endPoint.Port == port)
{
inUse = true;
break;
}
}
return inUse;
}
#endregion
#region 杂项
@ -913,7 +934,7 @@ namespace v2rayN
{
var logger = LogManager.GetLogger("Log2");
logger.Debug(strTitle);
logger.Debug(ex);
logger.Debug(ex);
}
#endregion