Compare commits

...

14 Commits
2.37 ... 2.38

Author SHA1 Message Date
2dust
d0ca8b2996 up grpc state 2019-08-30 10:22:28 +08:00
2dust
3154df1bde Update StatisticsHandler.cs 2019-08-29 17:30:44 +08:00
2dust
3cdff624ba Merge pull request #46 from CGQAQ/dev
try 放在循环内,有异常不会退出循环。捕获漏网之鱼(syste.memory.dll)
2019-08-28 13:14:06 +08:00
CGQAQ
3cd80a20bb try 放在循环内,有异常不会退出循环。有个漏网之鱼(syste.memory.dll) 2019-08-28 09:43:29 +08:00
2dust
8986a96100 Merge pull request #45 from CGQAQ/dev
只能先这样了
2019-08-28 08:05:49 +08:00
CGQAQ
612ad30660 2019-08-27 18:40:15 +08:00
CGQAQ
bc6517626e 只能先这样了
grpc_csharp_ext.x86.dll 和 grpc_csharp_ext.x64dll 没办法引用,所有只能放到output目录里了
2019-08-27 18:29:41 +08:00
2dust
99e9425942 Merge pull request #44 from CGQAQ/dev
统计切换为grpc
2019-08-27 15:58:21 +08:00
CGQAQ
d555081820 统计切换为grpc 2019-08-27 15:51:15 +08:00
2dust
a3f42e1e25 Merge pull request #43 from CGQAQ/dev
去重加入host
2019-08-27 13:06:58 +08:00
CGQAQ
52b31fba1e delete useless code due to remove auto reboot 2019-08-27 12:17:58 +08:00
CGQAQ
328c0be6e9 Update Utils.cs 2019-08-27 12:16:18 +08:00
CGQAQ
65d2db55f8 Merge remote-tracking branch 'upstream/master' into dev 2019-08-27 12:10:28 +08:00
CGQAQ
7459ada9c0 去重加入host
现在判定两个server是不是一样的要看address port path 和 host
2019-08-26 17:20:49 +08:00
32 changed files with 1535 additions and 2076 deletions

1
.gitignore vendored
View File

@@ -9,6 +9,7 @@
/v2rayN/.vs/v2rayN/DesignTimeBuild
/v2rayN/v2rayN/bin/Release
/v2rayN/v2rayN/obj/Release
/v2rayN/packages
.vs/ProjectSettings.json
.vs/slnx.sqlite
.vs/VSWorkspaceState.json

View File

