basically completed

pull/33/head
CGQAQ 2019-08-24 21:32:33 +08:00
parent 649f0af6ec
commit f1e9737080
19 changed files with 814 additions and 109 deletions

View File

@ -88,6 +88,8 @@
this.toolSslPacPortLab = new System.Windows.Forms.ToolStripStatusLabel();
this.toolSslPacPort = new System.Windows.Forms.ToolStripStatusLabel();
this.toolSslBlank3 = new System.Windows.Forms.ToolStripStatusLabel();
this.toolSslServerSpeed = new System.Windows.Forms.ToolStripStatusLabel();
this.toolSslBlank4 = new System.Windows.Forms.ToolStripStatusLabel();
this.panel1 = new System.Windows.Forms.Panel();
this.tsMain = new System.Windows.Forms.ToolStrip();
this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator();
@ -487,7 +489,9 @@
this.toolSslBlank2,
this.toolSslPacPortLab,
this.toolSslPacPort,
this.toolSslBlank3});
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);
@ -540,6 +544,16 @@
resources.ApplyResources(this.toolSslBlank3, "toolSslBlank3");
this.toolSslBlank3.Spring = true;
//
// toolSslServerSpeed
//
this.toolSslServerSpeed.Name = "toolSslServerSpeed";
resources.ApplyResources(this.toolSslServerSpeed, "toolSslServerSpeed");
//
// toolSslBlank4
//
this.toolSslBlank4.Name = "toolSslBlank4";
resources.ApplyResources(this.toolSslBlank4, "toolSslBlank4");
//
// panel1
//
resources.ApplyResources(this.panel1, "panel1");
@ -727,6 +741,7 @@
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MainForm_FormClosing);
this.Load += new System.EventHandler(this.MainForm_Load);
this.Shown += new System.EventHandler(this.MainForm_Shown);
this.VisibleChanged += new System.EventHandler(this.MainForm_VisibleChanged);
this.Resize += new System.EventHandler(this.MainForm_Resize);
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel2.ResumeLayout(false);
@ -831,6 +846,8 @@
private System.Windows.Forms.ToolStripStatusLabel toolSslSocksPortLab;
private System.Windows.Forms.ToolStripStatusLabel toolSslHttpPortLab;
private System.Windows.Forms.ToolStripStatusLabel toolSslPacPortLab;
private System.Windows.Forms.ToolStripStatusLabel toolSslServerSpeed;
private System.Windows.Forms.ToolStripStatusLabel toolSslBlank4;
}
}

View File

@ -18,6 +18,8 @@ namespace v2rayN.Forms
private V2rayUpdateHandle v2rayUpdateHandle2;
private List<int> lvSelecteds = new List<int>();
private StatisticsHandler statistics;
#region Window 事件
public MainForm()
@ -39,7 +41,24 @@ namespace v2rayN.Forms
ConfigHandler.LoadConfig(ref config);
v2rayHandler = new V2rayHandler();
v2rayHandler.ProcessEvent += v2rayHandler_ProcessEvent;
statistics = new StatisticsHandler(config,
(ulong totalUp, ulong totalDown, ulong up, ulong down) =>
{
toolSslBlank4.Text = down.ToString();
});
}
private void MainForm_VisibleChanged(object sender, EventArgs e)
{
if (statistics == null) return;
if((sender as Form).Visible)
{
statistics.UpdateUI = true;
}
else
{
statistics.UpdateUI = false;
}
}
private void MainForm_Shown(object sender, EventArgs e)
@ -90,6 +109,7 @@ namespace v2rayN.Forms
Utils.SaveLog("Windows shutdown UnsetProxy");
//CloseV2ray();
ConfigHandler.ToJsonFile(config);
statistics.saveToFile();
ProxySetting.UnsetProxy();
m.Result = (IntPtr)1;
break;
@ -1408,5 +1428,6 @@ namespace v2rayN.Forms
#endregion
}
}

View File

@ -273,7 +273,7 @@
<value>ImageAboveText</value>
</data>
<data name="cmsLv.Size" type="System.Drawing.Size, System.Drawing">
<value>448, 490</value>
<value>448, 468</value>
</data>
<data name="&gt;&gt;cmsLv.Name" xml:space="preserve">
<value>cmsLv</value>
@ -567,7 +567,7 @@
<value>0, 17</value>
</data>
<data name="toolSslBlank1.Size" type="System.Drawing.Size, System.Drawing">
<value>282, 17</value>
<value>257, 17</value>
</data>
<data name="toolSslHttpPortLab.Size" type="System.Drawing.Size, System.Drawing">
<value>38, 17</value>
@ -579,7 +579,7 @@
<value>0, 17</value>
</data>
<data name="toolSslBlank2.Size" type="System.Drawing.Size, System.Drawing">
<value>282, 17</value>
<value>257, 17</value>
</data>
<data name="toolSslPacPortLab.Size" type="System.Drawing.Size, System.Drawing">
<value>31, 17</value>
@ -591,7 +591,19 @@
<value>0, 17</value>
</data>
<data name="toolSslBlank3.Size" type="System.Drawing.Size, System.Drawing">
<value>282, 17</value>
<value>257, 17</value>
</data>
<data name="toolSslServerSpeed.Size" type="System.Drawing.Size, System.Drawing">
<value>45, 17</value>
</data>
<data name="toolSslServerSpeed.Text" xml:space="preserve">
<value>SPEED</value>
</data>
<data name="toolSslBlank4.Size" type="System.Drawing.Size, System.Drawing">
<value>31, 17</value>
</data>
<data name="toolSslBlank4.Text" xml:space="preserve">
<value>N/A</value>
</data>
<data name="ssMain.Location" type="System.Drawing.Point, System.Drawing">
<value>3, 151</value>
@ -1184,6 +1196,18 @@
<data name="&gt;&gt;toolSslBlank3.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripStatusLabel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;toolSslServerSpeed.Name" xml:space="preserve">
<value>toolSslServerSpeed</value>
</data>
<data name="&gt;&gt;toolSslServerSpeed.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripStatusLabel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;toolSslBlank4.Name" xml:space="preserve">
<value>toolSslBlank4</value>
</data>
<data name="&gt;&gt;toolSslBlank4.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripStatusLabel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;toolStripSeparator4.Name" xml:space="preserve">
<value>toolStripSeparator4</value>
</data>

