pull/1232/head 4.5
2dust 2021-01-06 19:54:15 +08:00
parent e578c75545
commit 57d5e02d6a
10 changed files with 1828 additions and 1346 deletions

View File

@ -223,7 +223,7 @@ namespace v2rayN.Forms
}
VmessItem item = config.vmess[k];
bool stats = statistics != null && statistics.Enable;
if (stats)
{
@ -1310,7 +1310,7 @@ namespace v2rayN.Forms
string fileName = downloadHandle.DownloadFileName;
fileName = Utils.GetPath(fileName);
FileManager.ZipExtractToFile(fileName);
FileManager.ZipExtractToFile(fileName, config.ignoreGeoUpdateCore ? "geo" : "");
AppendText(false, UIRes.I18N("MsgUpdateV2rayCoreSuccessfullyMore"));

View File

@ -69,6 +69,7 @@
this.txtKcpmtu = new System.Windows.Forms.TextBox();
this.label6 = new System.Windows.Forms.Label();
this.tabPage7 = new System.Windows.Forms.TabPage();
this.chkIgnoreGeoUpdateCore = new System.Windows.Forms.CheckBox();
this.cmbCoreType = new System.Windows.Forms.ComboBox();
this.label4 = new System.Windows.Forms.Label();
this.chkKeepOlderDedupl = new System.Windows.Forms.CheckBox();
@ -91,32 +92,31 @@
//
// btnClose
//
resources.ApplyResources(this.btnClose, "btnClose");
this.btnClose.DialogResult = System.Windows.Forms.DialogResult.Cancel;
resources.ApplyResources(this.btnClose, "btnClose");
this.btnClose.Name = "btnClose";
this.btnClose.UseVisualStyleBackColor = true;
this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
//
// tabControl1
//
resources.ApplyResources(this.tabControl1, "tabControl1");
this.tabControl1.Controls.Add(this.tabPage1);
this.tabControl1.Controls.Add(this.tabPage2);
this.tabControl1.Controls.Add(this.tabPage6);
this.tabControl1.Controls.Add(this.tabPage7);
resources.ApplyResources(this.tabControl1, "tabControl1");
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
//
// tabPage1
//
resources.ApplyResources(this.tabPage1, "tabPage1");
this.tabPage1.Controls.Add(this.groupBox1);
resources.ApplyResources(this.tabPage1, "tabPage1");
this.tabPage1.Name = "tabPage1";
this.tabPage1.UseVisualStyleBackColor = true;
//
// groupBox1
//
resources.ApplyResources(this.groupBox1, "groupBox1");
this.groupBox1.Controls.Add(this.chkdefAllowInsecure);
this.groupBox1.Controls.Add(this.chksniffingEnabled2);
this.groupBox1.Controls.Add(this.chksniffingEnabled);
@ -134,6 +134,7 @@
this.groupBox1.Controls.Add(this.label5);
this.groupBox1.Controls.Add(this.txtlocalPort);
this.groupBox1.Controls.Add(this.label2);
resources.ApplyResources(this.groupBox1, "groupBox1");
this.groupBox1.Name = "groupBox1";
this.groupBox1.TabStop = false;
//
@ -176,12 +177,12 @@
//
// cmbprotocol2
//
resources.ApplyResources(this.cmbprotocol2, "cmbprotocol2");
this.cmbprotocol2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbprotocol2.FormattingEnabled = true;
this.cmbprotocol2.Items.AddRange(new object[] {
resources.GetString("cmbprotocol2.Items"),
resources.GetString("cmbprotocol2.Items1")});
resources.ApplyResources(this.cmbprotocol2, "cmbprotocol2");
this.cmbprotocol2.Name = "cmbprotocol2";
//
// label3
@ -196,8 +197,8 @@
//
// cmbprotocol
//
resources.ApplyResources(this.cmbprotocol, "cmbprotocol");
this.cmbprotocol.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
resources.ApplyResources(this.cmbprotocol, "cmbprotocol");
this.cmbprotocol.FormattingEnabled = true;
this.cmbprotocol.Items.AddRange(new object[] {
resources.GetString("cmbprotocol.Items"),
@ -223,7 +224,6 @@
//
// cmbloglevel
//
resources.ApplyResources(this.cmbloglevel, "cmbloglevel");
this.cmbloglevel.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbloglevel.FormattingEnabled = true;
this.cmbloglevel.Items.AddRange(new object[] {
@ -232,6 +232,7 @@
resources.GetString("cmbloglevel.Items2"),
resources.GetString("cmbloglevel.Items3"),
resources.GetString("cmbloglevel.Items4")});
resources.ApplyResources(this.cmbloglevel, "cmbloglevel");
this.cmbloglevel.Name = "cmbloglevel";
//
// label5
@ -251,10 +252,10 @@
//
// tabPage2
//
resources.ApplyResources(this.tabPage2, "tabPage2");
this.tabPage2.Controls.Add(this.linkDnsObjectDoc);
this.tabPage2.Controls.Add(this.txtremoteDNS);
this.tabPage2.Controls.Add(this.label14);
resources.ApplyResources(this.tabPage2, "tabPage2");
this.tabPage2.Name = "tabPage2";
this.tabPage2.UseVisualStyleBackColor = true;
//
@ -263,6 +264,7 @@
resources.ApplyResources(this.linkDnsObjectDoc, "linkDnsObjectDoc");
this.linkDnsObjectDoc.Name = "linkDnsObjectDoc";
this.linkDnsObjectDoc.TabStop = true;
this.linkDnsObjectDoc.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkDnsObjectDoc_LinkClicked);
//
// txtremoteDNS
//
@ -276,7 +278,6 @@
//
// tabPage6
//
resources.ApplyResources(this.tabPage6, "tabPage6");
this.tabPage6.Controls.Add(this.chkKcpcongestion);
this.tabPage6.Controls.Add(this.txtKcpwriteBufferSize);
this.tabPage6.Controls.Add(this.label10);
@ -290,6 +291,7 @@
this.tabPage6.Controls.Add(this.label7);
this.tabPage6.Controls.Add(this.txtKcpmtu);
this.tabPage6.Controls.Add(this.label6);
resources.ApplyResources(this.tabPage6, "tabPage6");
this.tabPage6.Name = "tabPage6";
this.tabPage6.UseVisualStyleBackColor = true;
//
@ -361,7 +363,7 @@
//
// tabPage7
//
resources.ApplyResources(this.tabPage7, "tabPage7");
this.tabPage7.Controls.Add(this.chkIgnoreGeoUpdateCore);
this.tabPage7.Controls.Add(this.cmbCoreType);
this.tabPage7.Controls.Add(this.label4);
this.tabPage7.Controls.Add(this.chkKeepOlderDedupl);
@ -370,17 +372,24 @@
this.tabPage7.Controls.Add(this.chkEnableStatistics);
this.tabPage7.Controls.Add(this.chkAllowLANConn);
this.tabPage7.Controls.Add(this.chkAutoRun);
resources.ApplyResources(this.tabPage7, "tabPage7");
this.tabPage7.Name = "tabPage7";
this.tabPage7.UseVisualStyleBackColor = true;
//
// chkIgnoreGeoUpdateCore
//
resources.ApplyResources(this.chkIgnoreGeoUpdateCore, "chkIgnoreGeoUpdateCore");
this.chkIgnoreGeoUpdateCore.Name = "chkIgnoreGeoUpdateCore";
this.chkIgnoreGeoUpdateCore.UseVisualStyleBackColor = true;
//
// cmbCoreType
//
resources.ApplyResources(this.cmbCoreType, "cmbCoreType");
this.cmbCoreType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbCoreType.FormattingEnabled = true;
this.cmbCoreType.Items.AddRange(new object[] {
resources.GetString("cmbCoreType.Items"),
resources.GetString("cmbCoreType.Items1")});
resources.ApplyResources(this.cmbCoreType, "cmbCoreType");
this.cmbCoreType.Name = "cmbCoreType";
//
// label4
@ -396,9 +405,9 @@
//
// cbFreshrate
//
resources.ApplyResources(this.cbFreshrate, "cbFreshrate");
this.cbFreshrate.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbFreshrate.FormattingEnabled = true;
resources.ApplyResources(this.cbFreshrate, "cbFreshrate");
this.cbFreshrate.Name = "cbFreshrate";
//
// lbFreshrate
@ -426,9 +435,9 @@
//
// panel2
//
resources.ApplyResources(this.panel2, "panel2");
this.panel2.Controls.Add(this.btnClose);
this.panel2.Controls.Add(this.btnOK);
resources.ApplyResources(this.panel2, "panel2");
this.panel2.Name = "panel2";
//
// btnOK
@ -522,5 +531,6 @@
private System.Windows.Forms.Label label14;
private System.Windows.Forms.ComboBox cmbCoreType;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.CheckBox chkIgnoreGeoUpdateCore;
}
}

