Compare commits

...

4 Commits
4.28 ... 4.29

Author SHA1 Message Date
2dust
cf0bd7f1e6 up 4.29 2022-01-12 21:06:32 +08:00
2dust
f3a86a2173 Added port in used check at speedtest 2022-01-12 21:06:22 +08:00
2dust
0a1d4d5193 Add tls13 settings in the registry 2022-01-12 21:05:03 +08:00
2dust
88e2288298 Added tls display to the main form 2022-01-12 21:04:10 +08:00
13 changed files with 72 additions and 12 deletions

View File

@@ -202,6 +202,7 @@ namespace v2rayN.Forms
lvServers.Columns.Add(UIRes.I18N("LvPort"), 50);
lvServers.Columns.Add(UIRes.I18N("LvEncryptionMethod"), 90);
lvServers.Columns.Add(UIRes.I18N("LvTransportProtocol"), 70);
lvServers.Columns.Add(UIRes.I18N("LvTLS"), 70);
lvServers.Columns.Add(UIRes.I18N("LvSubscription"), 50);
lvServers.Columns.Add(UIRes.I18N("LvTestResults"), 70, HorizontalAlignment.Right);
@@ -258,6 +259,7 @@ namespace v2rayN.Forms
Utils.AddSubItem(lvItem, EServerColName.port.ToString(), item.port.ToString());
Utils.AddSubItem(lvItem, EServerColName.security.ToString(), item.security);
Utils.AddSubItem(lvItem, EServerColName.network.ToString(), item.network);
Utils.AddSubItem(lvItem, EServerColName.streamSecurity.ToString(), item.streamSecurity);
Utils.AddSubItem(lvItem, EServerColName.subRemarks.ToString(), item.getSubRemarks(config));
Utils.AddSubItem(lvItem, EServerColName.testResult.ToString(), item.testResult);
if (stats)

View File

@@ -137,7 +137,7 @@
<value>336, 16</value>
</data>
<data name="chkdefAllowInsecure.Text" xml:space="preserve">
<value>底层传输安全选tls时默认跳过证书验证(allowInsecure)</value>
<value>传输安全选tls时默认跳过证书验证(allowInsecure)</value>
</data>
<data name="chksniffingEnabled2.Size" type="System.Drawing.Size, System.Drawing">
<value>96, 16</value>

View File

@@ -146,7 +146,7 @@
<value>107, 12</value>
</data>
<data name="labStreamSecurity.Text" xml:space="preserve">
<value>底层传输安全(tls)</value>
<value>传输安全(tls)</value>
</data>
<data name="txtRequestHost.Location" type="System.Drawing.Point, System.Drawing">
<value>127, 92</value>

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

@@ -914,6 +914,7 @@ namespace v2rayN.Handler
case EServerColName.port:
case EServerColName.security:
case EServerColName.network:
case EServerColName.streamSecurity:
case EServerColName.testResult:
propertyName = name.ToString();
break;

View File

@@ -2,6 +2,8 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.NetworkInformation;
using v2rayN.Mode;
namespace v2rayN.Handler
@@ -529,7 +531,7 @@ namespace v2rayN.Handler
serversItem.ota = false;
serversItem.level = 1;
//if xtls
if (config.streamSecurity() == Global.StreamSecurityX)
{
@@ -1418,6 +1420,12 @@ namespace v2rayN.Handler
msg = UIRes.I18N("FailedGenDefaultConfiguration");
return "";
}
List<IPEndPoint> lstIpEndPoints = null;
try
{
lstIpEndPoints = new List<IPEndPoint>(IPGlobalProperties.GetIPGlobalProperties().GetActiveTcpListeners());
}
catch { }
log(configCopy, ref v2rayConfig, false);
//routing(config, ref v2rayConfig);
@@ -1426,6 +1434,7 @@ namespace v2rayN.Handler
v2rayConfig.inbounds.Clear(); // Remove "proxy" service for speedtest, avoiding port conflicts.
int httpPort = configCopy.GetLocalPort("speedtest");
foreach (int index in selecteds)
{
if (configCopy.vmess[index].configType == (int)EConfigType.Custom)
@@ -1434,11 +1443,18 @@ namespace v2rayN.Handler
}
configCopy.index = index;
var port = httpPort + index;
//Port In Used
if (lstIpEndPoints != null && lstIpEndPoints.FindIndex(_it => _it.Port == port) >= 0)
{
continue;
}
Inbounds inbound = new Inbounds
{
listen = Global.Loopback,
port = httpPort + index,
port = port,
protocol = Global.InboundHttp
};
inbound.tag = Global.InboundHttp + inbound.port.ToString();

View File

@@ -554,7 +554,7 @@ namespace v2rayN.Mode
}
/// <summary>
/// 底层传输安全
/// 传输安全
/// </summary>
public string streamSecurity
{

View File

@@ -10,6 +10,7 @@ namespace v2rayN.Mode
port,
security,
network,
streamSecurity,
subRemarks,
testResult,

View File

@@ -32,4 +32,4 @@ using System.Runtime.InteropServices;
// 方法是按如下所示使用“*”:
//[assembly: AssemblyVersion("1.0.*")]
//[assembly: AssemblyVersion("1.0.0")]
[assembly: AssemblyFileVersion("4.28")]
[assembly: AssemblyFileVersion("4.29")]

View File

@@ -47,8 +47,8 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 重写当前线程的 CurrentUICulture 属性
/// 重写当前线程的 CurrentUICulture 属性
/// 重写当前线程的 CurrentUICulture 属性,对
/// 使用此强类型资源类的所有资源查找执行重写
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
@@ -402,6 +402,15 @@ namespace v2rayN.Resx {
}
}
/// <summary>
/// 查找类似 TLS 的本地化字符串。
/// </summary>
internal static string LvTLS {
get {
return ResourceManager.GetString("LvTLS", resourceCulture);
}
}
/// <summary>
/// 查找类似 Today download traffic 的本地化字符串。
/// </summary>

View File

@@ -436,4 +436,7 @@
<data name="TransportHeaderTypeTip4" xml:space="preserve">
<value>*grpc mode</value>
</data>
<data name="LvTLS" xml:space="preserve">
<value>TLS</value>
</data>
</root>

View File

@@ -436,4 +436,7 @@
<data name="TransportHeaderTypeTip4" xml:space="preserve">
<value>*grpc 模式</value>
</data>
<data name="LvTLS" xml:space="preserve">
<value>传输层安全</value>
</data>
</root>

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