View File

@ -28,6 +28,7 @@
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(OptionSettingForm));
this.btnClose = new System.Windows.Forms.Button();
this.tabControl1 = new System.Windows.Forms.TabControl();
@ -82,6 +83,9 @@
this.txtKcpmtu = new System.Windows.Forms.TextBox();
this.label6 = new System.Windows.Forms.Label();
this.tabPage7 = new System.Windows.Forms.TabPage();
this.tbCacheDays = new System.Windows.Forms.TextBox();
this.lbCacheDays = new System.Windows.Forms.Label();
this.chkEnableStatistics = new System.Windows.Forms.CheckBox();
this.chkAllowLANConn = new System.Windows.Forms.CheckBox();
this.txturlGFWList = new System.Windows.Forms.TextBox();
this.label13 = new System.Windows.Forms.Label();
@ -89,6 +93,9 @@
this.panel2 = new System.Windows.Forms.Panel();
this.btnOK = new System.Windows.Forms.Button();
this.panel1 = new System.Windows.Forms.Panel();
this.cbFreshrate = new System.Windows.Forms.ComboBox();
this.lbFreshrate = new System.Windows.Forms.Label();
this.configBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.groupBox1.SuspendLayout();
@ -102,6 +109,7 @@
this.tabPage6.SuspendLayout();
this.tabPage7.SuspendLayout();
this.panel2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.configBindingSource)).BeginInit();
this.SuspendLayout();
//
// btnClose
@ -473,6 +481,11 @@
//
// tabPage7
//
this.tabPage7.Controls.Add(this.cbFreshrate);
this.tabPage7.Controls.Add(this.tbCacheDays);
this.tabPage7.Controls.Add(this.lbFreshrate);
this.tabPage7.Controls.Add(this.lbCacheDays);
this.tabPage7.Controls.Add(this.chkEnableStatistics);
this.tabPage7.Controls.Add(this.chkAllowLANConn);
this.tabPage7.Controls.Add(this.txturlGFWList);
this.tabPage7.Controls.Add(this.label13);
@ -481,6 +494,22 @@
this.tabPage7.Name = "tabPage7";
this.tabPage7.UseVisualStyleBackColor = true;
//
// tbCacheDays
//
resources.ApplyResources(this.tbCacheDays, "tbCacheDays");
this.tbCacheDays.Name = "tbCacheDays";
//
// lbCacheDays
//
resources.ApplyResources(this.lbCacheDays, "lbCacheDays");
this.lbCacheDays.Name = "lbCacheDays";
//
// chkEnableStatistics
//
resources.ApplyResources(this.chkEnableStatistics, "chkEnableStatistics");
this.chkEnableStatistics.Name = "chkEnableStatistics";
this.chkEnableStatistics.UseVisualStyleBackColor = true;
//
// chkAllowLANConn
//
resources.ApplyResources(this.chkAllowLANConn, "chkAllowLANConn");
@ -522,6 +551,21 @@
resources.ApplyResources(this.panel1, "panel1");
this.panel1.Name = "panel1";
//
// cbFreshrate
//
this.cbFreshrate.FormattingEnabled = true;
resources.ApplyResources(this.cbFreshrate, "cbFreshrate");
this.cbFreshrate.Name = "cbFreshrate";
//
// lbFreshrate
//
resources.ApplyResources(this.lbFreshrate, "lbFreshrate");
this.lbFreshrate.Name = "lbFreshrate";
//
// configBindingSource
//
this.configBindingSource.DataSource = typeof(v2rayN.Mode.Config);
//
// OptionSettingForm
//
resources.ApplyResources(this, "$this");
@ -553,6 +597,7 @@
this.tabPage7.ResumeLayout(false);
this.tabPage7.PerformLayout();
this.panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.configBindingSource)).EndInit();
this.ResumeLayout(false);
}
@ -619,5 +664,11 @@
private System.Windows.Forms.CheckBox chksniffingEnabled;
private System.Windows.Forms.CheckBox chksniffingEnabled2;
private System.Windows.Forms.Button btnSetDefRountingRule;
private System.Windows.Forms.CheckBox chkEnableStatistics;
private System.Windows.Forms.TextBox tbCacheDays;
private System.Windows.Forms.Label lbCacheDays;
private System.Windows.Forms.ComboBox cbFreshrate;
private System.Windows.Forms.Label lbFreshrate;
private System.Windows.Forms.BindingSource configBindingSource;
}
}

View File

