mirror of https://github.com/2dust/v2rayN
Add TestMe button
parent
5b2a6b12af
commit
d2ab186e44
|
@ -103,6 +103,7 @@
|
|||
this.toolStripSeparator8 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.tsbOptionSetting = new System.Windows.Forms.ToolStripButton();
|
||||
this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.tsbTestMe = new System.Windows.Forms.ToolStripButton();
|
||||
this.tsbReload = new System.Windows.Forms.ToolStripButton();
|
||||
this.toolStripSeparator7 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.tsbCheckUpdate = new System.Windows.Forms.ToolStripDropDownButton();
|
||||
|
@ -606,6 +607,7 @@
|
|||
this.toolStripSeparator8,
|
||||
this.tsbOptionSetting,
|
||||
this.toolStripSeparator5,
|
||||
this.tsbTestMe,
|
||||
this.tsbReload,
|
||||
this.toolStripSeparator7,
|
||||
this.tsbCheckUpdate,
|
||||
|
@ -660,6 +662,13 @@
|
|||
this.toolStripSeparator5.Name = "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
|
||||
//
|
||||
resources.ApplyResources(this.tsbReload, "tsbReload");
|
||||
|
@ -811,7 +820,7 @@
|
|||
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.GroupBox groupBox1;
|
||||
private System.Windows.Forms.GroupBox groupBox2;
|
||||
|
@ -902,6 +911,7 @@
|
|||
private System.Windows.Forms.ToolStripMenuItem menuNotEnabledHttp;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator13;
|
||||
private System.Windows.Forms.ToolStripMenuItem tsbV2rayWebsite;
|
||||
private System.Windows.Forms.ToolStripButton tsbTestMe;
|
||||
private System.Windows.Forms.ToolStripMenuItem menuKeepNothing;
|
||||
private System.Windows.Forms.ToolStripMenuItem menuKeepPACNothing;
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ using v2rayN.Mode;
|
|||
using v2rayN.Base;
|
||||
using v2rayN.Tool;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Drawing;
|
||||
|
||||
namespace v2rayN.Forms
|
||||
{
|
||||
|
@ -577,7 +577,7 @@ namespace v2rayN.Forms
|
|||
|
||||
private void menuRemoveDuplicateServer_Click(object sender, EventArgs e)
|
||||
{
|
||||
Utils.DedupServerList(config.vmess, out List<VmessItem> servers, config.keepOlderDedupl);
|
||||
Utils.DedupServerList(config.vmess, out List<VmessItem> servers, config.keepOlderDedupl);
|
||||
int oldCount = config.vmess.Count;
|
||||
int newCount = servers.Count;
|
||||
if (servers != null)
|
||||
|
@ -1225,8 +1225,8 @@ namespace v2rayN.Forms
|
|||
|
||||
try
|
||||
{
|
||||
string fileName = Utils.GetPath(downloadHandle.DownloadFileName);
|
||||
Process process = Process.Start("v2rayUpgrade.exe", "\"" + fileName + "\"");
|
||||
string fileName = Utils.GetPath(downloadHandle.DownloadFileName);
|
||||
Process process = Process.Start("v2rayUpgrade.exe", "\"" + fileName + "\"");
|
||||
if (process.Id > 0)
|
||||
{
|
||||
menuExit_Click(null, null);
|
||||
|
@ -1516,5 +1516,12 @@ namespace v2rayN.Forms
|
|||
{
|
||||
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">
|
||||
<value>更新订阅</value>
|
||||
</data>
|
||||
<data name="tsbTestMe.Text" xml:space="preserve">
|
||||
<value>测试状态</value>
|
||||
</data>
|
||||
<data name="tsbV2rayWebsite.Text" xml:space="preserve">
|
||||
<value>V2Ray 官网</value>
|
||||
</data>
|
||||
|
|
|
@ -16,6 +16,7 @@ namespace v2rayN
|
|||
/// </summary>
|
||||
public const string SpeedTestUrl = @"http://speedtest-sgp1.digitalocean.com/10mb.test";
|
||||
public const string SpeedPingTestUrl = @"https://www.google.com/generate_204";
|
||||
public const string AvailabilityTestUrl = @"https://www.google.com/generate_204";
|
||||
|
||||
/// <summary>
|
||||
/// 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()
|
||||
{
|
||||
int pid = -1;
|
||||
|
|
|
@ -780,5 +780,14 @@ namespace v2rayN.Resx {
|
|||
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">
|
||||
<value>Start getting subscriptions</value>
|
||||
</data>
|
||||
<data name="MsgStartUpdatingPAC" xml:space="preserve">
|
||||
<value>Start updating PAC...</value>
|
||||
</data>
|
||||
<data name="MsgStartUpdating" xml:space="preserve">
|
||||
<value>Start updating {0}...</value>
|
||||
</data>
|
||||
<data name="MsgStartUpdatingPAC" xml:space="preserve">
|
||||
<value>Start updating PAC...</value>
|
||||
</data>
|
||||
<data name="MsgSubscriptionDecodingFailed" xml:space="preserve">
|
||||
<value>Subscription content decoding failed (non-BASE64 code)</value>
|
||||
</data>
|
||||
|
@ -358,4 +358,7 @@
|
|||
<data name="SuccessfullyImportedServerViaScan" xml:space="preserve">
|
||||
<value>Scan import URL successfully</value>
|
||||
</data>
|
||||
<data name="TestMeOutput" xml:space="preserve">
|
||||
<value>The ping of current service: {0}</value>
|
||||
</data>
|
||||
</root>
|
|
@ -264,12 +264,12 @@
|
|||
<data name="MsgStartGettingSubscriptions" xml:space="preserve">
|
||||
<value>开始获取订阅内容</value>
|
||||
</data>
|
||||
<data name="MsgStartUpdatingPAC" xml:space="preserve">
|
||||
<value>开始更新 PAC...</value>
|
||||
</data>
|
||||
<data name="MsgStartUpdating" xml:space="preserve">
|
||||
<value>开始更新 {0}...</value>
|
||||
</data>
|
||||
<data name="MsgStartUpdatingPAC" xml:space="preserve">
|
||||
<value>开始更新 PAC...</value>
|
||||
</data>
|
||||
<data name="MsgSubscriptionDecodingFailed" xml:space="preserve">
|
||||
<value>订阅内容解码失败(非BASE64码)</value>
|
||||
</data>
|
||||
|
@ -358,4 +358,7 @@
|
|||
<data name="SuccessfullyImportedServerViaScan" xml:space="preserve">
|
||||
<value>扫描导入URL成功</value>
|
||||
</data>
|
||||
<data name="TestMeOutput" xml:space="preserve">
|
||||
<value>当前服务的访问延迟: {0}</value>
|
||||
</data>
|
||||
</root>
|
Loading…
Reference in New Issue