enable Security Protocol Tls13 option

pull/2077/head
2dust 2022-02-26 12:27:59 +08:00
parent 734df5def5
commit fada5f99bb
9 changed files with 348 additions and 303 deletions

View File

@ -69,6 +69,7 @@
this.txtKcpmtu = new System.Windows.Forms.TextBox(); this.txtKcpmtu = new System.Windows.Forms.TextBox();
this.label6 = new System.Windows.Forms.Label(); this.label6 = new System.Windows.Forms.Label();
this.tabPage7 = new System.Windows.Forms.TabPage(); this.tabPage7 = new System.Windows.Forms.TabPage();
this.chkEnableSecurityProtocolTls13 = new System.Windows.Forms.CheckBox();
this.chkEnableAutoAdjustMainLvColWidth = new System.Windows.Forms.CheckBox(); this.chkEnableAutoAdjustMainLvColWidth = new System.Windows.Forms.CheckBox();
this.btnSetLoopback = new System.Windows.Forms.Button(); this.btnSetLoopback = new System.Windows.Forms.Button();
this.txtautoUpdateInterval = new System.Windows.Forms.TextBox(); this.txtautoUpdateInterval = new System.Windows.Forms.TextBox();
@ -376,6 +377,7 @@
// tabPage7 // tabPage7
// //
resources.ApplyResources(this.tabPage7, "tabPage7"); resources.ApplyResources(this.tabPage7, "tabPage7");
this.tabPage7.Controls.Add(this.chkEnableSecurityProtocolTls13);
this.tabPage7.Controls.Add(this.chkEnableAutoAdjustMainLvColWidth); this.tabPage7.Controls.Add(this.chkEnableAutoAdjustMainLvColWidth);
this.tabPage7.Controls.Add(this.btnSetLoopback); this.tabPage7.Controls.Add(this.btnSetLoopback);
this.tabPage7.Controls.Add(this.txtautoUpdateInterval); this.tabPage7.Controls.Add(this.txtautoUpdateInterval);
@ -392,6 +394,12 @@
this.tabPage7.Name = "tabPage7"; this.tabPage7.Name = "tabPage7";
this.tabPage7.UseVisualStyleBackColor = true; this.tabPage7.UseVisualStyleBackColor = true;
// //
// chkEnableSecurityProtocolTls13
//
resources.ApplyResources(this.chkEnableSecurityProtocolTls13, "chkEnableSecurityProtocolTls13");
this.chkEnableSecurityProtocolTls13.Name = "chkEnableSecurityProtocolTls13";
this.chkEnableSecurityProtocolTls13.UseVisualStyleBackColor = true;
//
// chkEnableAutoAdjustMainLvColWidth // chkEnableAutoAdjustMainLvColWidth
// //
resources.ApplyResources(this.chkEnableAutoAdjustMainLvColWidth, "chkEnableAutoAdjustMainLvColWidth"); resources.ApplyResources(this.chkEnableAutoAdjustMainLvColWidth, "chkEnableAutoAdjustMainLvColWidth");
@ -614,5 +622,6 @@
private System.Windows.Forms.Label label15; private System.Windows.Forms.Label label15;
private System.Windows.Forms.Button btnSetLoopback; private System.Windows.Forms.Button btnSetLoopback;
private System.Windows.Forms.CheckBox chkEnableAutoAdjustMainLvColWidth; private System.Windows.Forms.CheckBox chkEnableAutoAdjustMainLvColWidth;
private System.Windows.Forms.CheckBox chkEnableSecurityProtocolTls13;
} }
} }

View File

