mirror of
https://github.com/2dust/v2rayN.git
synced 2025-04-19 21:52:25 +00:00
Add TestMe button
This commit is contained in:
parent
5b2a6b12af
commit
d2ab186e44
9 changed files with 752 additions and 40 deletions
12
v2rayN/v2rayN/Forms/MainForm.Designer.cs
generated
12
v2rayN/v2rayN/Forms/MainForm.Designer.cs
generated
|
@ -103,6 +103,7 @@
|
||||||
this.toolStripSeparator8 = new System.Windows.Forms.ToolStripSeparator();
|
this.toolStripSeparator8 = new System.Windows.Forms.ToolStripSeparator();
|
||||||
this.tsbOptionSetting = new System.Windows.Forms.ToolStripButton();
|
this.tsbOptionSetting = new System.Windows.Forms.ToolStripButton();
|
||||||
this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator();
|
this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator();
|
||||||
|
this.tsbTestMe = new System.Windows.Forms.ToolStripButton();
|
||||||
this.tsbReload = new System.Windows.Forms.ToolStripButton();
|
this.tsbReload = new System.Windows.Forms.ToolStripButton();
|
||||||
this.toolStripSeparator7 = new System.Windows.Forms.ToolStripSeparator();
|
this.toolStripSeparator7 = new System.Windows.Forms.ToolStripSeparator();
|
||||||
this.tsbCheckUpdate = new System.Windows.Forms.ToolStripDropDownButton();
|
this.tsbCheckUpdate = new System.Windows.Forms.ToolStripDropDownButton();
|
||||||
|
@ -606,6 +607,7 @@
|
||||||
this.toolStripSeparator8,
|
this.toolStripSeparator8,
|
||||||
this.tsbOptionSetting,
|
this.tsbOptionSetting,
|
||||||
this.toolStripSeparator5,
|
this.toolStripSeparator5,
|
||||||
|
this.tsbTestMe,
|
||||||
this.tsbReload,
|
this.tsbReload,
|
||||||
this.toolStripSeparator7,
|
this.toolStripSeparator7,
|
||||||
this.tsbCheckUpdate,
|
this.tsbCheckUpdate,
|
||||||
|
@ -660,6 +662,13 @@
|
||||||
this.toolStripSeparator5.Name = "toolStripSeparator5";
|
this.toolStripSeparator5.Name = "toolStripSeparator5";
|
||||||
resources.ApplyResources(this.toolStripSeparator5, "toolStripSeparator5");
|
resources.ApplyResources(this.toolStripSeparator5, "toolStripSeparator5");
|
||||||
//
|
//
|
||||||
|
// tsbTestMe
|
||||||
|
//
|
||||||
|
this.tsbTestMe.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
|
||||||
|
this.tsbTestMe.Name = "tsbTestMe";
|
||||||
|
resources.ApplyResources(this.tsbTestMe, "tsbTestMe");
|
||||||
|
this.tsbTestMe.Click += new System.EventHandler(this.tsbTestMe_Click);
|
||||||
|
//
|
||||||
// tsbReload
|
// tsbReload
|
||||||
//
|
//
|
||||||
resources.ApplyResources(this.tsbReload, "tsbReload");
|
resources.ApplyResources(this.tsbReload, "tsbReload");
|
||||||
|
@ -811,7 +820,7 @@
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private System.Windows.Forms.GroupBox groupBox1;
|
private System.Windows.Forms.GroupBox groupBox1;
|
||||||
private System.Windows.Forms.GroupBox groupBox2;
|
private System.Windows.Forms.GroupBox groupBox2;
|
||||||
|
@ -902,6 +911,7 @@
|
||||||
private System.Windows.Forms.ToolStripMenuItem menuNotEnabledHttp;
|
private System.Windows.Forms.ToolStripMenuItem menuNotEnabledHttp;
|
||||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator13;
|
private System.Windows.Forms.ToolStripSeparator toolStripSeparator13;
|
||||||
private System.Windows.Forms.ToolStripMenuItem tsbV2rayWebsite;
|
private System.Windows.Forms.ToolStripMenuItem tsbV2rayWebsite;
|
||||||
|
private System.Windows.Forms.ToolStripButton tsbTestMe;
|
||||||
private System.Windows.Forms.ToolStripMenuItem menuKeepNothing;
|
private System.Windows.Forms.ToolStripMenuItem menuKeepNothing;
|
||||||
private System.Windows.Forms.ToolStripMenuItem menuKeepPACNothing;
|
private System.Windows.Forms.ToolStripMenuItem menuKeepPACNothing;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1516,5 +1516,12 @@ namespace v2rayN.Forms
|
||||||
{
|
{
|
||||||
Process.Start(Global.v2rayWebsiteUrl);
|
Process.Start(Global.v2rayWebsiteUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void tsbTestMe_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
SpeedtestHandler statistics = new SpeedtestHandler(ref config, ref v2rayHandler, lvSelecteds, "", UpdateSpeedtestHandler);
|
||||||
|
string result = statistics.RunAvailabilityCheck() + "ms";
|
||||||
|
AppendText(false, string.Format(UIRes.I18N("TestMeOutput"), result));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -489,6 +489,9 @@
|
||||||
<data name="tsbSubUpdate.Text" xml:space="preserve">
|
<data name="tsbSubUpdate.Text" xml:space="preserve">
|
||||||
<value>更新订阅</value>
|
<value>更新订阅</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="tsbTestMe.Text" xml:space="preserve">
|
||||||
|
<value>测试状态</value>
|
||||||
|
</data>
|
||||||
<data name="tsbV2rayWebsite.Text" xml:space="preserve">
|
<data name="tsbV2rayWebsite.Text" xml:space="preserve">
|
||||||
<value>V2Ray 官网</value>
|
<value>V2Ray 官网</value>
|
||||||
</data>
|
</data>
|
||||||
|
|
|
@ -16,6 +16,7 @@ namespace v2rayN
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string SpeedTestUrl = @"http://speedtest-sgp1.digitalocean.com/10mb.test";
|
public const string SpeedTestUrl = @"http://speedtest-sgp1.digitalocean.com/10mb.test";
|
||||||
public const string SpeedPingTestUrl = @"https://www.google.com/generate_204";
|
public const string SpeedPingTestUrl = @"https://www.google.com/generate_204";
|
||||||
|
public const string AvailabilityTestUrl = @"https://www.google.com/generate_204";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// CustomRoutingListUrl
|
/// CustomRoutingListUrl
|
||||||
|
|
|
@ -150,6 +150,37 @@ namespace v2rayN.Handler
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int RunAvailabilityCheck() // alias: isLive
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
int httpPort = _config.GetLocalPort(Global.InboundHttp);
|
||||||
|
|
||||||
|
Task<int> t = Task.Factory.StartNew(() =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
WebProxy webProxy = new WebProxy(Global.Loopback, httpPort);
|
||||||
|
int responseTime = -1;
|
||||||
|
string status = GetRealPingTime(Global.AvailabilityTestUrl, webProxy, out responseTime);
|
||||||
|
bool noError = Utils.IsNullOrEmpty(status);
|
||||||
|
return noError ? responseTime : -1;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Utils.SaveLog(ex.Message, ex);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return t.Result;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Utils.SaveLog(ex.Message, ex);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void RunSpeedTest()
|
private void RunSpeedTest()
|
||||||
{
|
{
|
||||||
int pid = -1;
|
int pid = -1;
|
||||||
|
|
9
v2rayN/v2rayN/Resx/ResUI.Designer.cs
generated
9
v2rayN/v2rayN/Resx/ResUI.Designer.cs
generated
|
@ -780,5 +780,14 @@ namespace v2rayN.Resx {
|
||||||
return ResourceManager.GetString("SuccessfullyImportedServerViaScan", resourceCulture);
|
return ResourceManager.GetString("SuccessfullyImportedServerViaScan", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 The ping of current service: {0} 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
internal static string TestMeOutput {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("TestMeOutput", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -264,12 +264,12 @@
|
||||||
<data name="MsgStartGettingSubscriptions" xml:space="preserve">
|
<data name="MsgStartGettingSubscriptions" xml:space="preserve">
|
||||||
<value>Start getting subscriptions</value>
|
<value>Start getting subscriptions</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="MsgStartUpdatingPAC" xml:space="preserve">
|
|
||||||
<value>Start updating PAC...</value>
|
|
||||||
</data>
|
|
||||||
<data name="MsgStartUpdating" xml:space="preserve">
|
<data name="MsgStartUpdating" xml:space="preserve">
|
||||||
<value>Start updating {0}...</value>
|
<value>Start updating {0}...</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="MsgStartUpdatingPAC" xml:space="preserve">
|
||||||
|
<value>Start updating PAC...</value>
|
||||||
|
</data>
|
||||||
<data name="MsgSubscriptionDecodingFailed" xml:space="preserve">
|
<data name="MsgSubscriptionDecodingFailed" xml:space="preserve">
|
||||||
<value>Subscription content decoding failed (non-BASE64 code)</value>
|
<value>Subscription content decoding failed (non-BASE64 code)</value>
|
||||||
</data>
|
</data>
|
||||||
|
@ -358,4 +358,7 @@
|
||||||
<data name="SuccessfullyImportedServerViaScan" xml:space="preserve">
|
<data name="SuccessfullyImportedServerViaScan" xml:space="preserve">
|
||||||
<value>Scan import URL successfully</value>
|
<value>Scan import URL successfully</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="TestMeOutput" xml:space="preserve">
|
||||||
|
<value>The ping of current service: {0}</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
|
@ -264,12 +264,12 @@
|
||||||
<data name="MsgStartGettingSubscriptions" xml:space="preserve">
|
<data name="MsgStartGettingSubscriptions" xml:space="preserve">
|
||||||
<value>开始获取订阅内容</value>
|
<value>开始获取订阅内容</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="MsgStartUpdatingPAC" xml:space="preserve">
|
|
||||||
<value>开始更新 PAC...</value>
|
|
||||||
</data>
|
|
||||||
<data name="MsgStartUpdating" xml:space="preserve">
|
<data name="MsgStartUpdating" xml:space="preserve">
|
||||||
<value>开始更新 {0}...</value>
|
<value>开始更新 {0}...</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="MsgStartUpdatingPAC" xml:space="preserve">
|
||||||
|
<value>开始更新 PAC...</value>
|
||||||
|
</data>
|
||||||
<data name="MsgSubscriptionDecodingFailed" xml:space="preserve">
|
<data name="MsgSubscriptionDecodingFailed" xml:space="preserve">
|
||||||
<value>订阅内容解码失败(非BASE64码)</value>
|
<value>订阅内容解码失败(非BASE64码)</value>
|
||||||
</data>
|
</data>
|
||||||
|
@ -358,4 +358,7 @@
|
||||||
<data name="SuccessfullyImportedServerViaScan" xml:space="preserve">
|
<data name="SuccessfullyImportedServerViaScan" xml:space="preserve">
|
||||||
<value>扫描导入URL成功</value>
|
<value>扫描导入URL成功</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="TestMeOutput" xml:space="preserve">
|
||||||
|
<value>当前服务的访问延迟: {0}</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
Loading…
Reference in a new issue