Add tls13 settings in the registry

This commit is contained in:
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> /// </summary>
public const string MyRegKeyLanguage = "CurrentLanguage"; public const string MyRegKeyLanguage = "CurrentLanguage";
/// <summary> /// <summary>
///
/// </summary>
public const string MyRegKeySecurityProtocolTls13 = "SecurityProtocolTls13";
/// <summary>
/// Icon /// Icon
/// </summary> /// </summary>
public const string CustomIconName = "v2rayN.ico"; public const string CustomIconName = "v2rayN.ico";

View file

@ -353,7 +353,7 @@ namespace v2rayN
return $"{string.Format("{0:f1}", result)} {unit}"; return $"{string.Format("{0:f1}", result)} {unit}";
} }
public static string UrlEncode(string url) public static string UrlEncode(string url)
{ {
@ -717,8 +717,9 @@ namespace v2rayN
public static void SetSecurityProtocol() public static void SetSecurityProtocol()
{ {
//.NET Framework 4.8 string securityProtocolTls13 = RegReadValue(Global.MyRegPath, Global.MyRegKeySecurityProtocolTls13, "0");
if (GetDotNetRelease(528040))
if (securityProtocolTls13.Equals("1"))
{ {
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3
| SecurityProtocolType.Tls | SecurityProtocolType.Tls
@ -735,6 +736,26 @@ namespace v2rayN
} }
ServicePointManager.DefaultConnectionLimit = 256; 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 #endregion
#region #region
@ -913,7 +934,7 @@ namespace v2rayN
{ {
var logger = LogManager.GetLogger("Log2"); var logger = LogManager.GetLogger("Log2");
logger.Debug(strTitle); logger.Debug(strTitle);
logger.Debug(ex); logger.Debug(ex);
} }
#endregion #endregion