diff --git a/v2rayN/v2rayN/Global.cs b/v2rayN/v2rayN/Global.cs
index 466119c2..de142806 100644
--- a/v2rayN/v2rayN/Global.cs
+++ b/v2rayN/v2rayN/Global.cs
@@ -176,6 +176,10 @@ namespace v2rayN
///
public const string MyRegKeyLanguage = "CurrentLanguage";
///
+ ///
+ ///
+ public const string MyRegKeySecurityProtocolTls13 = "SecurityProtocolTls13";
+ ///
/// Icon
///
public const string CustomIconName = "v2rayN.ico";
diff --git a/v2rayN/v2rayN/Tool/Utils.cs b/v2rayN/v2rayN/Tool/Utils.cs
index b0db10ed..6fa98069 100644
--- a/v2rayN/v2rayN/Tool/Utils.cs
+++ b/v2rayN/v2rayN/Tool/Utils.cs
@@ -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(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