@ -124,6 +124,7 @@ namespace v2rayN.Forms
cmbCoreType.SelectedIndex = (int)config.coreType; cmbCoreType.SelectedIndex = (int)config.coreType;
txtautoUpdateInterval.Text = config.autoUpdateInterval.ToString(); txtautoUpdateInterval.Text = config.autoUpdateInterval.ToString();
chkEnableAutoAdjustMainLvColWidth.Checked = config.uiItem.enableAutoAdjustMainLvColWidth; chkEnableAutoAdjustMainLvColWidth.Checked = config.uiItem.enableAutoAdjustMainLvColWidth;
chkEnableSecurityProtocolTls13.Checked = config.enableSecurityProtocolTls13;
} }
private void btnOK_Click(object sender, EventArgs e) private void btnOK_Click(object sender, EventArgs e)
{ {
@ -308,6 +309,7 @@ namespace v2rayN.Forms
config.coreType = (ECoreType)cmbCoreType.SelectedIndex; config.coreType = (ECoreType)cmbCoreType.SelectedIndex;
config.autoUpdateInterval = Utils.ToInt(txtautoUpdateInterval.Text); config.autoUpdateInterval = Utils.ToInt(txtautoUpdateInterval.Text);
config.uiItem.enableAutoAdjustMainLvColWidth = chkEnableAutoAdjustMainLvColWidth.Checked; config.uiItem.enableAutoAdjustMainLvColWidth = chkEnableAutoAdjustMainLvColWidth.Checked;
config.enableSecurityProtocolTls13 = chkEnableSecurityProtocolTls13.Checked;
return 0; return 0;
} }

File diff suppressed because it is too large Load Diff

View File

@ -226,6 +226,9 @@
<data name="tabPage6.Text" xml:space="preserve"> <data name="tabPage6.Text" xml:space="preserve">
<value> Core:KCP设置 </value> <value> Core:KCP设置 </value>
</data> </data>
<data name="chkEnableSecurityProtocolTls13.Text" xml:space="preserve">
<value>启用安全协议TLS v1.3 (订阅/检查更新/测速)</value>
</data>
<data name="chkEnableAutoAdjustMainLvColWidth.Size" type="System.Drawing.Size, System.Drawing"> <data name="chkEnableAutoAdjustMainLvColWidth.Size" type="System.Drawing.Size, System.Drawing">
<value>204, 16</value> <value>204, 16</value>
</data> </data>

View File

@ -175,10 +175,7 @@ namespace v2rayN
/// Language /// Language
/// </summary> /// </summary>
public const string MyRegKeyLanguage = "CurrentLanguage"; public const string MyRegKeyLanguage = "CurrentLanguage";
/// <summary>
///
/// </summary>
public const string MyRegKeySecurityProtocolTls13 = "SecurityProtocolTls13";
/// <summary> /// <summary>
/// Icon /// Icon
/// </summary> /// </summary>

View File