@@ -136,19 +136,17 @@
//
// splitContainer1.Panel1
//
resources.ApplyResources(this.splitContainer1.Panel1, "splitContainer1.Panel1");
this.splitContainer1.Panel1.Controls.Add(this.lvServers);
//
// splitContainer1.Panel2
//
resources.ApplyResources(this.splitContainer1.Panel2, "splitContainer1.Panel2");
this.splitContainer1.Panel2.Controls.Add(this.qrCodeControl);
this.splitContainer1.SplitterMoved += new System.Windows.Forms.SplitterEventHandler(this.splitContainer1_SplitterMoved);
//
// lvServers
//
resources.ApplyResources(this.lvServers, "lvServers");
this.lvServers.ContextMenuStrip = this.cmsLv;
resources.ApplyResources(this.lvServers, "lvServers");
this.lvServers.FullRowSelect = true;
this.lvServers.GridLines = true;
this.lvServers.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
@@ -165,7 +163,6 @@
//
// cmsLv
//
resources.ApplyResources(this.cmsLv, "cmsLv");
this.cmsLv.ImageScalingSize = new System.Drawing.Size(20, 20);
this.cmsLv.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.menuAddVmessServer,
@@ -195,158 +192,159 @@
this.menuExport2SubContent});
this.cmsLv.Name = "cmsLv";
this.cmsLv.OwnerItem = this.tsbServer;
resources.ApplyResources(this.cmsLv, "cmsLv");
//
// menuAddVmessServer
//
resources.ApplyResources(this.menuAddVmessServer, "menuAddVmessServer");
this.menuAddVmessServer.Name = "menuAddVmessServer";
resources.ApplyResources(this.menuAddVmessServer, "menuAddVmessServer");
this.menuAddVmessServer.Click += new System.EventHandler(this.menuAddVmessServer_Click);
//
// menuAddShadowsocksServer
//
resources.ApplyResources(this.menuAddShadowsocksServer, "menuAddShadowsocksServer");
this.menuAddShadowsocksServer.Name = "menuAddShadowsocksServer";
resources.ApplyResources(this.menuAddShadowsocksServer, "menuAddShadowsocksServer");
this.menuAddShadowsocksServer.Click += new System.EventHandler(this.menuAddShadowsocksServer_Click);
//
// menuAddSocksServer
//
resources.ApplyResources(this.menuAddSocksServer, "menuAddSocksServer");
this.menuAddSocksServer.Name = "menuAddSocksServer";
resources.ApplyResources(this.menuAddSocksServer, "menuAddSocksServer");
this.menuAddSocksServer.Click += new System.EventHandler(this.menuAddSocksServer_Click);
//
// menuAddCustomServer
//
resources.ApplyResources(this.menuAddCustomServer, "menuAddCustomServer");
this.menuAddCustomServer.Name = "menuAddCustomServer";
resources.ApplyResources(this.menuAddCustomServer, "menuAddCustomServer");
this.menuAddCustomServer.Click += new System.EventHandler(this.menuAddCustomServer_Click);
//
// menuAddServers
//
resources.ApplyResources(this.menuAddServers, "menuAddServers");
this.menuAddServers.Name = "menuAddServers";
resources.ApplyResources(this.menuAddServers, "menuAddServers");
this.menuAddServers.Click += new System.EventHandler(this.menuAddServers_Click);
//
// menuScanScreen
//
resources.ApplyResources(this.menuScanScreen, "menuScanScreen");
this.menuScanScreen.Name = "menuScanScreen";
resources.ApplyResources(this.menuScanScreen, "menuScanScreen");
this.menuScanScreen.Click += new System.EventHandler(this.menuScanScreen_Click);
//
// toolStripSeparator1
//
resources.ApplyResources(this.toolStripSeparator1, "toolStripSeparator1");
this.toolStripSeparator1.Name = "toolStripSeparator1";
resources.ApplyResources(this.toolStripSeparator1, "toolStripSeparator1");
//
// menuRemoveServer
//
resources.ApplyResources(this.menuRemoveServer, "menuRemoveServer");
this.menuRemoveServer.Name = "menuRemoveServer";
resources.ApplyResources(this.menuRemoveServer, "menuRemoveServer");
this.menuRemoveServer.Click += new System.EventHandler(this.menuRemoveServer_Click);
//
// menuRemoveDuplicateServer
//
resources.ApplyResources(this.menuRemoveDuplicateServer, "menuRemoveDuplicateServer");
this.menuRemoveDuplicateServer.Name = "menuRemoveDuplicateServer";
resources.ApplyResources(this.menuRemoveDuplicateServer, "menuRemoveDuplicateServer");
this.menuRemoveDuplicateServer.Click += new System.EventHandler(this.menuRemoveDuplicateServer_Click);
//
// menuCopyServer
//
resources.ApplyResources(this.menuCopyServer, "menuCopyServer");
this.menuCopyServer.Name = "menuCopyServer";
resources.ApplyResources(this.menuCopyServer, "menuCopyServer");
this.menuCopyServer.Click += new System.EventHandler(this.menuCopyServer_Click);
//
// menuSetDefaultServer
//
resources.ApplyResources(this.menuSetDefaultServer, "menuSetDefaultServer");
this.menuSetDefaultServer.Name = "menuSetDefaultServer";
resources.ApplyResources(this.menuSetDefaultServer, "menuSetDefaultServer");
this.menuSetDefaultServer.Click += new System.EventHandler(this.menuSetDefaultServer_Click);
//
// toolStripSeparator3
//
resources.ApplyResources(this.toolStripSeparator3, "toolStripSeparator3");
this.toolStripSeparator3.Name = "toolStripSeparator3";
resources.ApplyResources(this.toolStripSeparator3, "toolStripSeparator3");
//
// menuMoveTop
//
resources.ApplyResources(this.menuMoveTop, "menuMoveTop");
this.menuMoveTop.Name = "menuMoveTop";
resources.ApplyResources(this.menuMoveTop, "menuMoveTop");
this.menuMoveTop.Click += new System.EventHandler(this.menuMoveTop_Click);
//
// menuMoveUp
//
resources.ApplyResources(this.menuMoveUp, "menuMoveUp");
this.menuMoveUp.Name = "menuMoveUp";
resources.ApplyResources(this.menuMoveUp, "menuMoveUp");
this.menuMoveUp.Click += new System.EventHandler(this.menuMoveUp_Click);
//
// menuMoveDown
//
resources.ApplyResources(this.menuMoveDown, "menuMoveDown");
this.menuMoveDown.Name = "menuMoveDown";
resources.ApplyResources(this.menuMoveDown, "menuMoveDown");
this.menuMoveDown.Click += new System.EventHandler(this.menuMoveDown_Click);
//
// menuMoveBottom
//
resources.ApplyResources(this.menuMoveBottom, "menuMoveBottom");
this.menuMoveBottom.Name = "menuMoveBottom";
resources.ApplyResources(this.menuMoveBottom, "menuMoveBottom");
this.menuMoveBottom.Click += new System.EventHandler(this.menuMoveBottom_Click);
//
// menuSelectAll
//
resources.ApplyResources(this.menuSelectAll, "menuSelectAll");
this.menuSelectAll.Name = "menuSelectAll";
resources.ApplyResources(this.menuSelectAll, "menuSelectAll");
this.menuSelectAll.Click += new System.EventHandler(this.menuSelectAll_Click);
//
// toolStripSeparator9
//
resources.ApplyResources(this.toolStripSeparator9, "toolStripSeparator9");
this.toolStripSeparator9.Name = "toolStripSeparator9";
resources.ApplyResources(this.toolStripSeparator9, "toolStripSeparator9");
//
// menuPingServer
//
resources.ApplyResources(this.menuPingServer, "menuPingServer");
this.menuPingServer.Name = "menuPingServer";
resources.ApplyResources(this.menuPingServer, "menuPingServer");
this.menuPingServer.Click += new System.EventHandler(this.menuPingServer_Click);
//
// menuSpeedServer
//
resources.ApplyResources(this.menuSpeedServer, "menuSpeedServer");
this.menuSpeedServer.Name = "menuSpeedServer";
resources.ApplyResources(this.menuSpeedServer, "menuSpeedServer");
this.menuSpeedServer.Click += new System.EventHandler(this.menuSpeedServer_Click);
//
// toolStripSeparator6
//
resources.ApplyResources(this.toolStripSeparator6, "toolStripSeparator6");
this.toolStripSeparator6.Name = "toolStripSeparator6";
resources.ApplyResources(this.toolStripSeparator6, "toolStripSeparator6");
//
// menuExport2ClientConfig
//
resources.ApplyResources(this.menuExport2ClientConfig, "menuExport2ClientConfig");
this.menuExport2ClientConfig.Name = "menuExport2ClientConfig";
resources.ApplyResources(this.menuExport2ClientConfig, "menuExport2ClientConfig");
this.menuExport2ClientConfig.Click += new System.EventHandler(this.menuExport2ClientConfig_Click);
//
// menuExport2ServerConfig
//
resources.ApplyResources(this.menuExport2ServerConfig, "menuExport2ServerConfig");
this.menuExport2ServerConfig.Name = "menuExport2ServerConfig";
resources.ApplyResources(this.menuExport2ServerConfig, "menuExport2ServerConfig");
this.menuExport2ServerConfig.Click += new System.EventHandler(this.menuExport2ServerConfig_Click);
//
// menuExport2ShareUrl
//
resources.ApplyResources(this.menuExport2ShareUrl, "menuExport2ShareUrl");
this.menuExport2ShareUrl.Name = "menuExport2ShareUrl";
resources.ApplyResources(this.menuExport2ShareUrl, "menuExport2ShareUrl");
this.menuExport2ShareUrl.Click += new System.EventHandler(this.menuExport2ShareUrl_Click);
//
// menuExport2SubContent
//
resources.ApplyResources(this.menuExport2SubContent, "menuExport2SubContent");
this.menuExport2SubContent.Name = "menuExport2SubContent";
resources.ApplyResources(this.menuExport2SubContent, "menuExport2SubContent");
this.menuExport2SubContent.Click += new System.EventHandler(this.menuExport2SubContent_Click);
//
// tsbServer
//
resources.ApplyResources(this.tsbServer, "tsbServer");
this.tsbServer.DropDown = this.cmsLv;
this.tsbServer.Image = global::v2rayN.Properties.Resources.server;
resources.ApplyResources(this.tsbServer, "tsbServer");
this.tsbServer.Name = "tsbServer";
//
// qrCodeControl
@@ -356,14 +354,14 @@
//
// notifyMain
//
resources.ApplyResources(this.notifyMain, "notifyMain");
this.notifyMain.ContextMenuStrip = this.cmsMain;
resources.ApplyResources(this.notifyMain, "notifyMain");
this.notifyMain.MouseClick += new System.Windows.Forms.MouseEventHandler(this.notifyMain_MouseClick);
//
// cmsMain
//
resources.ApplyResources(this.cmsMain, "cmsMain");
this.cmsMain.ImageScalingSize = new System.Drawing.Size(20, 20);
resources.ApplyResources(this.cmsMain, "cmsMain");
this.cmsMain.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.menuSysAgentEnabled,
this.menuSysAgentMode,
@@ -380,76 +378,76 @@
//
// menuSysAgentEnabled
//
resources.ApplyResources(this.menuSysAgentEnabled, "menuSysAgentEnabled");
this.menuSysAgentEnabled.Name = "menuSysAgentEnabled";
resources.ApplyResources(this.menuSysAgentEnabled, "menuSysAgentEnabled");
this.menuSysAgentEnabled.Click += new System.EventHandler(this.menuSysAgentEnabled_Click);
//
// menuSysAgentMode
//
resources.ApplyResources(this.menuSysAgentMode, "menuSysAgentMode");
this.menuSysAgentMode.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.menuGlobal,
this.menuGlobalPAC,
this.menuKeep,
this.menuKeepPAC});
this.menuSysAgentMode.Name = "menuSysAgentMode";
resources.ApplyResources(this.menuSysAgentMode, "menuSysAgentMode");
//
// menuGlobal
//
resources.ApplyResources(this.menuGlobal, "menuGlobal");
this.menuGlobal.Name = "menuGlobal";
resources.ApplyResources(this.menuGlobal, "menuGlobal");
this.menuGlobal.Click += new System.EventHandler(this.menuGlobal_Click);
//
// menuGlobalPAC
//
resources.ApplyResources(this.menuGlobalPAC, "menuGlobalPAC");
this.menuGlobalPAC.Name = "menuGlobalPAC";
resources.ApplyResources(this.menuGlobalPAC, "menuGlobalPAC");
this.menuGlobalPAC.Click += new System.EventHandler(this.menuGlobalPAC_Click);
//
// menuKeep
//
resources.ApplyResources(this.menuKeep, "menuKeep");
this.menuKeep.Name = "menuKeep";
resources.ApplyResources(this.menuKeep, "menuKeep");
this.menuKeep.Click += new System.EventHandler(this.menuKeep_Click);
//
// menuKeepPAC
//
resources.ApplyResources(this.menuKeepPAC, "menuKeepPAC");
this.menuKeepPAC.Name = "menuKeepPAC";
resources.ApplyResources(this.menuKeepPAC, "menuKeepPAC");
this.menuKeepPAC.Click += new System.EventHandler(this.menuKeepPAC_Click);
//
// menuServers
//
resources.ApplyResources(this.menuServers, "menuServers");
this.menuServers.Name = "menuServers";
resources.ApplyResources(this.menuServers, "menuServers");
//
// menuAddServers2
//
resources.ApplyResources(this.menuAddServers2, "menuAddServers2");
this.menuAddServers2.Name = "menuAddServers2";
resources.ApplyResources(this.menuAddServers2, "menuAddServers2");
this.menuAddServers2.Click += new System.EventHandler(this.menuAddServers_Click);
//
// menuScanScreen2
//
resources.ApplyResources(this.menuScanScreen2, "menuScanScreen2");
this.menuScanScreen2.Name = "menuScanScreen2";
resources.ApplyResources(this.menuScanScreen2, "menuScanScreen2");
this.menuScanScreen2.Click += new System.EventHandler(this.menuScanScreen_Click);
//
// menuCopyPACUrl
//
resources.ApplyResources(this.menuCopyPACUrl, "menuCopyPACUrl");
this.menuCopyPACUrl.Name = "menuCopyPACUrl";
resources.ApplyResources(this.menuCopyPACUrl, "menuCopyPACUrl");
this.menuCopyPACUrl.Click += new System.EventHandler(this.menuCopyPACUrl_Click);
//
// toolStripSeparator2
//
resources.ApplyResources(this.toolStripSeparator2, "toolStripSeparator2");
this.toolStripSeparator2.Name = "toolStripSeparator2";
resources.ApplyResources(this.toolStripSeparator2, "toolStripSeparator2");
//
// menuExit
//
resources.ApplyResources(this.menuExit, "menuExit");
this.menuExit.Name = "menuExit";
resources.ApplyResources(this.menuExit, "menuExit");
this.menuExit.Click += new System.EventHandler(this.menuExit_Click);
//
// bgwPing
@@ -466,31 +464,30 @@
//
// groupBox1
//
resources.ApplyResources(this.groupBox1, "groupBox1");
this.groupBox1.Controls.Add(this.splitContainer1);
resources.ApplyResources(this.groupBox1, "groupBox1");
this.groupBox1.Name = "groupBox1";
this.groupBox1.TabStop = false;
//
// groupBox2
//
resources.ApplyResources(this.groupBox2, "groupBox2");
this.groupBox2.Controls.Add(this.txtMsgBox);
this.groupBox2.Controls.Add(this.ssMain);
resources.ApplyResources(this.groupBox2, "groupBox2");
this.groupBox2.Name = "groupBox2";
this.groupBox2.TabStop = false;
//
// txtMsgBox
//
resources.ApplyResources(this.txtMsgBox, "txtMsgBox");
this.txtMsgBox.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(41)))), ((int)(((byte)(49)))), ((int)(((byte)(52)))));
this.txtMsgBox.BorderStyle = System.Windows.Forms.BorderStyle.None;
resources.ApplyResources(this.txtMsgBox, "txtMsgBox");
this.txtMsgBox.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(226)))), ((int)(((byte)(228)))));
this.txtMsgBox.Name = "txtMsgBox";
this.txtMsgBox.ReadOnly = true;
//
// ssMain
//
resources.ApplyResources(this.ssMain, "ssMain");
this.ssMain.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolSslSocksPortLab,
this.toolSslSocksPort,
@@ -503,66 +500,68 @@
this.toolSslBlank3,
this.toolSslServerSpeed,
this.toolSslBlank4});
resources.ApplyResources(this.ssMain, "ssMain");
this.ssMain.Name = "ssMain";
this.ssMain.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.ssMain_ItemClicked);
//
// toolSslSocksPortLab
//
resources.ApplyResources(this.toolSslSocksPortLab, "toolSslSocksPortLab");
this.toolSslSocksPortLab.Name = "toolSslSocksPortLab";
resources.ApplyResources(this.toolSslSocksPortLab, "toolSslSocksPortLab");
//
// toolSslSocksPort
//
resources.ApplyResources(this.toolSslSocksPort, "toolSslSocksPort");
this.toolSslSocksPort.Name = "toolSslSocksPort";
resources.ApplyResources(this.toolSslSocksPort, "toolSslSocksPort");
//
// toolSslBlank1
//
resources.ApplyResources(this.toolSslBlank1, "toolSslBlank1");
this.toolSslBlank1.Name = "toolSslBlank1";
resources.ApplyResources(this.toolSslBlank1, "toolSslBlank1");
this.toolSslBlank1.Spring = true;
//
// toolSslHttpPortLab
//
resources.ApplyResources(this.toolSslHttpPortLab, "toolSslHttpPortLab");
this.toolSslHttpPortLab.Name = "toolSslHttpPortLab";
resources.ApplyResources(this.toolSslHttpPortLab, "toolSslHttpPortLab");
//
// toolSslHttpPort
//
resources.ApplyResources(this.toolSslHttpPort, "toolSslHttpPort");
this.toolSslHttpPort.Name = "toolSslHttpPort";
resources.ApplyResources(this.toolSslHttpPort, "toolSslHttpPort");
//
// toolSslBlank2
//
resources.ApplyResources(this.toolSslBlank2, "toolSslBlank2");
this.toolSslBlank2.Name = "toolSslBlank2";
resources.ApplyResources(this.toolSslBlank2, "toolSslBlank2");
this.toolSslBlank2.Spring = true;
//
// toolSslPacPortLab
//
resources.ApplyResources(this.toolSslPacPortLab, "toolSslPacPortLab");
this.toolSslPacPortLab.Name = "toolSslPacPortLab";
resources.ApplyResources(this.toolSslPacPortLab, "toolSslPacPortLab");
//
// toolSslPacPort
//
resources.ApplyResources(this.toolSslPacPort, "toolSslPacPort");
this.toolSslPacPort.Name = "toolSslPacPort";
resources.ApplyResources(this.toolSslPacPort, "toolSslPacPort");
//
// toolSslBlank3
//
resources.ApplyResources(this.toolSslBlank3, "toolSslBlank3");
this.toolSslBlank3.Name = "toolSslBlank3";
resources.ApplyResources(this.toolSslBlank3, "toolSslBlank3");
this.toolSslBlank3.Spring = true;
//
// toolSslServerSpeed
//
resources.ApplyResources(this.toolSslServerSpeed, "toolSslServerSpeed");
this.toolSslServerSpeed.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
this.toolSslServerSpeed.Name = "toolSslServerSpeed";
//
// toolSslBlank4
//
resources.ApplyResources(this.toolSslBlank4, "toolSslBlank4");
this.toolSslBlank4.Name = "toolSslBlank4";
resources.ApplyResources(this.toolSslBlank4, "toolSslBlank4");
//
// panel1
//
@@ -571,7 +570,6 @@
//
// tsMain
//
resources.ApplyResources(this.tsMain, "tsMain");
this.tsMain.ImageScalingSize = new System.Drawing.Size(32, 32);
this.tsMain.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.tsbServer,
@@ -588,50 +586,51 @@
this.tsbPromotion,
this.toolStripSeparator11,
this.tsbClose});
resources.ApplyResources(this.tsMain, "tsMain");
this.tsMain.Name = "tsMain";
//
// toolStripSeparator4
//
resources.ApplyResources(this.toolStripSeparator4, "toolStripSeparator4");
this.toolStripSeparator4.Name = "toolStripSeparator4";
resources.ApplyResources(this.toolStripSeparator4, "toolStripSeparator4");
//
// tsbSub
//
resources.ApplyResources(this.tsbSub, "tsbSub");
this.tsbSub.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.tsbSubSetting,
this.tsbSubUpdate});
this.tsbSub.Image = global::v2rayN.Properties.Resources.sub;
resources.ApplyResources(this.tsbSub, "tsbSub");
this.tsbSub.Name = "tsbSub";
//
// tsbSubSetting
//
resources.ApplyResources(this.tsbSubSetting, "tsbSubSetting");
this.tsbSubSetting.Name = "tsbSubSetting";
resources.ApplyResources(this.tsbSubSetting, "tsbSubSetting");
this.tsbSubSetting.Click += new System.EventHandler(this.tsbSubSetting_Click);
//
// tsbSubUpdate
//
resources.ApplyResources(this.tsbSubUpdate, "tsbSubUpdate");
this.tsbSubUpdate.Name = "tsbSubUpdate";
resources.ApplyResources(this.tsbSubUpdate, "tsbSubUpdate");
this.tsbSubUpdate.Click += new System.EventHandler(this.tsbSubUpdate_Click);
//
// toolStripSeparator8
//
resources.ApplyResources(this.toolStripSeparator8, "toolStripSeparator8");
this.toolStripSeparator8.Name = "toolStripSeparator8";
resources.ApplyResources(this.toolStripSeparator8, "toolStripSeparator8");
//
// tsbOptionSetting
//
resources.ApplyResources(this.tsbOptionSetting, "tsbOptionSetting");
this.tsbOptionSetting.Image = global::v2rayN.Properties.Resources.option;
resources.ApplyResources(this.tsbOptionSetting, "tsbOptionSetting");
this.tsbOptionSetting.Name = "tsbOptionSetting";
this.tsbOptionSetting.Click += new System.EventHandler(this.tsbOptionSetting_Click);
//
// toolStripSeparator5
//
resources.ApplyResources(this.toolStripSeparator5, "toolStripSeparator5");
this.toolStripSeparator5.Name = "toolStripSeparator5";
resources.ApplyResources(this.toolStripSeparator5, "toolStripSeparator5");
//
// tsbReload
//
@@ -641,95 +640,95 @@
//
// toolStripSeparator7
//
resources.ApplyResources(this.toolStripSeparator7, "toolStripSeparator7");
this.toolStripSeparator7.Name = "toolStripSeparator7";
resources.ApplyResources(this.toolStripSeparator7, "toolStripSeparator7");
//
// tsbCheckUpdate
//
resources.ApplyResources(this.tsbCheckUpdate, "tsbCheckUpdate");
this.tsbCheckUpdate.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.tsbCheckUpdateN,
this.tsbCheckUpdateCore,
this.tsbCheckUpdatePACList,
this.tsbCheckClearPACList});
this.tsbCheckUpdate.Image = global::v2rayN.Properties.Resources.checkupdate;
resources.ApplyResources(this.tsbCheckUpdate, "tsbCheckUpdate");
this.tsbCheckUpdate.Name = "tsbCheckUpdate";
//
// tsbCheckUpdateN
//
resources.ApplyResources(this.tsbCheckUpdateN, "tsbCheckUpdateN");
this.tsbCheckUpdateN.Name = "tsbCheckUpdateN";
resources.ApplyResources(this.tsbCheckUpdateN, "tsbCheckUpdateN");
this.tsbCheckUpdateN.Click += new System.EventHandler(this.tsbCheckUpdateN_Click);
//
// tsbCheckUpdateCore
//
resources.ApplyResources(this.tsbCheckUpdateCore, "tsbCheckUpdateCore");
this.tsbCheckUpdateCore.Name = "tsbCheckUpdateCore";
resources.ApplyResources(this.tsbCheckUpdateCore, "tsbCheckUpdateCore");
this.tsbCheckUpdateCore.Click += new System.EventHandler(this.tsbCheckUpdateCore_Click);
//
// tsbCheckUpdatePACList
//
resources.ApplyResources(this.tsbCheckUpdatePACList, "tsbCheckUpdatePACList");
this.tsbCheckUpdatePACList.Name = "tsbCheckUpdatePACList";
resources.ApplyResources(this.tsbCheckUpdatePACList, "tsbCheckUpdatePACList");
this.tsbCheckUpdatePACList.Click += new System.EventHandler(this.tsbCheckUpdatePACList_Click);
//
// tsbCheckClearPACList
//
resources.ApplyResources(this.tsbCheckClearPACList, "tsbCheckClearPACList");
this.tsbCheckClearPACList.Name = "tsbCheckClearPACList";
resources.ApplyResources(this.tsbCheckClearPACList, "tsbCheckClearPACList");
this.tsbCheckClearPACList.Click += new System.EventHandler(this.tsbCheckClearPACList_Click);
//
// toolStripSeparator10
//
resources.ApplyResources(this.toolStripSeparator10, "toolStripSeparator10");
this.toolStripSeparator10.Name = "toolStripSeparator10";
resources.ApplyResources(this.toolStripSeparator10, "toolStripSeparator10");
//
// tsbHelp
//
resources.ApplyResources(this.tsbHelp, "tsbHelp");
this.tsbHelp.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.tsbAbout,
this.toolStripSeparator12,
this.tsbLanguageDef,
this.tsbLanguageZhHans});
this.tsbHelp.Image = global::v2rayN.Properties.Resources.help;
resources.ApplyResources(this.tsbHelp, "tsbHelp");
this.tsbHelp.Name = "tsbHelp";
//
// tsbAbout
//
resources.ApplyResources(this.tsbAbout, "tsbAbout");
this.tsbAbout.Name = "tsbAbout";
resources.ApplyResources(this.tsbAbout, "tsbAbout");
this.tsbAbout.Click += new System.EventHandler(this.tsbAbout_Click);
//
// toolStripSeparator12
//
resources.ApplyResources(this.toolStripSeparator12, "toolStripSeparator12");
this.toolStripSeparator12.Name = "toolStripSeparator12";
resources.ApplyResources(this.toolStripSeparator12, "toolStripSeparator12");
//
// tsbLanguageDef
//
resources.ApplyResources(this.tsbLanguageDef, "tsbLanguageDef");
this.tsbLanguageDef.Name = "tsbLanguageDef";
resources.ApplyResources(this.tsbLanguageDef, "tsbLanguageDef");
this.tsbLanguageDef.Click += new System.EventHandler(this.tsbLanguageDef_Click);
//
// tsbLanguageZhHans
//
resources.ApplyResources(this.tsbLanguageZhHans, "tsbLanguageZhHans");
this.tsbLanguageZhHans.Name = "tsbLanguageZhHans";
resources.ApplyResources(this.tsbLanguageZhHans, "tsbLanguageZhHans");
this.tsbLanguageZhHans.Click += new System.EventHandler(this.tsbLanguageZhHans_Click);
//
// tsbPromotion
//
resources.ApplyResources(this.tsbPromotion, "tsbPromotion");
this.tsbPromotion.ForeColor = System.Drawing.Color.Black;
this.tsbPromotion.Image = global::v2rayN.Properties.Resources.promotion;
resources.ApplyResources(this.tsbPromotion, "tsbPromotion");
this.tsbPromotion.Name = "tsbPromotion";
this.tsbPromotion.Click += new System.EventHandler(this.tsbPromotion_Click);
//
// toolStripSeparator11
//
resources.ApplyResources(this.toolStripSeparator11, "toolStripSeparator11");
this.toolStripSeparator11.Name = "toolStripSeparator11";
resources.ApplyResources(this.toolStripSeparator11, "toolStripSeparator11");
//
// tsbClose
//