View File

@ -120,6 +120,7 @@ namespace v2rayN.Forms
break;
}
chkIgnoreGeoUpdateCore.Checked = config.ignoreGeoUpdateCore;
cmbCoreType.SelectedIndex = (int)config.coreType;
}
private void btnOK_Click(object sender, EventArgs e)
@ -285,6 +286,7 @@ namespace v2rayN.Forms
config.statisticsFreshRate = (int)cbFreshrate.SelectedValue;
config.keepOlderDedupl = chkKeepOlderDedupl.Checked;
config.ignoreGeoUpdateCore = chkIgnoreGeoUpdateCore.Checked;
config.coreType = (ECoreType)cmbCoreType.SelectedIndex;
return 0;

File diff suppressed because it is too large Load Diff

View File

@ -223,6 +223,12 @@
<data name="tabPage6.Text" xml:space="preserve">
<value> Core:KCP设置 </value>
</data>
<data name="chkIgnoreGeoUpdateCore.Size" type="System.Drawing.Size, System.Drawing">
<value>150, 16</value>
</data>
<data name="chkIgnoreGeoUpdateCore.Text" xml:space="preserve">
<value>更新Core时忽略Geo文件</value>
</data>
<data name="label4.Size" type="System.Drawing.Size, System.Drawing">
<value>53, 12</value>
</data>