@ -106,6 +106,24 @@ namespace v2rayN.Forms
chkAllowLANConn.Checked = config.allowLANConn;
var enableStatistics = config.enableStatistics;
chkEnableStatistics.Checked = enableStatistics;
tbCacheDays.Enabled = enableStatistics;
tbCacheDays.Text = config.CacheDays.ToString();
cbFreshrate.DataSource = new ComboItem[]
{
new ComboItem{ID = (int)Global.StatisticsFreshRate.quick, Text = UIRes.I18N("QuickFresh")},
new ComboItem{ID = (int)Global.StatisticsFreshRate.medium, Text = UIRes.I18N("MediumFresh")},
new ComboItem{ID = (int)Global.StatisticsFreshRate.slow, Text = UIRes.I18N("SlowFresh")},
};
cbFreshrate.DisplayMember = "Text";
cbFreshrate.ValueMember = "ID";
}
private void btnOK_Click(object sender, EventArgs e)
@ -293,6 +311,14 @@ namespace v2rayN.Forms
config.allowLANConn = chkAllowLANConn.Checked;
config.enableStatistics = chkEnableStatistics.Checked;
uint days = 0;
var valid = uint.TryParse(tbCacheDays.Text, out days);
if (!valid)
days = 7;
config.CacheDays = days;
return 0;
}
@ -358,4 +384,10 @@ namespace v2rayN.Forms
labRoutingTips.Text = text;
}
}
class ComboItem
{
public int ID { get; set; }
public string Text { get; set; }
}
}

View File

@ -1482,6 +1482,135 @@
<data name="&gt;&gt;tabPage6.ZOrder" xml:space="preserve">
<value>2</value>
</data>
<data name="cbFreshrate.Location" type="System.Drawing.Point, System.Drawing">
<value>161, 82</value>
</data>
<data name="cbFreshrate.Size" type="System.Drawing.Size, System.Drawing">
<value>121, 20</value>
</data>
<data name="cbFreshrate.TabIndex" type="System.Int32, mscorlib">
<value>32</value>
</data>
<data name="&gt;&gt;cbFreshrate.Name" xml:space="preserve">
<value>cbFreshrate</value>
</data>
<data name="&gt;&gt;cbFreshrate.Type" xml:space="preserve">
<value>System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;cbFreshrate.Parent" xml:space="preserve">
<value>tabPage7</value>
</data>
<data name="&gt;&gt;cbFreshrate.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="tbCacheDays.Location" type="System.Drawing.Point, System.Drawing">
<value>516, 109</value>
</data>
<data name="tbCacheDays.Size" type="System.Drawing.Size, System.Drawing">
<value>60, 21</value>
</data>
<data name="tbCacheDays.TabIndex" type="System.Int32, mscorlib">
<value>31</value>
</data>
<data name="&gt;&gt;tbCacheDays.Name" xml:space="preserve">
<value>tbCacheDays</value>
</data>
<data name="&gt;&gt;tbCacheDays.Type" xml:space="preserve">
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;tbCacheDays.Parent" xml:space="preserve">
<value>tabPage7</value>
</data>
<data name="&gt;&gt;tbCacheDays.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="lbFreshrate.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="lbFreshrate.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="lbFreshrate.Location" type="System.Drawing.Point, System.Drawing">
<value>30, 90</value>
</data>
<data name="lbFreshrate.Size" type="System.Drawing.Size, System.Drawing">
<value>125, 12</value>
</data>
<data name="lbFreshrate.TabIndex" type="System.Int32, mscorlib">
<value>30</value>
</data>
<data name="lbFreshrate.Text" xml:space="preserve">
<value>Statistics freshrate</value>
</data>
<data name="&gt;&gt;lbFreshrate.Name" xml:space="preserve">
<value>lbFreshrate</value>
</data>
<data name="&gt;&gt;lbFreshrate.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;lbFreshrate.Parent" xml:space="preserve">
<value>tabPage7</value>
</data>
<data name="&gt;&gt;lbFreshrate.ZOrder" xml:space="preserve">
<value>2</value>
</data>
<data name="lbCacheDays.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="lbCacheDays.Location" type="System.Drawing.Point, System.Drawing">
<value>30, 118</value>
</data>
<data name="lbCacheDays.Size" type="System.Drawing.Size, System.Drawing">
<value>455, 12</value>
</data>
<data name="lbCacheDays.TabIndex" type="System.Int32, mscorlib">
<value>30</value>
</data>
<data name="lbCacheDays.Text" xml:space="preserve">
<value>Cache days(between 0 to 30, 0 disable cache indivitual days statistic data)</value>
</data>
<data name="&gt;&gt;lbCacheDays.Name" xml:space="preserve">
<value>lbCacheDays</value>
</data>
<data name="&gt;&gt;lbCacheDays.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;lbCacheDays.Parent" xml:space="preserve">
<value>tabPage7</value>
</data>
<data name="&gt;&gt;lbCacheDays.ZOrder" xml:space="preserve">
<value>3</value>
</data>
<data name="chkEnableStatistics.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="chkEnableStatistics.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="chkEnableStatistics.Location" type="System.Drawing.Point, System.Drawing">
<value>15, 60</value>
</data>
<data name="chkEnableStatistics.Size" type="System.Drawing.Size, System.Drawing">
<value>390, 16</value>
</data>
<data name="chkEnableStatistics.TabIndex" type="System.Int32, mscorlib">
<value>29</value>
</data>
<data name="chkEnableStatistics.Text" xml:space="preserve">
<value>Enable Statistics(Realtime net speed and traffic data amount)</value>
</data>
<data name="&gt;&gt;chkEnableStatistics.Name" xml:space="preserve">
<value>chkEnableStatistics</value>
</data>
<data name="&gt;&gt;chkEnableStatistics.Type" xml:space="preserve">
<value>System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;chkEnableStatistics.Parent" xml:space="preserve">
<value>tabPage7</value>
</data>
<data name="&gt;&gt;chkEnableStatistics.ZOrder" xml:space="preserve">
<value>4</value>
</data>
<data name="chkAllowLANConn.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
@ -1507,13 +1636,13 @@
<value>tabPage7</value>
</data>
<data name="&gt;&gt;chkAllowLANConn.ZOrder" xml:space="preserve">
<value>0</value>
<value>5</value>
</data>
<data name="txturlGFWList.Location" type="System.Drawing.Point, System.Drawing">
<value>30, 132</value>
<value>32, 205</value>
</data>
<data name="txturlGFWList.Size" type="System.Drawing.Size, System.Drawing">
<value>468, 21</value>
<value>544, 21</value>
</data>
<data name="txturlGFWList.TabIndex" type="System.Int32, mscorlib">
<value>28</value>
@ -1528,13 +1657,13 @@
<value>tabPage7</value>
</data>
<data name="&gt;&gt;txturlGFWList.ZOrder" xml:space="preserve">
<value>1</value>
<value>6</value>
</data>
<data name="label13.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label13.Location" type="System.Drawing.Point, System.Drawing">
<value>30, 111</value>
<value>30, 176</value>
</data>
<data name="label13.Size" type="System.Drawing.Size, System.Drawing">
<value>431, 12</value>
@ -1555,7 +1684,7 @@
<value>tabPage7</value>
</data>
<data name="&gt;&gt;label13.ZOrder" xml:space="preserve">
<value>2</value>
<value>7</value>
</data>
<data name="chkAutoRun.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@ -1582,7 +1711,7 @@
<value>tabPage7</value>
</data>
<data name="&gt;&gt;chkAutoRun.ZOrder" xml:space="preserve">
<value>3</value>
<value>8</value>
</data>
<data name="tabPage7.Location" type="System.Drawing.Point, System.Drawing">
<value>4, 22</value>
@ -1707,6 +1836,9 @@
<data name="&gt;&gt;panel1.ZOrder" xml:space="preserve">
<value>2</value>
</data>
<metadata name="configBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
@ -1722,6 +1854,12 @@
<data name="$this.Text" xml:space="preserve">
<value>Settings</value>
</data>
<data name="&gt;&gt;configBindingSource.Name" xml:space="preserve">
<value>configBindingSource</value>
</data>
<data name="&gt;&gt;configBindingSource.Type" xml:space="preserve">
<value>System.Windows.Forms.BindingSource, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;$this.Name" xml:space="preserve">
<value>OptionSettingForm</value>
</data>