View File

@@ -59,25 +59,25 @@ namespace v2rayN.Forms
Utils.HumanFy(down)
);
List<string[]> datas = new List<string[]>();
for (int i = 0; i < config.vmess.Count; i++)
{
string totalUp_ = string.Empty,
totalDown_ = string.Empty,
todayUp_ = string.Empty,
todayDown_ = string.Empty;
var index = statistics.FindIndex(item_ => (config.vmess[i].address == item_.address && config.vmess[i].port == item_.port && config.vmess[i].path == item_.path));
if (index != -1)
{
totalUp_ = Utils.HumanFy(statistics[index].totalUp);
totalDown_ = Utils.HumanFy(statistics[index].totalDown);
todayUp_ = Utils.HumanFy(statistics[index].todayUp);
todayDown_ = Utils.HumanFy(statistics[index].todayDown);
List<string[]> datas = new List<string[]>();
for (int i = 0; i < config.vmess.Count; i++)
{
string totalUp_ = string.Empty,
totalDown_ = string.Empty,
todayUp_ = string.Empty,
todayDown_ = string.Empty;
var index = statistics.FindIndex(item_ => Utils.IsIdenticalServer(item_, new ServerStatistics(config.vmess[i].remarks, config.vmess[i].address, config.vmess[i].port, config.vmess[i].path, config.vmess[i].requestHost, 0, 0, 0, 0)));
if (index != -1)
{
totalUp_ = Utils.HumanFy(statistics[index].totalUp);
totalDown_ = Utils.HumanFy(statistics[index].totalDown);
todayUp_ = Utils.HumanFy(statistics[index].todayUp);
todayDown_ = Utils.HumanFy(statistics[index].todayDown);
}
datas.Add(new string[] { totalUp_, totalDown_, todayUp_, todayDown_ });
}
lvServers.Invoke((MethodInvoker)delegate
{
lvServers.SuspendLayout();
@@ -129,7 +129,7 @@ namespace v2rayN.Forms
{
e.Cancel = true;
statistics?.saveToFile();
statistics?.SaveToFile();
HideForm();
return;
@@ -137,7 +137,7 @@ namespace v2rayN.Forms
if (e.CloseReason == CloseReason.ApplicationExitCall)
{
ConfigHandler.SaveConfig(ref config);
statistics?.saveToFile();
statistics?.SaveToFile();
statistics?.Close();
}
}
@@ -168,7 +168,7 @@ namespace v2rayN.Forms
Utils.SaveLog("Windows shutdown UnsetProxy");
//CloseV2ray();
ConfigHandler.ToJsonFile(config);
statistics?.saveToFile();
statistics?.SaveToFile();
ProxySetting.UnsetProxy();
m.Result = (IntPtr)1;
break;

File diff suppressed because it is too large Load Diff

View File

@@ -395,13 +395,13 @@
</data>
<data name="tsbReload.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAE3SURBVFhH7ZaBDQIhDEVvBEdwBDfQDXQER3AD3cARdAPd
QDfSDbQvuSb1AicFjJrwkxcN0FIolOuamv5VE2E+gLaPayWchEcE+hhTXVPhIoQmDcFYbKpoJtwEdX4X
jgIrXfTwnzb6dBw22BaJVdjJmWQs1/SdBRtE0U5cBXW2oSFRO0HtSEeW2FZ1wsq9sjuRdTDVAXnNuWLY
6JnAl0sYa/Q5q1dhq35ci+Bkq2HJvbZpxGeybAAuw4Fq+cnW1wPITgHFYxvBUw+qHEIL1yq1vDKhVlH3
NQwF4JkcFRWiUAB7IVW2FFPO3YqlgPd+LJf02e8Fdi3rMdIAcLDuf9UpeT0IS0G/hvhPm305vSl7EQFY
B6zCvozvYGzRM8zEoeg5TPZwDaGvpHQni1yzSxbXPW9q+hF13ROHuJnQcjbhtQAAAABJRU5ErkJggg==
iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
wwAADsMBx2+oZAAAATdJREFUWEftloENAiEMRW8ER3AEN9ANdARHcAPdwBF0A91AN9INtC+5JvUCJwWM
mvCTFw3QUiiU65qa/lUTYT6Ato9rJZyERwT6GFNdU+EihCYNwVhsqmgm3AR1fheOAitd9PCfNvp0HDbY
FolV2MmZZCzX9J0FG0TRTlwFdbahIVE7Qe1IR5bYVnXCyr2yO5F1MNUBec25YtjomcCXSxhr9DmrV2Gr
flyL4GSrYcm9tmnEZ7JsAC7DgWr5ydbXA8hOAcVjG8FTD6ocQgvXKrW8MqFWUfc1DAXgmRwVFaJQAHsh
VbYUU87diqWA934sl/TZ7wV2Lesx0gBwsO5/1Sl5PQhLQb+G+E+bfTm9KXsRAVgHrMK+jO9gbNEzzMSh
6DlM9nANoa+kdCeLXLNLFtc9b2r6EXXdE4e4mdByNuG1AAAAAElFTkSuQmCC
</value>
</data>
<data name="tsbReload.Size" type="System.Drawing.Size, System.Drawing">
@@ -457,12 +457,15 @@
</data>
<data name="tsbClose.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAySURBVFhH7c6xDQAgCEVBRnVTHU2ZABuMxV3yOvJDAAA/
GqfZVG6X8mg1dfUAAPBQxAZd0SJruVXHWwAAAABJRU5ErkJggg==
iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
wwAADsMBx2+oZAAAADJJREFUWEftzrENACAIRUFGdVMdTZkAG4zFXfI68kMAAD8ap9lUbpfyaDV19QAA
8FDEBl3RImu5VcdbAAAAAElFTkSuQmCC
</value>
</data>
<data name="tsbClose.Text" xml:space="preserve">
<value> 关闭 </value>
</data>
<data name="toolSslServerSpeed.Text" xml:space="preserve">
<value>网速显示未启用</value>
</data>
</root>

View File

@@ -146,7 +146,7 @@ namespace v2rayN
public const string InboundProxyTagName = "proxy";
public const string Loopback = "127.0.0.1";
public const string InboundAPIProtocal = "dokodemo-door";
public const uint InboundAPIPort = 10805;
public enum StatisticsFreshRate
{
quick = 1000,
@@ -185,6 +185,11 @@ namespace v2rayN
/// </summary>
public static int pacPort { get; set; }
/// <summary>
///
/// </summary>
public static int statePort { get; set; }
#endregion

View File

@@ -1,28 +1,27 @@
using System;
using Grpc.Core;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using v2rayN.Mode;
using v2rayN.Protos.Statistics;
namespace v2rayN.Handler
{
class StatisticsHandler
{
private Config config_;
private const string cliName_ = "v2ctl.exe";
private string args_ = "";
private Process connector_;
private Mode.Config config_;
private Channel channel_;
private StatsService.StatsServiceClient client_;
private Thread workThread_;
Action<ulong, ulong, ulong, ulong, List<Mode.ServerStatistics>> updateFunc_;
private bool enabled_;
public bool Enable
public bool Enable
{
get { return enabled_; }
set { enabled_ = value; }
@@ -30,13 +29,11 @@ namespace v2rayN.Handler
public bool UpdateUI;
private StringBuilder outputBuilder_;
public ulong TotalUp { get; private set; }
public ulong TotalDown { get; private set; }
public List<Mode.ServerStatistics> Statistic{ get; set; }
public List<Mode.ServerStatistics> Statistic { get; set; }
public ulong Up { get; private set; }
@@ -46,7 +43,7 @@ namespace v2rayN.Handler
private bool exitFlag_; // true to close workThread_
public StatisticsHandler(Config config, Action<ulong, ulong, ulong, ulong, List<Mode.ServerStatistics>> update)
public StatisticsHandler(Mode.Config config, Action<ulong, ulong, ulong, ulong, List<Mode.ServerStatistics>> update)
{
config_ = config;
enabled_ = config.enableStatistics;
@@ -59,134 +56,143 @@ namespace v2rayN.Handler
DeleteExpiredLog();
foreach (var server in config.vmess)
{
var statistic = new ServerStatistics(server.remarks, server.address, server.port, server.path, 0, 0, 0, 0);
var statistic = new ServerStatistics(server.remarks, server.address, server.port, server.path, server.requestHost, 0, 0, 0, 0);
Statistic.Add(statistic);
}
loadFromFile();
LoadFromFile();
outputBuilder_ = new StringBuilder();
GrpcInit();
var fullPath = Utils.GetPath(cliName_);
if (!File.Exists(fullPath))
{
connector_ = null;
return;
}
// .\v2ctl.exe api --server="127.0.0.1:port" StatsService.QueryStats "reset:true"
args_ = string.Format("api --server=\"127.0.0.1:{0}\" StatsService.QueryStats \"reset:true\"", Global.InboundAPIPort);
connector_ = new Process();
connector_.StartInfo.FileName = fullPath;
connector_.StartInfo.Arguments = args_;
connector_.StartInfo.RedirectStandardOutput = true;
connector_.StartInfo.UseShellExecute = false;
connector_.StartInfo.CreateNoWindow = true;
workThread_ = new Thread(new ThreadStart(run));
workThread_ = new Thread(new ThreadStart(Run));
workThread_.Start();
}
private void GrpcInit()
{
if (channel_ == null)
{
Global.statePort = GetFreePort();
channel_ = new Channel($"127.0.0.1:{Global.statePort}", ChannelCredentials.Insecure);
channel_.ConnectAsync();
client_ = new StatsService.StatsServiceClient(channel_);
}
}
public void Close()
{
try
{
exitFlag_ = true;
if (!connector_.HasExited)
{
connector_.Kill();
}
channel_.ShutdownAsync();
}
catch (Exception ex)
{
Utils.SaveLog(ex.Message, ex);
}
catch { }
}
public void run()
public void Run()
{
try
while (!exitFlag_)
{
while (!exitFlag_)
{
if (enabled_)
{
var addr = config_.address();
var port = config_.port();
var cur = Statistic.FindIndex(item => item.address == addr && item.port == port);
connector_.Start();
string output = connector_.StandardOutput.ReadToEnd();
UInt64 up = 0;
UInt64 down = 0;
//TODO: parse output
parseOutput(output, out up, out down);
Up = up;
Down = down;
TotalUp += up;
TotalDown += down;
if(cur != -1)
{
Statistic[cur].todayUp += up;
Statistic[cur].todayDown += down;
Statistic[cur].totalUp += up;
Statistic[cur].totalDown += down;
}
if (UpdateUI)
updateFunc_(TotalUp, TotalDown, Up, Down, Statistic);
Thread.Sleep(config_.statisticsFreshRate);
}
}
}
catch { }
}
public void parseOutput(string source, out UInt64 up, out UInt64 down)
{
// (?<=name: ")(.*?)(?=")|(?<=value: )(.*?)
var datas = Regex.Matches(source, "(?<=name: \")(?<name>.*?)(?=\").*?(?<=value: )(?<value>.*?)(?=>)", RegexOptions.Singleline);
up = 0; down = 0;
foreach(Match match in datas)
{
var g = match.Groups;
var name = g["name"].Value;
var value = g["value"].Value;
var nStr = name.Split(">>>".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
var type = "";
name = name.Trim();
value = value.Trim();
name = nStr[1];
type = nStr[3];
try
{
if (enabled_ && channel_.State == ChannelState.Ready)
{
QueryStatsResponse res = null;
try
{
res = client_.QueryStats(new QueryStatsRequest() { Pattern = "", Reset = true });
}
catch (Exception ex)
{
Utils.SaveLog(ex.Message, ex);
}
if (res != null)
{
var addr = config_.address();
var port = config_.port();
var path = config_.path();
var cur = Statistic.FindIndex(item => item.address == addr && item.port == port && item.path == path);
ulong up = 0,
down = 0;
//TODO: parse output
ParseOutput(res.Stat, out up, out down);
Up = up;
Down = down;
TotalUp += up;
TotalDown += down;
if (cur != -1)
{
Statistic[cur].todayUp += up;
Statistic[cur].todayDown += down;
Statistic[cur].totalUp += up;
Statistic[cur].totalDown += down;
}
if (UpdateUI)
updateFunc_(TotalUp, TotalDown, Up, Down, Statistic);
}
}
Thread.Sleep(config_.statisticsFreshRate);
channel_.ConnectAsync();
}
catch (Exception ex)
{
Utils.SaveLog(ex.Message, ex);
}
}
}
public void ParseOutput(Google.Protobuf.Collections.RepeatedField<Stat> source, out ulong up, out ulong down)
{
up = 0; down = 0;
try
{
foreach (var stat in source)
{
var name = stat.Name;
var value = stat.Value;
var nStr = name.Split(">>>".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
var type = "";
name = name.Trim();
name = nStr[1];
type = nStr[3];
if (name == Global.InboundProxyTagName)
{
if (type == "uplink")
{
up = UInt64.Parse(value);
up = (ulong)value;
}
else if (type == "downlink")
{
down = UInt64.Parse(value);
down = (ulong)value;
}
}
}
catch { }
}
catch (Exception ex)
{
Utils.SaveLog(ex.Message, ex);
}
}
public void saveToFile()
public void SaveToFile()
{
if(!Directory.Exists(logPath_))
if (!Directory.Exists(logPath_))
{
Directory.CreateDirectory(logPath_);
}
@@ -210,13 +216,16 @@ namespace v2rayN.Handler
overallWriter.WriteLine($"LastUpdate {DateTime.Now.ToLongDateString()} {DateTime.Now.ToLongTimeString()}");
overallWriter.WriteLine($"UP {string.Format("{0:f2}", up_amount)}{up_unit} {TotalUp}");
overallWriter.WriteLine($"DOWN {string.Format("{0:f2}", down_amount)}{down_unit} {TotalDown}");
foreach(var s in Statistic)
foreach (var s in Statistic)
{
overallWriter.WriteLine($"* {s.name} {s.address} {s.port} {s.path} {s.totalUp} {s.totalDown}");
overallWriter.WriteLine($"* {s.name} {s.address} {s.port} {s.path} {s.host} {s.totalUp} {s.totalDown}");
}
}
}
catch { }
catch (Exception ex)
{
Utils.SaveLog(ex.Message, ex);
}
// 当天流量记录文件
var dailyPath = Path.Combine(logPath_, $"{DateTime.Now.ToLongDateString()}.txt");
@@ -231,14 +240,17 @@ namespace v2rayN.Handler
dailyWriter.WriteLine($"LastUpdate {DateTime.Now.ToLongDateString()} {DateTime.Now.ToLongTimeString()}");
foreach (var s in Statistic)
{
dailyWriter.WriteLine($"* {s.name} {s.address} {s.port} {s.path} {s.todayUp} {s.todayDown}");
dailyWriter.WriteLine($"* {s.name} {s.address} {s.port} {s.path} {s.host} {s.todayUp} {s.todayDown}");
}
}
}
catch { }
catch (Exception ex)
{
Utils.SaveLog(ex.Message, ex);
}
}
public void loadFromFile()
public void LoadFromFile()
{
if (!Directory.Exists(logPath_)) return;
@@ -279,15 +291,17 @@ namespace v2rayN.Handler
else if (line.StartsWith("*"))
{
var datas = line.Split(' ');
if (datas.Length < 6) return;
if (datas.Length < 8) return;
var name = datas[1];
var address = datas[2];
var port = int.Parse(datas[3]);
var path = datas[4];
var totalUp = ulong.Parse(datas[5]);
var totalDown = ulong.Parse(datas[6]);
var host = datas[5];
var totalUp = ulong.Parse(datas[6]);
var totalDown = ulong.Parse(datas[7]);
var index = Statistic.FindIndex(item => item.address == address && item.port == port);
var temp = new ServerStatistics(name, address, port, path, host, 0, 0, 0, 0);
var index = Statistic.FindIndex(item => Utils.IsIdenticalServer(item, temp));
if (index != -1)
{
Statistic[index].totalUp = totalUp;
@@ -295,14 +309,17 @@ namespace v2rayN.Handler
}
else
{
var s = new Mode.ServerStatistics(name, address, port, path, totalUp, totalDown, 0, 0);
var s = new Mode.ServerStatistics(name, address, port, path, host, totalUp, totalDown, 0, 0);
Statistic.Add(s);
}
}
}
}
}
catch { }
catch (Exception ex)
{
Utils.SaveLog(ex.Message, ex);
}
}
// 当天流量记录文件
@@ -323,15 +340,17 @@ namespace v2rayN.Handler
else if (line.StartsWith("*"))
{
var datas = line.Split(' ');
if (datas.Length < 6) return;
if (datas.Length < 8) return;
var name = datas[1];
var address = datas[2];
var port = int.Parse(datas[3]);
var path = datas[4];
var todayUp = ulong.Parse(datas[5]);
var todayDown = ulong.Parse(datas[6]);
var host = datas[5];
var todayUp = ulong.Parse(datas[6]);
var todayDown = ulong.Parse(datas[7]);
var index = Statistic.FindIndex(item => item.address == address && item.port == port);
var temp = new ServerStatistics(name, address, port, path, host, 0, 0, 0, 0);
var index = Statistic.FindIndex(item => Utils.IsIdenticalServer(item, temp));
if (index != -1)
{
Statistic[index].todayUp = todayUp;
@@ -339,35 +358,65 @@ namespace v2rayN.Handler
}
else
{
var s = new Mode.ServerStatistics(name, address, port, path, 0, 0, todayUp, todayDown);
var s = new Mode.ServerStatistics(name, address, port, path, host, 0, 0, todayUp, todayDown);
Statistic.Add(s);
}
}
}
}
}
catch { }
catch (Exception ex)
{
Utils.SaveLog(ex.Message, ex);
}
}
}
private void DeleteExpiredLog()
{
if (!Directory.Exists(logPath_)) return;
var dirInfo = new DirectoryInfo(logPath_);
var files = dirInfo.GetFiles();
foreach (var file in files)
try
{
if (file.Name == "overall.txt") continue;
var name = file.Name.Split('.')[0];
var ft = DateTime.Parse(name);
var ct = DateTime.Now;
var dur = ct - ft;
if(dur.Days > config_.CacheDays)
if (!Directory.Exists(logPath_)) return;
var dirInfo = new DirectoryInfo(logPath_);
var files = dirInfo.GetFiles();
foreach (var file in files)
{
file.Delete();
if (file.Name == "overall.txt") continue;
var name = file.Name.Split('.')[0];
var ft = DateTime.Parse(name);
var ct = DateTime.Now;
var dur = ct - ft;
if (dur.Days > config_.CacheDays)
{
file.Delete();
}
}
}
catch (Exception ex)
{
Utils.SaveLog(ex.Message, ex);
}
}
private int GetFreePort()
{
int defaultPort = 28123;
try
{
// TCP stack please do me a favor
TcpListener l = new TcpListener(IPAddress.Loopback, 0);
l.Start();
var port = ((IPEndPoint)l.LocalEndpoint).Port;
l.Stop();
return port;
}
catch (Exception ex)
{
// in case access denied
Utils.SaveLog(ex.Message, ex);
return defaultPort;
}
}
}
}

