From 60a319a4828e1c8816333b276da9f9d4a171c587 Mon Sep 17 00:00:00 2001
From: 2dust <31833384+2dust@users.noreply.github.com>
Date: Thu, 8 Sep 2022 20:52:44 +0800
Subject: [PATCH] Add v2fly_v5 support
---
v2rayN/v2rayN/Forms/MainForm.Designer.cs | 30 +-
v2rayN/v2rayN/Forms/MainForm.cs | 2 +-
v2rayN/v2rayN/Forms/MainForm.resx | 593 ++++++++++----------
v2rayN/v2rayN/Forms/MainForm.zh-Hans.resx | 2 +-
v2rayN/v2rayN/Global.cs | 2 +-
v2rayN/v2rayN/Handler/LazyConfig.cs | 17 +-
v2rayN/v2rayN/Handler/UpdateHandle.cs | 2 +
v2rayN/v2rayN/Handler/V2rayConfigHandler.cs | 1 +
v2rayN/v2rayN/Mode/ECoreType.cs | 1 +
9 files changed, 335 insertions(+), 315 deletions(-)
diff --git a/v2rayN/v2rayN/Forms/MainForm.Designer.cs b/v2rayN/v2rayN/Forms/MainForm.Designer.cs
index 98c1b436..f0cb9d9c 100644
--- a/v2rayN/v2rayN/Forms/MainForm.Designer.cs
+++ b/v2rayN/v2rayN/Forms/MainForm.Designer.cs
@@ -68,9 +68,9 @@
this.menuExport2ServerConfig = new System.Windows.Forms.ToolStripMenuItem();
this.menuExport2ShareUrl = new System.Windows.Forms.ToolStripMenuItem();
this.menuExport2SubContent = new System.Windows.Forms.ToolStripMenuItem();
+ this.tsbServer = new System.Windows.Forms.ToolStripDropDownButton();
this.tabGroup = new System.Windows.Forms.TabControl();
this.qrCodeControl = new v2rayN.Forms.QRCodeControl();
- this.tsbServer = new System.Windows.Forms.ToolStripDropDownButton();
this.scBig = new System.Windows.Forms.SplitContainer();
this.gbServers = new System.Windows.Forms.GroupBox();
this.mainMsgControl = new v2rayN.Forms.MainMsgControl();
@@ -107,6 +107,7 @@
this.tsbGroupSetting = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator14 = new System.Windows.Forms.ToolStripSeparator();
this.tsbBackupGuiNConfig = new System.Windows.Forms.ToolStripMenuItem();
+ this.tsbRestoreGuiNConfig = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator();
this.tsbReload = new System.Windows.Forms.ToolStripButton();
this.toolStripSeparator7 = new System.Windows.Forms.ToolStripSeparator();
@@ -130,7 +131,6 @@
this.tsbPromotion = new System.Windows.Forms.ToolStripButton();
this.toolStripSeparator11 = new System.Windows.Forms.ToolStripSeparator();
this.tsbClose = new System.Windows.Forms.ToolStripButton();
- this.tsbRestoreGuiNConfig = new System.Windows.Forms.ToolStripMenuItem();
((System.ComponentModel.ISupportInitialize)(this.scServers)).BeginInit();
this.scServers.Panel1.SuspendLayout();
this.scServers.Panel2.SuspendLayout();
@@ -430,6 +430,13 @@
resources.ApplyResources(this.menuExport2SubContent, "menuExport2SubContent");
this.menuExport2SubContent.Click += new System.EventHandler(this.menuExport2SubContent_Click);
//
+ // tsbServer
+ //
+ this.tsbServer.DropDown = this.cmsLv;
+ this.tsbServer.Image = global::v2rayN.Properties.Resources.server;
+ resources.ApplyResources(this.tsbServer, "tsbServer");
+ this.tsbServer.Name = "tsbServer";
+ //
// tabGroup
//
resources.ApplyResources(this.tabGroup, "tabGroup");
@@ -442,13 +449,6 @@
resources.ApplyResources(this.qrCodeControl, "qrCodeControl");
this.qrCodeControl.Name = "qrCodeControl";
//
- // tsbServer
- //
- this.tsbServer.DropDown = this.cmsLv;
- this.tsbServer.Image = global::v2rayN.Properties.Resources.server;
- resources.ApplyResources(this.tsbServer, "tsbServer");
- this.tsbServer.Name = "tsbServer";
- //
// scBig
//
resources.ApplyResources(this.scBig, "scBig");
@@ -715,6 +715,12 @@
resources.ApplyResources(this.tsbBackupGuiNConfig, "tsbBackupGuiNConfig");
this.tsbBackupGuiNConfig.Click += new System.EventHandler(this.tsbBackupGuiNConfig_Click);
//
+ // tsbRestoreGuiNConfig
+ //
+ this.tsbRestoreGuiNConfig.Name = "tsbRestoreGuiNConfig";
+ resources.ApplyResources(this.tsbRestoreGuiNConfig, "tsbRestoreGuiNConfig");
+ this.tsbRestoreGuiNConfig.Click += new System.EventHandler(this.tsbRestoreGuiNConfig_Click);
+ //
// toolStripSeparator5
//
this.toolStripSeparator5.Name = "toolStripSeparator5";
@@ -866,12 +872,6 @@
this.tsbClose.Name = "tsbClose";
this.tsbClose.Click += new System.EventHandler(this.tsbClose_Click);
//
- // tsbRestoreGuiNConfig
- //
- this.tsbRestoreGuiNConfig.Name = "tsbRestoreGuiNConfig";
- resources.ApplyResources(this.tsbRestoreGuiNConfig, "tsbRestoreGuiNConfig");
- this.tsbRestoreGuiNConfig.Click += new System.EventHandler(this.tsbRestoreGuiNConfig_Click);
- //
// MainForm
//
resources.ApplyResources(this, "$this");
diff --git a/v2rayN/v2rayN/Forms/MainForm.cs b/v2rayN/v2rayN/Forms/MainForm.cs
index c5118ed7..03454860 100644
--- a/v2rayN/v2rayN/Forms/MainForm.cs
+++ b/v2rayN/v2rayN/Forms/MainForm.cs
@@ -1382,7 +1382,7 @@ namespace v2rayN.Forms
private void tsbCheckUpdateCore_Click(object sender, EventArgs e)
{
- CheckUpdateCore(ECoreType.v2fly);
+ CheckUpdateCore(ECoreType.v2fly_v5);
}
private void tsbCheckUpdateSagerNetCore_Click(object sender, EventArgs e)
diff --git a/v2rayN/v2rayN/Forms/MainForm.resx b/v2rayN/v2rayN/Forms/MainForm.resx
index ebf2419a..5579b14a 100644
--- a/v2rayN/v2rayN/Forms/MainForm.resx
+++ b/v2rayN/v2rayN/Forms/MainForm.resx
@@ -123,181 +123,205 @@
- 3, 17
+ 3, 21
-
+
226, 19
-
+
- 355, 22
+ 423, 24
Add [VMess] server
- 355, 22
+ 423, 24
Add [VLESS] server
- 355, 22
+ 423, 24
Add [Shadowsocks] server
- 355, 22
+ 423, 24
Add [Socks] server
- 355, 22
+ 423, 24
Add [Trojan] server
- 355, 22
+ 423, 24
Add a custom configuration server
- 355, 22
+ 423, 24
Import bulk URL from clipboard (Ctrl+V)
- 355, 22
+ 423, 24
Scan QR code on the screen (Ctrl+S)
- 352, 6
+ 420, 6
- 355, 22
+ 423, 24
Set server filter (Ctrl+F)
- 355, 22
+ 423, 24
Remove selected servers (Delete)
- 355, 22
+ 423, 24
Remove duplicate servers
- 355, 22
+ 423, 24
Clone selected server
- 355, 22
+ 423, 24
Set as active server (Enter)
- 352, 6
+ 420, 6
- 355, 22
+ 423, 24
Move to Group
+
+ 237, 26
+
+
+ Move to top (T)
+
+
+ 237, 26
+
+
+ Up (U)
+
+
+ 237, 26
+
+
+ Down (D)
+
+
+ 237, 26
+
+
+ Move to bottom (B)
+
- 355, 22
+ 423, 24
Move to
- 355, 22
+ 423, 24
Select All (Ctrl+A)
- 352, 6
+ 420, 6
- 355, 22
+ 423, 24
Test servers ping (Ctrl+P)
- 355, 22
+ 423, 24
Test servers with tcping (Ctrl+O)
- 355, 22
+ 423, 24
Test servers real delay (Ctrl+R)
- 355, 22
+ 423, 24
Test servers download speed (Ctrl+T)
- 355, 22
+ 423, 24
Sort by test result (Ctrl+E)
- 355, 22
+ 423, 24
Test current service status
- 355, 22
+ 423, 24
Clear all service statistics
- 352, 6
+ 420, 6
- 355, 22
+ 423, 24
Export selected server for client configuration
- 355, 22
+ 423, 24
Export selected server for server configuration
- 355, 22
+ 423, 24
Export share URLs to clipboard (Ctrl+C)
- 355, 22
+ 423, 24
Export subscription (base64) share to clipboard
@@ -306,7 +330,7 @@
Magenta
- 64, 53
+ 77, 56
Servers
@@ -315,7 +339,7 @@
ImageAboveText
- 356, 622
+ 424, 676
cmsLv
@@ -347,7 +371,7 @@
0, 20
- 686, 260
+ 1003, 338
@@ -357,7 +381,7 @@
lvServers
- v2rayN.Base.ListViewFlickerFree, v2rayN, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
+ v2rayN.Base.ListViewFlickerFree, v2rayN, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
scServers.Panel1
@@ -372,7 +396,7 @@
0, 0
- 686, 20
+ 1003, 20
0
@@ -411,7 +435,7 @@
4, 4, 4, 4
- 256, 280
+ 256, 358
2
@@ -420,7 +444,7 @@
qrCodeControl
- v2rayN.Forms.QRCodeControl, v2rayN, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
+ v2rayN.Forms.QRCodeControl, v2rayN, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
scServers.Panel2
@@ -444,10 +468,10 @@
100
- 946, 280
+ 1263, 358
- 686
+ 1003
0
@@ -464,35 +488,11 @@
0
-
- 192, 22
-
-
- Move to top (T)
-
-
- 192, 22
-
-
- Up (U)
-
-
- 192, 22
-
-
- Down (D)
-
-
- 192, 22
-
-
- Move to bottom (B)
-
Fill
- 0, 66
+ 0, 69
Horizontal
@@ -504,7 +504,7 @@
0, 0
- 952, 300
+ 1269, 382
0
@@ -539,8 +539,11 @@
0, 0
+
+ 4, 4, 4, 4
+
- 952, 223
+ 1269, 286
0
@@ -549,7 +552,7 @@
mainMsgControl
- v2rayN.Forms.MainMsgControl, v2rayN, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
+ v2rayN.Forms.MainMsgControl, v2rayN, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
scBig.Panel2
@@ -570,10 +573,10 @@
1
- 952, 527
+ 1269, 672
- 300
+ 382
5
@@ -590,17 +593,89 @@
2
-
+
17, 17
-
-
+
+
137, 17
-
+
NoControl
+
+ 300, 26
+
+
+ Clear system proxy
+
+
+ 300, 26
+
+
+ Set system proxy
+
+
+ 300, 26
+
+
+ Do not change system proxy
+
+
+ 332, 24
+
+
+ System proxy
+
+
+ 332, 24
+
+
+ Routing
+
+
+ 332, 24
+
+
+ Server
+
+
+ 329, 6
+
+
+ 332, 24
+
+
+ Import bulk URL from clipboard
+
+
+ 332, 24
+
+
+ Scan QR code on the screen
+
+
+ 332, 24
+
+
+ Update subscription without proxy
+
+
+ 332, 24
+
+
+ Update subscriptions via proxy
+
+
+ 329, 6
+
+
+ 332, 24
+
+
+ Exit
+
- 278, 192
+ 333, 208
cmsMain
@@ -614,86 +689,14 @@
True
-
- 277, 22
-
-
- System proxy
-
-
- 243, 22
-
-
- Clear system proxy
-
-
- 243, 22
-
-
- Set system proxy
-
-
- 243, 22
-
-
- Do not change system proxy
-
-
- 277, 22
-
-
- Routing
-
-
- 277, 22
-
-
- Server
-
-
- 274, 6
-
-
- 277, 22
-
-
- Import bulk URL from clipboard
-
-
- 277, 22
-
-
- Scan QR code on the screen
-
-
- 277, 22
-
-
- Update subscription without proxy
-
-
- 277, 22
-
-
- Update subscriptions via proxy
-
-
- 274, 6
-
-
- 277, 22
-
-
- Exit
-
Top
- 0, 56
+ 0, 59
- 952, 10
+ 1269, 10
2
@@ -710,17 +713,47 @@
3
-
+
315, 17
-
+
- 6, 56
+ 6, 59
+
+
+ 395, 26
+
+
+ Settings
+
+
+ 395, 26
+
+
+ Update subscription without proxy
+
+
+ 395, 26
+
+
+ Update subscription with proxy
+
+
+ 395, 26
+
+
+ Update group subscription without proxy
+
+
+ 395, 26
+
+
+ Update group subscription with proxy
Magenta
- 99, 53
+ 122, 56
Subscriptions
@@ -732,7 +765,7 @@
Magenta
- 45, 53
+ 54, 56
Share
@@ -744,43 +777,43 @@
ImageAboveText
- 6, 56
+ 6, 59
- 195, 22
+ 245, 26
OptionSetting
- 195, 22
+ 245, 26
RoutingSetting
- 195, 22
+ 245, 26
GlobalHotkeySetting
- 195, 22
+ 245, 26
GroupSetting
- 192, 6
+ 242, 6
- 195, 22
+ 245, 26
BackupGuiConfig
- 195, 22
+ 245, 26
RestoreGuiNConfig
@@ -789,7 +822,7 @@
Magenta
- 67, 53
+ 83, 56
Settings
@@ -798,7 +831,7 @@
ImageAboveText
- 6, 56
+ 6, 59
BottomCenter
@@ -807,7 +840,7 @@
Magenta
- 97, 53
+ 120, 56
Restart service
@@ -816,13 +849,61 @@
ImageAboveText
- 6, 56
+ 6, 59
+
+
+ 269, 26
+
+
+ v2rayN (this software)
+
+
+ 269, 26
+
+
+ Update v2fly_v5 Core
+
+
+ 269, 26
+
+
+ Update SagerNet Core
+
+
+ 269, 26
+
+
+ Update Xray Core
+
+
+ 266, 6
+
+
+ 269, 26
+
+
+ Update clash Core
+
+
+ 269, 26
+
+
+ Update Clash.Meta Core
+
+
+ 266, 6
+
+
+ 269, 26
+
+
+ Update Geo files
Magenta
- 128, 53
+ 155, 56
Check for updates
@@ -831,13 +912,40 @@
ImageAboveText
- 6, 56
+ 6, 59
+
+
+ 230, 26
+
+
+ v2rayN Project
+
+
+ 230, 26
+
+
+ V2Ray Website
+
+
+ 227, 6
+
+
+ 230, 26
+
+
+ Language-[English]
+
+
+ 230, 26
+
+
+ 语言-[中文简体]
Magenta
- 48, 53
+ 58, 56
Help
@@ -849,7 +957,7 @@
Magenta
- 89, 53
+ 107, 56
Promotion
@@ -858,13 +966,13 @@
ImageAboveText
- 6, 56
+ 6, 59
Magenta
- 52, 53
+ 61, 56
Close
@@ -876,7 +984,7 @@
0, 0
- 952, 56
+ 1269, 59
1
@@ -893,125 +1001,20 @@
4
-
- 317, 22
-
-
- Settings
-
-
- 317, 22
-
-
- Update subscription without proxy
-
-
- 317, 22
-
-
- Update subscription with proxy
-
-
- 317, 22
-
-
- Update group subscription without proxy
-
-
- 317, 22
-
-
- Update group subscription with proxy
-
-
- 219, 22
-
-
- v2rayN (this software)
-
-
- 219, 22
-
-
- Update v2fly Core
-
-
- 219, 22
-
-
- Update SagerNet Core
-
-
- 219, 22
-
-
- Update Xray Core
-
-
- 216, 6
-
-
- 219, 22
-
-
- Update clash Core
-
-
- 219, 22
-
-
- Update Clash.Meta Core
-
-
- 216, 6
-
-
- 219, 22
-
-
- Update Geo files
-
-
- 187, 22
-
-
- v2rayN Project
-
-
- 187, 22
-
-
- V2Ray Website
-
-
- 184, 6
-
-
- 187, 22
-
-
- Language-[English]
-
-
- 187, 22
-
-
- 语言-[中文简体]
-
-
+
True
-
-
+
+
64
-
+
- 6, 12
+ 8, 15
- 952, 593
+ 1269, 741
- 4, 4, 4, 4
+ 5, 5, 5, 5
v2rayN
@@ -1412,6 +1415,12 @@
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ tsbRestoreGuiNConfig
+
+
+ System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
toolStripSeparator5
@@ -1550,16 +1559,10 @@
System.Windows.Forms.ToolStripButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
- tsbRestoreGuiNConfig
-
-
- System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
MainForm
- v2rayN.Forms.BaseForm, v2rayN, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
+ v2rayN.Forms.BaseForm, v2rayN, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
\ No newline at end of file
diff --git a/v2rayN/v2rayN/Forms/MainForm.zh-Hans.resx b/v2rayN/v2rayN/Forms/MainForm.zh-Hans.resx
index e8e04d0d..7cbc3ae7 100644
--- a/v2rayN/v2rayN/Forms/MainForm.zh-Hans.resx
+++ b/v2rayN/v2rayN/Forms/MainForm.zh-Hans.resx
@@ -505,7 +505,7 @@
168, 22
- v2fly-Core
+ v2fly_v5-Core
168, 22
diff --git a/v2rayN/v2rayN/Global.cs b/v2rayN/v2rayN/Global.cs
index 83dcc8cb..88a677e3 100644
--- a/v2rayN/v2rayN/Global.cs
+++ b/v2rayN/v2rayN/Global.cs
@@ -213,7 +213,7 @@ namespace v2rayN
public static readonly List xtlsFlows = new List { "", "xtls-rprx-origin", "xtls-rprx-origin-udp443", "xtls-rprx-direct", "xtls-rprx-direct-udp443" };
public static readonly List networks = new List { "tcp", "kcp", "ws", "h2", "quic", "grpc" };
public static readonly List kcpHeaderTypes = new List { "srtp", "utp", "wechat-video", "dtls", "wireguard" };
- public static readonly List coreTypes = new List { "v2fly", "SagerNet", "Xray" };
+ public static readonly List coreTypes = new List { "v2fly", "SagerNet", "Xray" , "v2fly_v5" };
public static readonly List domainMatchers = new List { "linear", "mph", "" };
public const string GrpcgunMode = "gun";
public const string GrpcmultiMode = "multi";
diff --git a/v2rayN/v2rayN/Handler/LazyConfig.cs b/v2rayN/v2rayN/Handler/LazyConfig.cs
index 33f9ee37..b26f9dea 100644
--- a/v2rayN/v2rayN/Handler/LazyConfig.cs
+++ b/v2rayN/v2rayN/Handler/LazyConfig.cs
@@ -31,7 +31,7 @@ namespace v2rayN.Handler
if (GetCoreType(vmessItem, EConfigType.Shadowsocks) == ECoreType.Xray)
{
return Global.ssSecuritysInXray;
- }
+ }
return Global.ssSecuritysInSagerNet;
}
@@ -93,7 +93,7 @@ namespace v2rayN.Handler
coreInfos.Add(new CoreInfo
{
coreType = ECoreType.SagerNet,
- coreExes = new List { "v2ray" },
+ coreExes = new List { "SagerNet", "v2ray" },
arguments = "run",
coreUrl = Global.SagerNetCoreUrl,
coreReleaseApiUrl = Global.SagerNetCoreUrl.Replace(@"https://github.com", @"https://api.github.com/repos"),
@@ -103,6 +103,19 @@ namespace v2rayN.Handler
versionArg = "version"
});
+ coreInfos.Add(new CoreInfo
+ {
+ coreType = ECoreType.v2fly_v5,
+ coreExes = new List { "v2ray" },
+ arguments = "run",
+ coreUrl = Global.v2flyCoreUrl,
+ coreReleaseApiUrl = Global.v2flyCoreUrl.Replace(@"https://github.com", @"https://api.github.com/repos"),
+ coreDownloadUrl32 = Global.v2flyCoreUrl + "/download/{0}/v2ray-windows-{1}.zip",
+ coreDownloadUrl64 = Global.v2flyCoreUrl + "/download/{0}/v2ray-windows-{1}.zip",
+ match = "V2Ray",
+ versionArg = "version"
+ });
+
coreInfos.Add(new CoreInfo
{
coreType = ECoreType.Xray,
diff --git a/v2rayN/v2rayN/Handler/UpdateHandle.cs b/v2rayN/v2rayN/Handler/UpdateHandle.cs
index f124753e..a6468fc9 100644
--- a/v2rayN/v2rayN/Handler/UpdateHandle.cs
+++ b/v2rayN/v2rayN/Handler/UpdateHandle.cs
@@ -383,6 +383,7 @@ namespace v2rayN.Handler
case ECoreType.v2fly:
case ECoreType.SagerNet:
case ECoreType.Xray:
+ case ECoreType.v2fly_v5:
version = Regex.Match(echo, $"{coreInfo.match} ([0-9.]+) \\(").Groups[1].Value;
break;
case ECoreType.clash:
@@ -423,6 +424,7 @@ namespace v2rayN.Handler
case ECoreType.v2fly:
case ECoreType.SagerNet:
case ECoreType.Xray:
+ case ECoreType.v2fly_v5:
{
curVersion = "v" + getCoreVersion(type);
message = string.Format(ResUI.IsLatestCore, curVersion);
diff --git a/v2rayN/v2rayN/Handler/V2rayConfigHandler.cs b/v2rayN/v2rayN/Handler/V2rayConfigHandler.cs
index 893350ce..1f09b30a 100644
--- a/v2rayN/v2rayN/Handler/V2rayConfigHandler.cs
+++ b/v2rayN/v2rayN/Handler/V2rayConfigHandler.cs
@@ -951,6 +951,7 @@ namespace v2rayN.Handler
case ECoreType.v2fly:
case ECoreType.SagerNet:
case ECoreType.Xray:
+ case ECoreType.v2fly_v5:
break;
case ECoreType.clash:
case ECoreType.clash_meta:
diff --git a/v2rayN/v2rayN/Mode/ECoreType.cs b/v2rayN/v2rayN/Mode/ECoreType.cs
index 74d72756..be3946ff 100644
--- a/v2rayN/v2rayN/Mode/ECoreType.cs
+++ b/v2rayN/v2rayN/Mode/ECoreType.cs
@@ -6,6 +6,7 @@ namespace v2rayN.Mode
v2fly = 1,
Xray = 2,
SagerNet = 3,
+ v2fly_v5 = 4,
clash = 11,
clash_meta = 12,
hysteria = 21,