View File

@ -291,4 +291,13 @@
<data name="chkEnableHotkey.Text" xml:space="preserve">
<value>启用快捷键(Ctrl+P ping 选中服务器/ Ctrl+T 测速选中服务器)</value>
</data>
<data name="chkEnableStatistics.Text" xml:space="preserve">
<value>启用统计(实时网速显示和使用流量显示)</value>
</data>
<data name="lbCacheDays.Text" xml:space="preserve">
<value>缓存天数0-30 0关闭缓存单独每天的数据使用情况</value>
</data>
<data name="lbFreshrate.Text" xml:space="preserve">
<value>统计刷新频率</value>
</data>
</root>

View File

@ -141,6 +141,19 @@ namespace v2rayN
/// </summary>
public const string CustomIconName = "v2rayN.ico";
public const string InboundAPITagName = "api";
public const string InboundProxyTagName = "proxy";
public const string Loopback = "127.0.0.1";
public const string InboundAPIProtocal = "dokodemo-door";
public const uint InboundAPIPort = 10085;
public enum StatisticsFreshRate
{
quick = 1000,
medium = 2000,
slow = 3000
}
#endregion
#region 全局变量

View File

@ -40,6 +40,15 @@ namespace v2rayN.Handler
////默认监听端口
//config.pacPort = 8888;
// 默认缓存七天
config.CacheDays = 7;
// 默认不开启统计
config.enableStatistics = false;
// 默认中等刷新率
config.statisticsFreshRate = (int)Global.StatisticsFreshRate.medium;
}
//本地监听

View File

@ -0,0 +1,159 @@
using System;
using System.Threading;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Diagnostics;
using v2rayN.Mode;
namespace v2rayN.Handler
{
class StatisticsHandler
{
private Config config_;
private const string cliName_ = "v2ctl.exe";
private string args_ = "";
private Process connector_;
private Thread workThread_;
Action<ulong, ulong, ulong, ulong> updateFunc_;
private bool enabled_;
public bool Enable
{
get { return enabled_; }
set { enabled_ = value; }
}
public bool UpdateUI;
private StringBuilder outputBuilder_;
public UInt64 TotalUp { get; private set; }
public UInt64 TotalDown { get; private set; }
public UInt64 Up { get; private set; }
public UInt64 Down { get; private set; }
public StatisticsHandler(Config config, Action<ulong, ulong, ulong, ulong> update)
{
config_ = config;
enabled_ = config.enableStatistics;
UpdateUI = false;
updateFunc_ = update;
outputBuilder_ = new StringBuilder();
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_.Start();
}
public void run()
{
try
{
while (true)
{
if (enabled_)
{
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 (UpdateUI)
updateFunc_(TotalUp, TotalDown, Up, Down);
Thread.Sleep(config_.statisticsFreshRate);
}
}
}
catch (Exception e)
{ }
}
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 (name == Global.InboundProxyTagName)
{
if (type == "uplink")
{
up = UInt64.Parse(value);
}
else if (type == "downlink")
{
down = UInt64.Parse(value);
}
}
}
catch { }
}
}
public void saveToFile()
{
}
public void loadFromFile()
{
}
}
}