@ -37,7 +37,7 @@ namespace v2rayN.Handler
WebClientEx ws = new WebClientEx(); WebClientEx ws = new WebClientEx();
try try
{ {
Utils.SetSecurityProtocol(); Utils.SetSecurityProtocol(LazyConfig.Instance.GetConfig().enableSecurityProtocolTls13);
UpdateCompleted?.Invoke(this, new ResultEventArgs(false, UIRes.I18N("Downloading"))); UpdateCompleted?.Invoke(this, new ResultEventArgs(false, UIRes.I18N("Downloading")));
progressPercentage = -1; progressPercentage = -1;
@ -136,7 +136,7 @@ namespace v2rayN.Handler
string source = string.Empty; string source = string.Empty;
try try
{ {
Utils.SetSecurityProtocol(); Utils.SetSecurityProtocol(LazyConfig.Instance.GetConfig().enableSecurityProtocolTls13);
WebClientEx ws = new WebClientEx(); WebClientEx ws = new WebClientEx();
if (webProxy != null) if (webProxy != null)
@ -187,7 +187,7 @@ namespace v2rayN.Handler
string source = string.Empty; string source = string.Empty;
try try
{ {
Utils.SetSecurityProtocol(); Utils.SetSecurityProtocol(LazyConfig.Instance.GetConfig().enableSecurityProtocolTls13);
WebClientEx ws = new WebClientEx(); WebClientEx ws = new WebClientEx();
@ -205,7 +205,7 @@ namespace v2rayN.Handler
WebClientEx ws = new WebClientEx(); WebClientEx ws = new WebClientEx();
try try
{ {
Utils.SetSecurityProtocol(); Utils.SetSecurityProtocol(LazyConfig.Instance.GetConfig().enableSecurityProtocolTls13);
UpdateCompleted?.Invoke(this, new ResultEventArgs(false, UIRes.I18N("Downloading"))); UpdateCompleted?.Invoke(this, new ResultEventArgs(false, UIRes.I18N("Downloading")));
progressPercentage = -1; progressPercentage = -1;

View File

@ -293,7 +293,7 @@ namespace v2rayN.Handler
{ {
try try
{ {
Utils.SetSecurityProtocol(); Utils.SetSecurityProtocol(LazyConfig.Instance.GetConfig().enableSecurityProtocolTls13);
WebRequestHandler webRequestHandler = new WebRequestHandler WebRequestHandler webRequestHandler = new WebRequestHandler
{ {
AllowAutoRedirect = false AllowAutoRedirect = false

View File

@ -11,13 +11,7 @@ namespace v2rayN.Mode
[Serializable] [Serializable]
public class Config public class Config
{ {
/// <summary> #region property
/// 本地监听
/// </summary>
public List<InItem> inbound
{
get; set;
}
/// <summary> /// <summary>
/// 允许日志 /// 允许日志
@ -43,14 +37,6 @@ namespace v2rayN.Mode
get; set; get; set;
} }
/// <summary>
/// vmess服务器信息
/// </summary>
public List<VmessItem> vmess
{
get; set;
}
/// <summary> /// <summary>
/// 允许Mux多路复用 /// 允许Mux多路复用
/// </summary> /// </summary>
@ -59,14 +45,6 @@ namespace v2rayN.Mode
get; set; get; set;
} }
/// <summary>
/// KcpItem
/// </summary>
public KcpItem kcpItem
{
get; set;
}
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
@ -107,7 +85,6 @@ namespace v2rayN.Mode
get; set; get; set;
} }
/// <summary> /// <summary>
/// 自定义远程DNS /// 自定义远程DNS
/// </summary> /// </summary>
@ -124,20 +101,6 @@ namespace v2rayN.Mode
get; set; get; set;
} }
/// <summary>
/// 订阅
/// </summary>
public List<SubItem> subItem
{
get; set;
}
/// <summary>
/// UI
/// </summary>
public UIItem uiItem
{
get; set;
}
/// <summary> /// <summary>
/// 域名解析策略 /// 域名解析策略
/// </summary> /// </summary>
@ -153,10 +116,6 @@ namespace v2rayN.Mode
{ {
get; set; get; set;
} }
public List<RoutingItem> routings
{
get; set;
}
public bool enableRoutingAdvanced public bool enableRoutingAdvanced
{ {
get; set; get; set;
@ -184,11 +143,66 @@ namespace v2rayN.Mode
get; set; get; set;
} = 0; } = 0;
public bool enableSecurityProtocolTls13
{
get; set;
}
#endregion
#region other entities
/// <summary>
/// 本地监听
/// </summary>
public List<InItem> inbound
{
get; set;
}
/// <summary>
/// vmess服务器信息
/// </summary>
public List<VmessItem> vmess
{
get; set;
}
/// <summary>
/// KcpItem
/// </summary>
public KcpItem kcpItem
{
get; set;
}
/// <summary>
/// 订阅
/// </summary>
public List<SubItem> subItem
{
get; set;
}
/// <summary>
/// UI
/// </summary>
public UIItem uiItem
{
get; set;
}
public List<RoutingItem> routings
{
get; set;
}
public ConstItem constItem public ConstItem constItem
{ {
get; set; get; set;
} }
#region 函数
#endregion
#region function
public string address() public string address()
{ {
@ -390,6 +404,7 @@ namespace v2rayN.Mode
} }
return vmess.FindIndex(it => it.indexId == indexId); return vmess.FindIndex(it => it.indexId == indexId);
} }
#endregion #endregion
} }

View File

@ -715,11 +715,9 @@ namespace v2rayN
return lstIPAddress; return lstIPAddress;
} }
public static void SetSecurityProtocol() public static void SetSecurityProtocol(bool enableSecurityProtocolTls13)
{ {
string securityProtocolTls13 = RegReadValue(Global.MyRegPath, Global.MyRegKeySecurityProtocolTls13, "0"); if (enableSecurityProtocolTls13)
if (securityProtocolTls13.Equals("1"))
{ {
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3
| SecurityProtocolType.Tls | SecurityProtocolType.Tls