View File

@@ -631,26 +631,28 @@ namespace v2rayN.Handler
v2rayConfig.stats = new Stats();
apiObj.tag = tag;
apiObj.services = services.ToList();
apiObj.services = services.ToList();
v2rayConfig.api = apiObj;
policySystemSetting.statsInboundDownlink = true;
policySystemSetting.statsInboundUplink = true;
policyObj.system = policySystemSetting;
v2rayConfig.policy = policyObj;
if(!v2rayConfig.inbounds.Exists(item => { return item.tag == tag; }))
if (!v2rayConfig.inbounds.Exists(item => { return item.tag == tag; }))
{
var apiInbound = new Mode.Inbounds();
var apiInboundSettings = new Mode.Inboundsettings();
apiInbound.tag = tag;
apiInbound.listen = Global.Loopback;
apiInbound.port = config.port();
apiInbound.port = Global.statePort;
apiInbound.protocol = Global.InboundAPIProtocal;
apiInboundSettings.address = Global.Loopback;
apiInbound.settings = apiInboundSettings;
v2rayConfig.inbounds.Add(apiInbound);
}
if(!v2rayConfig.routing.rules.Exists(item => { return item.outboundTag == tag; }))
if (!v2rayConfig.routing.rules.Exists(item => { return item.outboundTag == tag; }))
{
var apiRoutingRule = new Mode.RulesItem();
apiRoutingRule.inboundTag = tag;
@@ -1153,14 +1155,14 @@ namespace v2rayN.Handler
vmessItem.network = Global.DefaultNetwork;
vmessItem.headerType = Global.None;
vmessItem.configVersion = Utils.ToInt(vmessQRCode.v);
vmessItem.remarks = Utils.ToString(vmessQRCode.ps);
vmessItem.address = Utils.ToString(vmessQRCode.add);
vmessItem.port = Utils.ToInt(vmessQRCode.port);
vmessItem.id = Utils.ToString(vmessQRCode.id);
vmessItem.alterId = Utils.ToInt(vmessQRCode.aid);
if (!Utils.IsNullOrEmpty(vmessQRCode.net))
{
vmessItem.network = vmessQRCode.net;
@@ -1169,7 +1171,7 @@ namespace v2rayN.Handler
{
vmessItem.headerType = vmessQRCode.type;
}
vmessItem.requestHost = Utils.ToString(vmessQRCode.host);
vmessItem.path = Utils.ToString(vmessQRCode.path);
vmessItem.streamSecurity = Utils.ToString(vmessQRCode.tls);

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -12,18 +12,20 @@ namespace v2rayN.Mode
public string address;
public int port;
public string path;
public string host;
public ulong totalUp;
public ulong totalDown;
public ulong todayUp;
public ulong todayDown;
public ServerStatistics() { }
public ServerStatistics(string name, string addr, int port, string path, ulong totalUp, ulong totalDown, ulong todayUp, ulong todayDown)
public ServerStatistics(string name, string addr, int port, string path, string host, ulong totalUp, ulong totalDown, ulong todayUp, ulong todayDown)
{
this.name = name;
this.address = addr;
this.port = port;
this.path = path;
this.host = host;
this.totalUp = totalUp;
this.totalDown = totalDown;
this.todayUp = todayUp;

View File

@@ -21,40 +21,14 @@ namespace v2rayN.Mode
/// </summary>
public List<Outbounds> outbounds { get; set; }
/// 网速统计
/// 使用v2ray api功能
///
/// routing->rules 需要加上这一条
/// {
/// "inboundTag": [
/// "api"
/// ],
/// "outboundTag": "api",
/// "type": "field"
/// }
/// <summary>
/// 统计需要, 空对象
/// </summary>
public Stats stats { get; set; }
/// <summary>
/// 需要tag和services
/// "api": {
/// "tag": "api",
/// "services": [
/// "StatsService"
/// ]
/// }
/// </summary>
public API api { get; set; }
/// <summary>
/// policy 都设置为true
/// "system": {
/// "statsInboundUplink": true,
/// "statsInboundDownlink": true
/// }
/// </summary>
public Policy policy;

View File

@@ -29,24 +29,6 @@ namespace v2rayN
AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
var args = Environment.GetCommandLineArgs();
bool _isRestart = args.Length > 1 && args[1] == "/restart";
if (_isRestart)
{
try
{
// get old process and wait UP TO 5 secs then give up!
int _restartProcessId = int.Parse(args[2]);
Process oldProcess = Process.GetProcessById(_restartProcessId);
oldProcess.WaitForExit();
}
catch
{
// the process did not exist - probably already closed!
//TODO: --> LOG
}
}
Process instance = RunningInstance();
if (instance == null)
{
@@ -62,7 +44,7 @@ namespace v2rayN
}
else
{
UI.Show($"v2rayN is already running(v2rayN已经运行){args[1]} {args[2]}");
UI.Show($"v2rayN is already running(v2rayN已经运行)");
}
}
@@ -70,7 +52,7 @@ namespace v2rayN
{
try
{
string resourceName = "v2rayN." + new AssemblyName(args.Name).Name + ".dll";
string resourceName = "v2rayN.LIB." + new AssemblyName(args.Name).Name + ".dll";
using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName))
{
if (stream == null)

View File

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

View File

@@ -0,0 +1,53 @@
syntax = "proto3";
package v2ray.core.app.stats.command;
option csharp_namespace = "v2rayN.Protos.Statistics";
message GetStatsRequest {
// Name of the stat counter.
string name = 1;
// Whether or not to reset the counter to fetching its value.
bool reset = 2;
}
message Stat {
string name = 1;
int64 value = 2;
}
message GetStatsResponse {
Stat stat = 1;
}
message QueryStatsRequest {
string pattern = 1;
bool reset = 2;
}
message QueryStatsResponse {
repeated Stat stat = 1;
}
message SysStatsRequest {
}
message SysStatsResponse {
uint32 NumGoroutine = 1;
uint32 NumGC = 2;
uint64 Alloc = 3;
uint64 TotalAlloc = 4;
uint64 Sys = 5;
uint64 Mallocs = 6;
uint64 Frees = 7;
uint64 LiveObjects = 8;
uint64 PauseTotalNs = 9;
uint32 Uptime = 10;
}
service StatsService {
rpc GetStats(GetStatsRequest) returns (GetStatsResponse) {}
rpc QueryStats(QueryStatsRequest) returns (QueryStatsResponse) {}
rpc GetSysStats(SysStatsRequest) returns (SysStatsResponse) {}
}
message Config {}

View File

@@ -1,17 +1,4 @@
{
"stats": {},
"api": {
"tag": "api",
"services": [
"StatsService"
]
},
"policy": {
"system": {
"statsInboundUplink": true,
"statsInboundDownlink": true
}
},
{
"log": {
"access": "",
"error": "",
@@ -39,16 +26,7 @@
"tls"
]
}
},
{
"listen": "127.0.0.1",
"port": 10805,
"protocol": "dokodemo-door",
"settings": {
"address": "127.0.0.1"
},
"tag": "api"
}
}
],
"outbounds": [{
"tag": "proxy",

View File

@@ -442,6 +442,15 @@ namespace v2rayN
return Regex.IsMatch(input, pattern, RegexOptions.IgnoreCase);
}
public static bool IsIdenticalServer(Mode.ServerStatistics a, Mode.ServerStatistics b)
{
return (a.address == b.address
&& a.port == b.port
&& a.path == b.path
&& a.host == b.host
);
}
#endregion
#region

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Grpc.Tools" version="2.23.0" targetFramework="net46" developmentDependency="true" />
</packages>

View File

@@ -1,560 +0,0 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: command.proto
#pragma warning disable 1591, 0612, 3021
#region Designer generated code
using pb = global::Google.Protobuf;
using pbc = global::Google.Protobuf.Collections;
using pbr = global::Google.Protobuf.Reflection;
using scg = global::System.Collections.Generic;
namespace V2Ray.Core.App.Stats.Command {
/// <summary>Holder for reflection information generated from command.proto</summary>
public static partial class CommandReflection {
#region Descriptor
/// <summary>File descriptor for command.proto</summary>
public static pbr::FileDescriptor Descriptor {
get { return descriptor; }
}
private static pbr::FileDescriptor descriptor;
static CommandReflection() {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
"Cg1jb21tYW5kLnByb3RvEhx2MnJheS5jb3JlLmFwcC5zdGF0cy5jb21tYW5k",
"Ii4KD0dldFN0YXRzUmVxdWVzdBIMCgRuYW1lGAEgASgJEg0KBXJlc2V0GAIg",
"ASgIIiMKBFN0YXQSDAoEbmFtZRgBIAEoCRINCgV2YWx1ZRgCIAEoAyJEChBH",
"ZXRTdGF0c1Jlc3BvbnNlEjAKBHN0YXQYASABKAsyIi52MnJheS5jb3JlLmFw",
"cC5zdGF0cy5jb21tYW5kLlN0YXQiCAoGQ29uZmlnMnsKDFN0YXRzU2Vydmlj",
"ZRJrCghHZXRTdGF0cxItLnYycmF5LmNvcmUuYXBwLnN0YXRzLmNvbW1hbmQu",
"R2V0U3RhdHNSZXF1ZXN0Gi4udjJyYXkuY29yZS5hcHAuc3RhdHMuY29tbWFu",
"ZC5HZXRTdGF0c1Jlc3BvbnNlIgBCTAogY29tLnYycmF5LmNvcmUuYXBwLnN0",
"YXRzLmNvbW1hbmRQAVoHY29tbWFuZKoCHFYyUmF5LkNvcmUuQXBwLlN0YXRz",
"LkNvbW1hbmRiBnByb3RvMw=="));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { },
new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] {
new pbr::GeneratedClrTypeInfo(typeof(global::V2Ray.Core.App.Stats.Command.GetStatsRequest), global::V2Ray.Core.App.Stats.Command.GetStatsRequest.Parser, new[]{ "Name", "Reset" }, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::V2Ray.Core.App.Stats.Command.Stat), global::V2Ray.Core.App.Stats.Command.Stat.Parser, new[]{ "Name", "Value" }, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::V2Ray.Core.App.Stats.Command.GetStatsResponse), global::V2Ray.Core.App.Stats.Command.GetStatsResponse.Parser, new[]{ "Stat" }, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::V2Ray.Core.App.Stats.Command.Config), global::V2Ray.Core.App.Stats.Command.Config.Parser, null, null, null, null)
}));
}
#endregion
}
#region Messages
public sealed partial class GetStatsRequest : pb::IMessage<GetStatsRequest> {
private static readonly pb::MessageParser<GetStatsRequest> _parser = new pb::MessageParser<GetStatsRequest>(() => new GetStatsRequest());
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<GetStatsRequest> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pbr::MessageDescriptor Descriptor {
get { return global::V2Ray.Core.App.Stats.Command.CommandReflection.Descriptor.MessageTypes[0]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public GetStatsRequest() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public GetStatsRequest(GetStatsRequest other) : this() {
name_ = other.name_;
reset_ = other.reset_;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public GetStatsRequest Clone() {
return new GetStatsRequest(this);
}
/// <summary>Field number for the "name" field.</summary>
public const int NameFieldNumber = 1;
private string name_ = "";
/// <summary>
/// Name of the stat counter.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public string Name {
get { return name_; }
set {
name_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
/// <summary>Field number for the "reset" field.</summary>
public const int ResetFieldNumber = 2;
private bool reset_;
/// <summary>
/// Whether or not to reset the counter to fetching its value.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public bool Reset {
get { return reset_; }
set {
reset_ = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override bool Equals(object other) {
return Equals(other as GetStatsRequest);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public bool Equals(GetStatsRequest other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if (Name != other.Name) return false;
if (Reset != other.Reset) return false;
return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
if (Name.Length != 0) hash ^= Name.GetHashCode();
if (Reset != false) hash ^= Reset.GetHashCode();
return hash;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) {
if (Name.Length != 0) {
output.WriteRawTag(10);
output.WriteString(Name);
}
if (Reset != false) {
output.WriteRawTag(16);
output.WriteBool(Reset);
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
if (Name.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(Name);
}
if (Reset != false) {
size += 1 + 1;
}
return size;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(GetStatsRequest other) {
if (other == null) {
return;
}
if (other.Name.Length != 0) {
Name = other.Name;
}
if (other.Reset != false) {
Reset = other.Reset;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
input.SkipLastField();
break;
case 10: {
Name = input.ReadString();
break;
}
case 16: {
Reset = input.ReadBool();
break;
}
}
}
}
}
public sealed partial class Stat : pb::IMessage<Stat> {
private static readonly pb::MessageParser<Stat> _parser = new pb::MessageParser<Stat>(() => new Stat());
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<Stat> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pbr::MessageDescriptor Descriptor {
get { return global::V2Ray.Core.App.Stats.Command.CommandReflection.Descriptor.MessageTypes[1]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public Stat() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public Stat(Stat other) : this() {
name_ = other.name_;
value_ = other.value_;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public Stat Clone() {
return new Stat(this);
}
/// <summary>Field number for the "name" field.</summary>
public const int NameFieldNumber = 1;
private string name_ = "";
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public string Name {
get { return name_; }
set {
name_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
/// <summary>Field number for the "value" field.</summary>
public const int ValueFieldNumber = 2;
private long value_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public long Value {
get { return value_; }
set {
value_ = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override bool Equals(object other) {
return Equals(other as Stat);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public bool Equals(Stat other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if (Name != other.Name) return false;
if (Value != other.Value) return false;
return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
if (Name.Length != 0) hash ^= Name.GetHashCode();
if (Value != 0L) hash ^= Value.GetHashCode();
return hash;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) {
if (Name.Length != 0) {
output.WriteRawTag(10);
output.WriteString(Name);
}
if (Value != 0L) {
output.WriteRawTag(16);
output.WriteInt64(Value);
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
if (Name.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(Name);
}
if (Value != 0L) {
size += 1 + pb::CodedOutputStream.ComputeInt64Size(Value);
}
return size;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(Stat other) {
if (other == null) {
return;
}
if (other.Name.Length != 0) {
Name = other.Name;
}
if (other.Value != 0L) {
Value = other.Value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
input.SkipLastField();
break;
case 10: {
Name = input.ReadString();
break;
}
case 16: {
Value = input.ReadInt64();
break;
}
}
}
}
}
public sealed partial class GetStatsResponse : pb::IMessage<GetStatsResponse> {
private static readonly pb::MessageParser<GetStatsResponse> _parser = new pb::MessageParser<GetStatsResponse>(() => new GetStatsResponse());
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<GetStatsResponse> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pbr::MessageDescriptor Descriptor {
get { return global::V2Ray.Core.App.Stats.Command.CommandReflection.Descriptor.MessageTypes[2]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public GetStatsResponse() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public GetStatsResponse(GetStatsResponse other) : this() {
Stat = other.stat_ != null ? other.Stat.Clone() : null;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public GetStatsResponse Clone() {
return new GetStatsResponse(this);
}
/// <summary>Field number for the "stat" field.</summary>
public const int StatFieldNumber = 1;
private global::V2Ray.Core.App.Stats.Command.Stat stat_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public global::V2Ray.Core.App.Stats.Command.Stat Stat {
get { return stat_; }
set {
stat_ = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override bool Equals(object other) {
return Equals(other as GetStatsResponse);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public bool Equals(GetStatsResponse other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if (!object.Equals(Stat, other.Stat)) return false;
return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
if (stat_ != null) hash ^= Stat.GetHashCode();
return hash;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) {
if (stat_ != null) {
output.WriteRawTag(10);
output.WriteMessage(Stat);
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
if (stat_ != null) {
size += 1 + pb::CodedOutputStream.ComputeMessageSize(Stat);
}
return size;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(GetStatsResponse other) {
if (other == null) {
return;
}
if (other.stat_ != null) {
if (stat_ == null) {
stat_ = new global::V2Ray.Core.App.Stats.Command.Stat();
}
Stat.MergeFrom(other.Stat);
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
input.SkipLastField();
break;
case 10: {
if (stat_ == null) {
stat_ = new global::V2Ray.Core.App.Stats.Command.Stat();
}
input.ReadMessage(stat_);
break;
}
}
}
}
}
public sealed partial class Config : pb::IMessage<Config> {
private static readonly pb::MessageParser<Config> _parser = new pb::MessageParser<Config>(() => new Config());
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<Config> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pbr::MessageDescriptor Descriptor {
get { return global::V2Ray.Core.App.Stats.Command.CommandReflection.Descriptor.MessageTypes[3]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public Config() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public Config(Config other) : this() {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public Config Clone() {
return new Config(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override bool Equals(object other) {
return Equals(other as Config);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public bool Equals(Config other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
return true;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
return hash;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) {
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
return size;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(Config other) {
if (other == null) {
return;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
input.SkipLastField();
break;
}
}
}
}
#endregion
}
#endregion Designer generated code

View File

@@ -1,97 +0,0 @@
// <auto-generated>
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: command.proto
// </auto-generated>
#pragma warning disable 1591
#region Designer generated code
using grpc = global::Grpc.Core;
namespace V2Ray.Core.App.Stats.Command {
public static partial class StatsService
{
static readonly string __ServiceName = "v2ray.core.app.stats.command.StatsService";
static readonly grpc::Marshaller<global::V2Ray.Core.App.Stats.Command.GetStatsRequest> __Marshaller_GetStatsRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::V2Ray.Core.App.Stats.Command.GetStatsRequest.Parser.ParseFrom);
static readonly grpc::Marshaller<global::V2Ray.Core.App.Stats.Command.GetStatsResponse> __Marshaller_GetStatsResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::V2Ray.Core.App.Stats.Command.GetStatsResponse.Parser.ParseFrom);
static readonly grpc::Method<global::V2Ray.Core.App.Stats.Command.GetStatsRequest, global::V2Ray.Core.App.Stats.Command.GetStatsResponse> __Method_GetStats = new grpc::Method<global::V2Ray.Core.App.Stats.Command.GetStatsRequest, global::V2Ray.Core.App.Stats.Command.GetStatsResponse>(
grpc::MethodType.Unary,
__ServiceName,
"GetStats",
__Marshaller_GetStatsRequest,
__Marshaller_GetStatsResponse);
/// <summary>Service descriptor</summary>
public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor
{
get { return global::V2Ray.Core.App.Stats.Command.CommandReflection.Descriptor.Services[0]; }
}
/// <summary>Base class for server-side implementations of StatsService</summary>
public abstract partial class StatsServiceBase
{
public virtual global::System.Threading.Tasks.Task<global::V2Ray.Core.App.Stats.Command.GetStatsResponse> GetStats(global::V2Ray.Core.App.Stats.Command.GetStatsRequest request, grpc::ServerCallContext context)
{
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
}
}
/// <summary>Client for StatsService</summary>
public partial class StatsServiceClient : grpc::ClientBase<StatsServiceClient>
{
/// <summary>Creates a new client for StatsService</summary>
/// <param name="channel">The channel to use to make remote calls.</param>
public StatsServiceClient(grpc::Channel channel) : base(channel)
{
}
/// <summary>Creates a new client for StatsService that uses a custom <c>CallInvoker</c>.</summary>
/// <param name="callInvoker">The callInvoker to use to make remote calls.</param>
public StatsServiceClient(grpc::CallInvoker callInvoker) : base(callInvoker)
{
}
/// <summary>Protected parameterless constructor to allow creation of test doubles.</summary>
protected StatsServiceClient() : base()
{
}
/// <summary>Protected constructor to allow creation of configured clients.</summary>
/// <param name="configuration">The client configuration.</param>
protected StatsServiceClient(ClientBaseConfiguration configuration) : base(configuration)
{
}
public virtual global::V2Ray.Core.App.Stats.Command.GetStatsResponse GetStats(global::V2Ray.Core.App.Stats.Command.GetStatsRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return GetStats(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
public virtual global::V2Ray.Core.App.Stats.Command.GetStatsResponse GetStats(global::V2Ray.Core.App.Stats.Command.GetStatsRequest request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_GetStats, null, options, request);
}
public virtual grpc::AsyncUnaryCall<global::V2Ray.Core.App.Stats.Command.GetStatsResponse> GetStatsAsync(global::V2Ray.Core.App.Stats.Command.GetStatsRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return GetStatsAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
public virtual grpc::AsyncUnaryCall<global::V2Ray.Core.App.Stats.Command.GetStatsResponse> GetStatsAsync(global::V2Ray.Core.App.Stats.Command.GetStatsRequest request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_GetStats, null, options, request);
}
/// <summary>Creates a new instance of client from given <c>ClientBaseConfiguration</c>.</summary>
protected override StatsServiceClient NewInstance(ClientBaseConfiguration configuration)
{
return new StatsServiceClient(configuration);
}
}
/// <summary>Creates service definition that can be registered with a server</summary>
/// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
public static grpc::ServerServiceDefinition BindService(StatsServiceBase serviceImpl)
{
return grpc::ServerServiceDefinition.CreateBuilder()
.AddMethod(__Method_GetStats, serviceImpl.GetStats).Build();
}
}
}
#endregion

View File

@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\Grpc.Tools.2.23.0\build\Grpc.Tools.props" Condition="Exists('..\packages\Grpc.Tools.2.23.0\build\Grpc.Tools.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -74,11 +75,32 @@
<PropertyGroup />
<PropertyGroup />
<ItemGroup>
<Reference Include="Newtonsoft.Json">
<HintPath>.\Newtonsoft.Json.dll</HintPath>
<Reference Include="Google.Protobuf, Version=3.9.1.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>LIB\Google.Protobuf.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Grpc.Core, Version=2.0.0.0, Culture=neutral, PublicKeyToken=d754f35622e28bad, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>LIB\Grpc.Core.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Grpc.Core.Api, Version=2.0.0.0, Culture=neutral, PublicKeyToken=d754f35622e28bad, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>LIB\Grpc.Core.Api.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>LIB\Newtonsoft.Json.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>LIB\System.Buffers.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System.Core" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
@@ -87,15 +109,27 @@
<Reference Include="System.Drawing" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.IO.Compression.FileSystem" />
<Reference Include="System.Net" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="zxing">
<HintPath>.\zxing.dll</HintPath>
<Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>LIB\System.Memory.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="zxing.presentation">
<HintPath>.\zxing.presentation.dll</HintPath>
<Reference Include="System.Net" />
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>LIB\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="zxing, Version=0.16.2.0, Culture=neutral, PublicKeyToken=4e88037ac681fe60, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>LIB\zxing.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="zxing.presentation, Version=0.16.2.0, Culture=neutral, PublicKeyToken=4e88037ac681fe60, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>LIB\zxing.presentation.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
@@ -295,6 +329,7 @@
<EmbeddedResource Include="app.config">
<SubType>Designer</SubType>
</EmbeddedResource>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
@@ -304,6 +339,7 @@
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<Protobuf Include="Protos\Statistics.proto" />
<None Include="Resources\abp.js.gz" />
<None Include="Resources\pac.txt.gz" />
<None Include="Resources\sysproxy.exe.gz" />
@@ -325,9 +361,6 @@
<ItemGroup>
<EmbeddedResource Include="Sample\SampleClientConfig.txt" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Newtonsoft.Json.dll" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Sample\SampleHttprequest.txt" />
<EmbeddedResource Include="Sample\SampleHttpresponse.txt" />
@@ -377,19 +410,38 @@
<None Include="Resources\sub.png" />
<None Include="Resources\checkupdate.png" />
<None Include="Resources\about.png" />
<EmbeddedResource Include="LIB\Google.Protobuf.dll" />
<EmbeddedResource Include="LIB\Grpc.Core.Api.dll" />
<EmbeddedResource Include="LIB\Grpc.Core.dll" />
<EmbeddedResource Include="LIB\Newtonsoft.Json.dll" />
<EmbeddedResource Include="LIB\System.Buffers.dll" />
<EmbeddedResource Include="LIB\System.Memory.dll" />
<EmbeddedResource Include="LIB\System.Runtime.CompilerServices.Unsafe.dll" />
<EmbeddedResource Include="LIB\zxing.dll" />
<EmbeddedResource Include="LIB\zxing.presentation.dll" />
<Content Include="grpc_csharp_ext.x64.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="grpc_csharp_ext.x86.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Resources\help.png" />
<Content Include="Resources\privoxy_conf.txt" />
<EmbeddedResource Include="zxing.presentation.dll" />
<EmbeddedResource Include="zxing.dll" />
</ItemGroup>
<ItemGroup>
<Folder Include="protos\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
<Import Project="..\packages\Grpc.Core.2.23.0\build\net45\Grpc.Core.targets" Condition="Exists('..\packages\Grpc.Core.2.23.0\build\net45\Grpc.Core.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Grpc.Tools.2.23.0\build\Grpc.Tools.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Grpc.Tools.2.23.0\build\Grpc.Tools.props'))" />
<Error Condition="!Exists('..\packages\Grpc.Tools.2.23.0\build\Grpc.Tools.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Grpc.Tools.2.23.0\build\Grpc.Tools.targets'))" />
</Target>
<Import Project="..\packages\Grpc.Tools.2.23.0\build\Grpc.Tools.targets" Condition="Exists('..\packages\Grpc.Tools.2.23.0\build\Grpc.Tools.targets')" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">