View File

@ -4,6 +4,7 @@ using System.IO;
using v2rayN.Mode;
using System.Net;
using System.Text;
using System.Linq;
namespace v2rayN.Handler
{
@ -78,6 +79,9 @@ namespace v2rayN.Handler
//dns
dns(config, ref v2rayConfig);
// TODO: 统计配置
statistic(config, ref v2rayConfig);
Utils.ToJsonFile(v2rayConfig, fileName);
msg = string.Format(UIRes.I18N("SuccessfulConfiguration"), config.getSummary());
@ -613,6 +617,51 @@ namespace v2rayN.Handler
return 0;
}
public static int statistic(Config config, ref V2rayConfig v2rayConfig)
{
if (config.enableStatistics)
{
var tag = Global.InboundAPITagName;
var apiObj = new Mode.API();
var policyObj = new Mode.Policy();
var policySystemSetting = new Mode.SystemPolicy();
string[] services = { "StatsService" };
v2rayConfig.stats = new Stats();
apiObj.tag = tag;
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; }))
{
var apiInbound = new Mode.Inbounds();
var apiInboundSettings = new Mode.Inboundsettings();
apiInbound.tag = tag;
apiInbound.listen = Global.Loopback;
apiInbound.port = config.port();
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; }))
{
var apiRoutingRule = new Mode.RulesItem();
apiRoutingRule.inboundTag = tag;
apiRoutingRule.outboundTag = tag;
apiRoutingRule.type = "field";
v2rayConfig.routing.rules.Add(apiRoutingRule);
}
}
return 0;
}
/// <summary>
/// 生成v2ray的客户端配置文件(自定义配置)
/// </summary>

View File

@ -91,6 +91,32 @@ namespace v2rayN.Mode
/// </summary>
public bool allowLANConn { get; set; }
/// <summary>
/// 启用实时网速和流量统计
/// </summary>
public bool enableStatistics { get; set; }
/// <summary>
/// 视图刷新率
/// </summary>
public int statisticsFreshRate { get; set; }
/// <summary>
/// 统计数据缓存天数 [0, 30]
/// * 0 关闭单独每天使用流量的缓存
/// * 无论如何不会关闭总流量的缓存
/// </summary>
private uint cacheDays;
public uint CacheDays {
get { return cacheDays; }
set
{
if (value < 0) cacheDays = 0;
else if (value > 30) cacheDays = 30;
else cacheDays = value;
}
}
/// <summary>
/// 自定义远程DNS
/// </summary>

View File