View File

@ -57,7 +57,7 @@ namespace v2rayN.Handler
string remark = string.Empty;
if (!Utils.IsNullOrEmpty(item.remarks))
{
remark = "#" + WebUtility.UrlEncode(item.remarks);
remark = "#" + Utils.UrlEncode(item.remarks);
}
url = string.Format("{0}:{1}@{2}:{3}",
item.security,
@ -72,7 +72,7 @@ namespace v2rayN.Handler
string remark = string.Empty;
if (!Utils.IsNullOrEmpty(item.remarks))
{
remark = "#" + WebUtility.UrlEncode(item.remarks);
remark = "#" + Utils.UrlEncode(item.remarks);
}
url = string.Format("{0}:{1}@{2}:{3}",
item.security,
@ -87,12 +87,12 @@ namespace v2rayN.Handler
string remark = string.Empty;
if (!Utils.IsNullOrEmpty(item.remarks))
{
remark = "#" + WebUtility.UrlEncode(item.remarks);
remark = "#" + Utils.UrlEncode(item.remarks);
}
string query = string.Empty;
if (!Utils.IsNullOrEmpty(item.requestHost))
{
query = string.Format("?sni={0}", item.requestHost);
query = string.Format("?sni={0}", Utils.UrlEncode(item.requestHost));
}
url = string.Format("{0}@{1}:{2}",
item.id,
@ -105,7 +105,7 @@ namespace v2rayN.Handler
string remark = string.Empty;
if (!Utils.IsNullOrEmpty(item.remarks))
{
remark = "#" + WebUtility.UrlEncode(item.remarks);
remark = "#" + Utils.UrlEncode(item.remarks);
}
var dicQuery = new Dictionary<string, string>();
if (!Utils.IsNullOrEmpty(item.flow))
@ -150,7 +150,7 @@ namespace v2rayN.Handler
}
if (!Utils.IsNullOrEmpty(item.requestHost))
{
dicQuery.Add("host", item.requestHost);
dicQuery.Add("host", Utils.UrlEncode(item.requestHost));
}
break;
case "kcp":
@ -164,18 +164,18 @@ namespace v2rayN.Handler
}
if (!Utils.IsNullOrEmpty(item.path))
{
dicQuery.Add("seed", item.path);
dicQuery.Add("seed", Utils.UrlEncode(item.path));
}
break;
case "ws":
if (!Utils.IsNullOrEmpty(item.requestHost))
{
dicQuery.Add("host", item.requestHost);
dicQuery.Add("host", Utils.UrlEncode(item.requestHost));
}
if (!Utils.IsNullOrEmpty(item.path))
{
dicQuery.Add("path", item.path);
dicQuery.Add("path", Utils.UrlEncode(item.path));
}
break;
@ -184,11 +184,11 @@ namespace v2rayN.Handler
dicQuery["type"] = "http";
if (!Utils.IsNullOrEmpty(item.requestHost))
{
dicQuery.Add("host", item.requestHost);
dicQuery.Add("host", Utils.UrlEncode(item.requestHost));
}
if (!Utils.IsNullOrEmpty(item.path))
{
dicQuery.Add("path", item.path);
dicQuery.Add("path", Utils.UrlEncode(item.path));
}
break;
@ -201,8 +201,8 @@ namespace v2rayN.Handler
{
dicQuery.Add("headerType", "none");
}
dicQuery.Add("quicSecurity", item.requestHost);
dicQuery.Add("key", item.path);
dicQuery.Add("quicSecurity", Utils.UrlEncode(item.requestHost));
dicQuery.Add("key", Utils.UrlEncode(item.path));
break;
}
string query = "?" + string.Join("&", dicQuery.Select(x => x.Key + "=" + x.Value).ToArray());
@ -330,7 +330,7 @@ namespace v2rayN.Handler
{
try
{
vmessItem.remarks = WebUtility.UrlDecode(result.Substring(indexRemark + 1, result.Length - indexRemark - 1));
vmessItem.remarks = Utils.UrlDecode(result.Substring(indexRemark + 1, result.Length - indexRemark - 1));
}
catch { }
result = result.Substring(0, indexRemark);
@ -383,7 +383,7 @@ namespace v2rayN.Handler
}
else
{
vmessItem.remarks = WebUtility.UrlDecode(remarks);
vmessItem.remarks = Utils.UrlDecode(remarks);
}
}
else if (result.StartsWith(Global.vlessProtocol))
@ -509,7 +509,7 @@ namespace v2rayN.Handler
var tag = match.Groups["tag"].Value;
if (!Utils.IsNullOrEmpty(tag))
{
server.remarks = HttpUtility.UrlDecode(tag, Encoding.UTF8);
server.remarks = Utils.UrlDecode(tag);
}
Match details;
try
@ -591,7 +591,7 @@ namespace v2rayN.Handler
case "ws":
string p1 = q["path"] ?? "/";
string h1 = q["host"] ?? "";
i.requestHost = h1;
i.requestHost = Utils.UrlDecode(h1);
i.path = p1;
break;
@ -600,7 +600,7 @@ namespace v2rayN.Handler
i.network = "h2";
string p2 = q["path"] ?? "/";
string h2 = q["host"] ?? "";
i.requestHost = h2;
i.requestHost = Utils.UrlDecode(h2);
i.path = p2;
break;
@ -609,7 +609,7 @@ namespace v2rayN.Handler
string k = q["key"] ?? "";
string t3 = q["type"] ?? "none";
i.headerType = t3;
i.requestHost = s;
i.requestHost = Utils.UrlDecode(s);
i.path = k;
break;
@ -645,30 +645,30 @@ namespace v2rayN.Handler
{
case "tcp":
item.headerType = query["headerType"] ?? "none";
item.requestHost = query["host"] ?? "";
item.requestHost = Utils.UrlDecode(query["host"] ?? "");
break;
case "kcp":
item.headerType = query["headerType"] ?? "none";
item.path = query["seed"] ?? "";
item.path = Utils.UrlDecode(query["seed"] ?? "");
break;
case "ws":
item.requestHost = query["host"] ?? "";
item.path = query["path"] ?? "/";
item.requestHost = Utils.UrlDecode(query["host"] ?? "");
item.path = Utils.UrlDecode(query["path"] ?? "/");
break;
case "http":
case "h2":
item.network = "h2";
item.requestHost = query["host"] ?? "";
item.path = query["path"] ?? "/";
item.requestHost = Utils.UrlDecode(query["host"] ?? "");
item.path = Utils.UrlDecode(query["path"] ?? "/");
break;
case "quic":
item.headerType = query["headerType"] ?? "none";
item.requestHost = query["quicSecurity"] ?? "none";
item.path = query["key"] ?? "";
item.path = Utils.UrlDecode(query["key"] ?? "");
break;
default:

View File

@ -170,6 +170,10 @@ namespace v2rayN.Mode
{
get; set;
}
public bool ignoreGeoUpdateCore
{
get; set;
}
#region 函数

View File

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

View File

@ -68,7 +68,7 @@ namespace v2rayN.Tool
throw ex;
}
}
public static bool ZipExtractToFile(string fileName)
public static bool ZipExtractToFile(string fileName, string ignoredName)
{
try
{
@ -82,6 +82,10 @@ namespace v2rayN.Tool
}
try
{
if (!Utils.IsNullOrEmpty(ignoredName) && entry.Name.Contains(ignoredName))
{
continue;
}
entry.ExtractToFile(Utils.GetPath(entry.Name), true);
}
catch (IOException ex)

View File

@ -20,11 +20,12 @@ using ZXing.QrCode;
using System.Security.Principal;
using v2rayN.Base;
using Newtonsoft.Json.Linq;
using System.Web;
namespace v2rayN
{
class Utils
{
{
#region 资源Json操作
@ -369,6 +370,14 @@ namespace v2rayN
result = list;
}
public static string UrlEncode(string url)
{
return HttpUtility.UrlEncode(url);
}
public static string UrlDecode(string url)
{
return HttpUtility.UrlDecode(url);
}
#endregion