@ -21,6 +21,43 @@ 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;
/// <summary>
/// DNS 配置
/// </summary>
@ -31,6 +68,25 @@ namespace v2rayN.Mode
public Routing routing { get; set; }
}
public class Stats { };
public class API
{
public string tag { get; set; }
public List<string> services { get; set; }
}
public class Policy
{
public SystemPolicy system;
}
public class SystemPolicy
{
public bool statsInboundUplink;
public bool statsInboundDownlink;
}
public class Log
{
/// <summary>
@ -49,6 +105,7 @@ namespace v2rayN.Mode
public class Inbounds
{
public string tag { get; set; }
/// <summary>
///
/// </summary>
@ -92,6 +149,11 @@ namespace v2rayN.Mode
/// </summary>
public string ip { get; set; }
/// <summary>
/// api 使用
/// </summary>
public string address { get; set; }
/// <summary>
///
/// </summary>
@ -273,6 +335,8 @@ namespace v2rayN.Mode
///
/// </summary>
public string port { get; set; }
public string inboundTag { get; set; }
/// <summary>
///
/// </summary>

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is automatically generated by Visual Studio .Net. It is
used to store generic object data source configuration information.
Renaming the file extension or editing the content of this file may
cause the file to be unrecognizable by the program.
-->
<GenericObjectDataSource DisplayName="Config" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
<TypeInfo>v2rayN.Mode.Config, v2rayN, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
</GenericObjectDataSource>

View File

@ -1,10 +1,10 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
@ -13,13 +13,13 @@ namespace v2rayN.Resx {
/// <summary>
/// 一个强类型的资源类,用于查找本地化的字符串等。
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// 此类是由 StronglyTypedResourceBuilder
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class ResUI {
@ -33,7 +33,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 返回此类使用的缓存的 ResourceManager 实例。
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
@ -47,8 +47,8 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 使用此强类型资源类,为所有资源查找
/// 重写当前线程的 CurrentUICulture 属性。
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
@ -61,7 +61,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Batch export subscription to clipboard successfully 的本地化字符串。
/// Looks up a localized string similar to Batch export subscription to clipboard successfully.
/// </summary>
internal static string BatchExportSubscriptionSuccessfully {
get {
@ -70,7 +70,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Batch export share URL to clipboard successfully 的本地化字符串。
/// Looks up a localized string similar to Batch export share URL to clipboard successfully.
/// </summary>
internal static string BatchExportURLSuccessfully {
get {
@ -79,7 +79,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Please check the server settings first 的本地化字符串。
/// Looks up a localized string similar to Please check the server settings first.
/// </summary>
internal static string CheckServerSettings {
get {
@ -88,7 +88,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 configuration format is incorrect 的本地化字符串。
/// Looks up a localized string similar to configuration format is incorrect.
/// </summary>
internal static string ConfigurationFormatIncorrect {
get {
@ -97,7 +97,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Note that custom configuration relies entirely on your own configuration and does not work with all settings. The system agent is available when the socks port is equal to the port in the settings in the custom configuration inbound. 的本地化字符串。
/// Looks up a localized string similar to Note that custom configuration relies entirely on your own configuration and does not work with all settings. The system agent is available when the socks port is equal to the port in the settings in the custom configuration inbound..
/// </summary>
internal static string CustomServerTips {
get {
@ -106,7 +106,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Whether to download? {0} 的本地化字符串。
/// Looks up a localized string similar to Whether to download? {0}.
/// </summary>
internal static string DownloadYesNo {
get {
@ -115,7 +115,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Failed to convert configuration file 的本地化字符串。
/// Looks up a localized string similar to Failed to convert configuration file.
/// </summary>
internal static string FailedConversionConfiguration {
get {
@ -124,7 +124,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Failed to generate default configuration file 的本地化字符串。
/// Looks up a localized string similar to Failed to generate default configuration file.
/// </summary>
internal static string FailedGenDefaultConfiguration {
get {
@ -133,7 +133,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Failed to get the default configuration 的本地化字符串。
/// Looks up a localized string similar to Failed to get the default configuration.
/// </summary>
internal static string FailedGetDefaultConfiguration {
get {
@ -142,7 +142,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Failed to import custom configuration server 的本地化字符串。
/// Looks up a localized string similar to Failed to import custom configuration server.
/// </summary>
internal static string FailedImportedCustomServer {
get {
@ -151,7 +151,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Failed to read configuration file 的本地化字符串。
/// Looks up a localized string similar to Failed to read configuration file.
/// </summary>
internal static string FailedReadConfiguration {
get {
@ -160,7 +160,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Please fill in the correct format extra ID 的本地化字符串。
/// Looks up a localized string similar to Please fill in the correct format extra ID.
/// </summary>
internal static string FillCorrectAlterId {
get {
@ -169,7 +169,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Please fill in the correct format server port 的本地化字符串。
/// Looks up a localized string similar to Please fill in the correct format server port.
/// </summary>
internal static string FillCorrectServerPort {
get {
@ -178,7 +178,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Please fill in the KCP parameters correctly 的本地化字符串。
/// Looks up a localized string similar to Please fill in the KCP parameters correctly.
/// </summary>
internal static string FillKcpParameters {
get {
@ -187,7 +187,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Please fill in the local listening port 的本地化字符串。
/// Looks up a localized string similar to Please fill in the local listening port.
/// </summary>
internal static string FillLocalListeningPort {
get {
@ -196,7 +196,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Please fill in the password 的本地化字符串。
/// Looks up a localized string similar to Please fill in the password.
/// </summary>
internal static string FillPassword {
get {
@ -205,7 +205,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Please fill in the server address 的本地化字符串。
/// Looks up a localized string similar to Please fill in the server address.
/// </summary>
internal static string FillServerAddress {
get {
@ -214,7 +214,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Please fill in the user ID 的本地化字符串。
/// Looks up a localized string similar to Please fill in the user ID.
/// </summary>
internal static string FillUUID {
get {
@ -223,7 +223,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 is not the correct client configuration file, please check 的本地化字符串。
/// Looks up a localized string similar to is not the correct client configuration file, please check.
/// </summary>
internal static string IncorrectClientConfiguration {
get {
@ -232,7 +232,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 is not the correct configuration, please check 的本地化字符串。
/// Looks up a localized string similar to is not the correct configuration, please check.
/// </summary>
internal static string Incorrectconfiguration {
get {
@ -241,7 +241,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 is not the correct server configuration file, please check 的本地化字符串。
/// Looks up a localized string similar to is not the correct server configuration file, please check.
/// </summary>
internal static string IncorrectServerConfiguration {
get {
@ -250,7 +250,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Initial Configuration 的本地化字符串。
/// Looks up a localized string similar to Initial Configuration.
/// </summary>
internal static string InitialConfiguration {
get {
@ -259,7 +259,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Address 的本地化字符串。
/// Looks up a localized string similar to Address.
/// </summary>
internal static string LvAddress {
get {
@ -268,7 +268,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Alias 的本地化字符串。
/// Looks up a localized string similar to Alias.
/// </summary>
internal static string LvAlias {
get {
@ -277,7 +277,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Security 的本地化字符串。
/// Looks up a localized string similar to Security.
/// </summary>
internal static string LvEncryptionMethod {
get {
@ -286,7 +286,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Port 的本地化字符串。
/// Looks up a localized string similar to Port.
/// </summary>
internal static string LvPort {
get {
@ -295,7 +295,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Type 的本地化字符串。
/// Looks up a localized string similar to Type.
/// </summary>
internal static string LvServiceType {
get {
@ -304,7 +304,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Subs 的本地化字符串。
/// Looks up a localized string similar to Subs.
/// </summary>
internal static string LvSubscription {
get {
@ -313,7 +313,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Test Results 的本地化字符串。
/// Looks up a localized string similar to Test Results.
/// </summary>
internal static string LvTestResults {
get {
@ -322,7 +322,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Transport 的本地化字符串。
/// Looks up a localized string similar to Transport.
/// </summary>
internal static string LvTransportProtocol {
get {
@ -331,7 +331,16 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Clear original subscription content 的本地化字符串。
/// Looks up a localized string similar to MediumFresh.
/// </summary>
internal static string MediumFresh {
get {
return ResourceManager.GetString("MediumFresh", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Clear original subscription content.
/// </summary>
internal static string MsgClearSubscription {
get {
@ -340,7 +349,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Download V2rayCore successfully 的本地化字符串。
/// Looks up a localized string similar to Download V2rayCore successfully.
/// </summary>
internal static string MsgDownloadV2rayCoreSuccessfully {
get {
@ -349,7 +358,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Failed to import subscription content 的本地化字符串。
/// Looks up a localized string similar to Failed to import subscription content.
/// </summary>
internal static string MsgFailedImportSubscription {
get {
@ -358,7 +367,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Get the subscription content successfully 的本地化字符串。
/// Looks up a localized string similar to Get the subscription content successfully.
/// </summary>
internal static string MsgGetSubscriptionSuccessfully {
get {
@ -367,7 +376,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 No valid subscriptions set 的本地化字符串。
/// Looks up a localized string similar to No valid subscriptions set.
/// </summary>
internal static string MsgNoValidSubscription {
get {
@ -376,7 +385,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 PAC update failed 的本地化字符串。
/// Looks up a localized string similar to PAC update failed.
/// </summary>
internal static string MsgPACUpdateFailed {
get {
@ -385,7 +394,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 PAC update succeeded 的本地化字符串。
/// Looks up a localized string similar to PAC update succeeded.
/// </summary>
internal static string MsgPACUpdateSuccessfully {
get {
@ -394,7 +403,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Resolve V2rayCore successfully 的本地化字符串。
/// Looks up a localized string similar to Resolve V2rayCore successfully.
/// </summary>
internal static string MsgParsingV2rayCoreSuccessfully {
get {
@ -403,7 +412,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Simplify PAC Success 的本地化字符串。
/// Looks up a localized string similar to Simplify PAC Success.
/// </summary>
internal static string MsgSimplifyPAC {
get {
@ -412,7 +421,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Start getting subscriptions 的本地化字符串。
/// Looks up a localized string similar to Start getting subscriptions.
/// </summary>
internal static string MsgStartGettingSubscriptions {
get {
@ -421,7 +430,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Start updating PAC... 的本地化字符串。
/// Looks up a localized string similar to Start updating PAC....
/// </summary>
internal static string MsgStartUpdatingPAC {
get {
@ -430,7 +439,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Start updating V2rayCore... 的本地化字符串。
/// Looks up a localized string similar to Start updating V2rayCore....
/// </summary>
internal static string MsgStartUpdatingV2rayCore {
get {
@ -439,7 +448,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Subscription content decoding failed (non-BASE64 code) 的本地化字符串。
/// Looks up a localized string similar to Subscription content decoding failed (non-BASE64 code).
/// </summary>
internal static string MsgSubscriptionDecodingFailed {
get {
@ -448,7 +457,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 is unpacking... 的本地化字符串。
/// Looks up a localized string similar to is unpacking....
/// </summary>
internal static string MsgUnpacking {
get {
@ -457,7 +466,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Update subscription end 的本地化字符串。
/// Looks up a localized string similar to Update subscription end.
/// </summary>
internal static string MsgUpdateSubscriptionEnd {
get {
@ -466,7 +475,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Update subscription starts 的本地化字符串。
/// Looks up a localized string similar to Update subscription starts.
/// </summary>
internal static string MsgUpdateSubscriptionStart {
get {
@ -475,7 +484,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Update V2rayCore successfully 的本地化字符串。
/// Looks up a localized string similar to Update V2rayCore successfully.
/// </summary>
internal static string MsgUpdateV2rayCoreSuccessfully {
get {
@ -484,7 +493,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Update V2rayCore successfully! Restarting service... 的本地化字符串。
/// Looks up a localized string similar to Update V2rayCore successfully! Restarting service....
/// </summary>
internal static string MsgUpdateV2rayCoreSuccessfullyMore {
get {
@ -493,7 +502,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 This feature relies on the Http global proxy, please set it correctly first. 的本地化字符串。
/// Looks up a localized string similar to This feature relies on the Http global proxy, please set it correctly first..
/// </summary>
internal static string NeedHttpGlobalProxy {
get {
@ -502,7 +511,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Non-vmess or ss protocol 的本地化字符串。
/// Looks up a localized string similar to Non-vmess or ss protocol.
/// </summary>
internal static string NonvmessOrssProtocol {
get {
@ -511,7 +520,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 non-Vmess service, this feature is invalid 的本地化字符串。
/// Looks up a localized string similar to non-Vmess service, this feature is invalid.
/// </summary>
internal static string NonVmessService {
get {
@ -520,7 +529,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 V2ray-core not found, download address: {0} 的本地化字符串。
/// Looks up a localized string similar to V2ray-core not found, download address: {0}.
/// </summary>
internal static string NotFoundCore {
get {
@ -529,7 +538,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Scan completed, no valid QR code found 的本地化字符串。
/// Looks up a localized string similar to Scan completed, no valid QR code found.
/// </summary>
internal static string NoValidQRcodeFound {
get {
@ -538,7 +547,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 operation failed, please check retry 的本地化字符串。
/// Looks up a localized string similar to operation failed, please check retry.
/// </summary>
internal static string OperationFailed {
get {
@ -547,7 +556,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Please Fill Remarks 的本地化字符串。
/// Looks up a localized string similar to Please Fill Remarks.
/// </summary>
internal static string PleaseFillRemarks {
get {
@ -556,7 +565,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Please select the encryption method 的本地化字符串。
/// Looks up a localized string similar to Please select the encryption method.
/// </summary>
internal static string PleaseSelectEncryption {
get {
@ -565,7 +574,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Please select an agreement 的本地化字符串。
/// Looks up a localized string similar to Please select an agreement.
/// </summary>
internal static string PleaseSelectProtocol {
get {
@ -574,7 +583,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Please select the server first 的本地化字符串。
/// Looks up a localized string similar to Please select the server first.
/// </summary>
internal static string PleaseSelectServer {
get {
@ -583,7 +592,16 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Are you sure to remove the server? 的本地化字符串。
/// Looks up a localized string similar to QuickFresh.
/// </summary>
internal static string QuickFresh {
get {
return ResourceManager.GetString("QuickFresh", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Are you sure to remove the server?.
/// </summary>
internal static string RemoveServer {
get {
@ -592,7 +610,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 The client configuration file is saved at: {0} 的本地化字符串。
/// Looks up a localized string similar to The client configuration file is saved at: {0}.
/// </summary>
internal static string SaveClientConfigurationIn {
get {
@ -601,7 +619,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 The server configuration file is saved at: {0} 的本地化字符串。
/// Looks up a localized string similar to The server configuration file is saved at: {0}.
/// </summary>
internal static string SaveServerConfigurationIn {
get {
@ -610,7 +628,16 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Note: After this function relies on the Http global proxy test, please manually adjust the Http global proxy and active node! 的本地化字符串。
/// Looks up a localized string similar to SlowFresh.
/// </summary>
internal static string SlowFresh {
get {
return ResourceManager.GetString("SlowFresh", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Note: After this function relies on the Http global proxy test, please manually adjust the Http global proxy and active node!.
/// </summary>
internal static string SpeedServerTips {
get {
@ -619,7 +646,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Start service ({0})...... 的本地化字符串。
/// Looks up a localized string similar to Start service ({0}).......
/// </summary>
internal static string StartService {
get {
@ -628,8 +655,8 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Successful configuration
///{0} 的本地化字符串。
/// Looks up a localized string similar to Successful configuration
///{0}.
/// </summary>
internal static string SuccessfulConfiguration {
get {
@ -638,7 +665,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Successfully imported custom configuration server 的本地化字符串。
/// Looks up a localized string similar to Successfully imported custom configuration server.
/// </summary>
internal static string SuccessfullyImportedCustomServer {
get {
@ -647,7 +674,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Imported bulk URL from clipboard successfully 的本地化字符串。
/// Looks up a localized string similar to Imported bulk URL from clipboard successfully.
/// </summary>
internal static string SuccessfullyImportedServerViaClipboard {
get {
@ -656,7 +683,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Scan import URL successfully 的本地化字符串。
/// Looks up a localized string similar to Scan import URL successfully.
/// </summary>
internal static string SuccessfullyImportedServerViaScan {
get {

View File

@ -319,4 +319,13 @@
<data name="MsgUpdateV2rayCoreSuccessfullyMore" xml:space="preserve">
<value>Update V2rayCore successfully! Restarting service...</value>
</data>
<data name="MediumFresh" xml:space="preserve">
<value>MediumFresh</value>
</data>
<data name="QuickFresh" xml:space="preserve">
<value>QuickFresh</value>
</data>
<data name="SlowFresh" xml:space="preserve">
<value>SlowFresh</value>
</data>
</root>

View File

@ -319,4 +319,13 @@
<data name="MsgUpdateV2rayCoreSuccessfullyMore" xml:space="preserve">
<value>更新V2rayCore成功正在重启服务...</value>
</data>
<data name="MediumFresh" xml:space="preserve">
<value>中等</value>
</data>
<data name="QuickFresh" xml:space="preserve">
<value>快</value>
</data>
<data name="SlowFresh" xml:space="preserve">
<value>慢</value>
</data>
</root>

View File

@ -1,25 +1,55 @@
{
"stats": {},
"api": {
"tag": "api",
"services": [
"StatsService"
]
},
"policy": {
"system": {
"statsInboundUplink": true,
"statsInboundDownlink": true
}
},
"log": {
"access": "",
"error": "",
"loglevel": "error"
},
"log": {
"access": "Vaccess.log",
"error": "Verror.log",
"loglevel": "warning"
},
"inbounds": [{
"port": 10808,
"protocol": "socks",
"listen": "127.0.0.1",
"settings": {
"auth": "noauth",
"udp": true
"inbounds": [
{
"tag": "proxy",
"port": 10808,
"protocol": "socks",
"listen": "127.0.0.1",
"settings": {
"auth": "noauth",
"udp": true
},
"sniffing": {
"enabled": true,
"destOverride": [
"http",
"tls"
]
}
},
"sniffing": {
"enabled": true,
"destOverride": [
"http",
"tls"
]
}
}],
{
"listen": "127.0.0.1",
"port": 10085,
"protocol": "dokodemo-door",
"settings": {
"address": "127.0.0.1"
},
"tag": "api"
}
],
"outbounds": [{
"tag": "proxy",
"protocol": "vmess",
@ -66,6 +96,12 @@
],
"routing": {
"domainStrategy": "IPIfNonMatch",
"rules": []
"rules": [
{
"inboundTag": "api",
"outboundTag": "api",
"type": "field"
}
]
}
}

View File

@ -142,6 +142,7 @@
<Compile Include="Forms\SubSettingControl.Designer.cs">
<DependentUpon>SubSettingControl.cs</DependentUpon>
</Compile>
<Compile Include="Handler\StatisticsHandler.cs" />
<Compile Include="Handler\V2rayUpdateHandle.cs" />
<Compile Include="HttpProxyHandler\HttpWebServer.cs" />
<Compile Include="HttpProxyHandler\HttpWebServerB.cs" />
@ -290,6 +291,7 @@
<EmbeddedResource Include="app.config">
<SubType>Designer</SubType>
</EmbeddedResource>
<None Include="Properties\DataSources\v2rayN.Mode.Config.datasource" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>