Browse Source

up speedtest

pull/266/head
2dust 5 years ago
parent
commit
2779670fa2
  1. 87
      v2rayN/v2rayN/Forms/MainForm.cs
  2. 4
      v2rayN/v2rayN/Handler/V2rayConfigHandler.cs
  3. 2
      v2rayN/v2rayN/Mode/V2rayConfig.cs
  4. 2
      v2rayN/v2rayN/Sample/SampleClientConfig.txt
  5. 2
      v2rayN/v2rayN/packages.config
  6. 10
      v2rayN/v2rayN/v2rayN.csproj

87
v2rayN/v2rayN/Forms/MainForm.cs

@ -89,7 +89,7 @@ namespace v2rayN.Forms
e.Cancel = true; e.Cancel = true;
HideForm(); HideForm();
return; return;
} }
} }
private void MainForm_Resize(object sender, EventArgs e) private void MainForm_Resize(object sender, EventArgs e)
@ -109,24 +109,24 @@ namespace v2rayN.Forms
//config.uiItem.mainQRCodeWidth = splitContainer1.SplitterDistance; //config.uiItem.mainQRCodeWidth = splitContainer1.SplitterDistance;
} }
private const int WM_QUERYENDSESSION = 0x0011; //private const int WM_QUERYENDSESSION = 0x0011;
protected override void WndProc(ref Message m) //protected override void WndProc(ref Message m)
{ //{
switch (m.Msg) // switch (m.Msg)
{ // {
case WM_QUERYENDSESSION: // case WM_QUERYENDSESSION:
Utils.SaveLog("Windows shutdown UnsetProxy"); // Utils.SaveLog("Windows shutdown UnsetProxy");
ConfigHandler.ToJsonFile(config); // ConfigHandler.ToJsonFile(config);
statistics?.SaveToFile(); // statistics?.SaveToFile();
ProxySetting.UnsetProxy(); // ProxySetting.UnsetProxy();
m.Result = (IntPtr)1; // m.Result = (IntPtr)1;
break; // break;
default: // default:
base.WndProc(ref m); // base.WndProc(ref m);
break; // break;
} // }
} //}
#endregion #endregion
#region 显示服务器 listview 和 menu #region 显示服务器 listview 和 menu
@ -593,44 +593,43 @@ namespace v2rayN.Forms
private void menuPingServer_Click(object sender, EventArgs e) private void menuPingServer_Click(object sender, EventArgs e)
{ {
GetLvSelectedIndex(); Speedtest("ping");
ClearTestResult();
var statistics = new SpeedtestHandler(ref config, ref v2rayHandler, lvSelecteds, "ping", UpdateSpeedtestHandler);
} }
private void menuTcpingServer_Click(object sender, EventArgs e) private void menuTcpingServer_Click(object sender, EventArgs e)
{ {
GetLvSelectedIndex(); Speedtest("tcping");
ClearTestResult();
var statistics = new SpeedtestHandler(ref config, ref v2rayHandler, lvSelecteds, "tcping", UpdateSpeedtestHandler);
} }
private void menuRealPingServer_Click(object sender, EventArgs e) private void menuRealPingServer_Click(object sender, EventArgs e)
{ {
if (!config.sysAgentEnabled) //if (!config.sysAgentEnabled)
{ //{
UI.Show(UIRes.I18N("NeedHttpGlobalProxy")); // UI.Show(UIRes.I18N("NeedHttpGlobalProxy"));
return; // return;
} //}
UI.Show(UIRes.I18N("SpeedServerTips")); //UI.Show(UIRes.I18N("SpeedServerTips"));
GetLvSelectedIndex(); Speedtest("realping");
ClearTestResult();
var statistics = new SpeedtestHandler(ref config, ref v2rayHandler, lvSelecteds, "realping", UpdateSpeedtestHandler);
} }
private void menuSpeedServer_Click(object sender, EventArgs e) private void menuSpeedServer_Click(object sender, EventArgs e)
{ {
if (!config.sysAgentEnabled) //if (!config.sysAgentEnabled)
{ //{
UI.Show(UIRes.I18N("NeedHttpGlobalProxy")); // UI.Show(UIRes.I18N("NeedHttpGlobalProxy"));
return; // return;
} //}
UI.Show(UIRes.I18N("SpeedServerTips")); //UI.Show(UIRes.I18N("SpeedServerTips"));
Speedtest("speedtest");
}
private void Speedtest(string actionType)
{
GetLvSelectedIndex(); GetLvSelectedIndex();
var statistics = new SpeedtestHandler(ref config, ref v2rayHandler, lvSelecteds, "speedtest", UpdateSpeedtestHandler); ClearTestResult();
var statistics = new SpeedtestHandler(ref config, ref v2rayHandler, lvSelecteds, actionType, UpdateSpeedtestHandler);
} }
private void menuExport2ClientConfig_Click(object sender, EventArgs e) private void menuExport2ClientConfig_Click(object sender, EventArgs e)
@ -1005,11 +1004,11 @@ namespace v2rayN.Forms
} }
private void menuExit_Click(object sender, EventArgs e) private void menuExit_Click(object sender, EventArgs e)
{ {
this.Visible = false; this.Visible = false;
this.Close(); this.Close();
Application.Exit(); Application.Exit();
} }

4
v2rayN/v2rayN/Handler/V2rayConfigHandler.cs

@ -655,7 +655,7 @@ namespace v2rayN.Handler
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(); var apiRoutingRule = new Mode.RulesItem();
apiRoutingRule.inboundTag = tag; apiRoutingRule.inboundTag = new List<string> { tag };
apiRoutingRule.outboundTag = tag; apiRoutingRule.outboundTag = tag;
apiRoutingRule.type = "field"; apiRoutingRule.type = "field";
v2rayConfig.routing.rules.Add(apiRoutingRule); v2rayConfig.routing.rules.Add(apiRoutingRule);
@ -1430,7 +1430,7 @@ namespace v2rayN.Handler
v2rayConfig.outbounds.Add(v2rayConfigCopy.outbounds[0]); v2rayConfig.outbounds.Add(v2rayConfigCopy.outbounds[0]);
var rule = new Mode.RulesItem(); var rule = new Mode.RulesItem();
rule.inboundTag = inbound.tag; rule.inboundTag = new List<string> { inbound.tag };
rule.outboundTag = v2rayConfigCopy.outbounds[0].tag; rule.outboundTag = v2rayConfigCopy.outbounds[0].tag;
rule.type = "field"; rule.type = "field";
v2rayConfig.routing.rules.Add(rule); v2rayConfig.routing.rules.Add(rule);

2
v2rayN/v2rayN/Mode/V2rayConfig.cs

@ -310,7 +310,7 @@ namespace v2rayN.Mode
/// </summary> /// </summary>
public string port { get; set; } public string port { get; set; }
public string inboundTag { get; set; } public List<string> inboundTag { get; set; }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>

2
v2rayN/v2rayN/Sample/SampleClientConfig.txt

@ -76,7 +76,7 @@
"domainStrategy": "IPIfNonMatch", "domainStrategy": "IPIfNonMatch",
"rules": [ "rules": [
{ {
"inboundTag": "api", "inboundTag": ["api"],
"outboundTag": "api", "outboundTag": "api",
"type": "field" "type": "field"
} }

2
v2rayN/v2rayN/packages.config

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

10
v2rayN/v2rayN/v2rayN.csproj

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <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="..\packages\Grpc.Tools.2.24.0\build\Grpc.Tools.props" Condition="Exists('..\packages\Grpc.Tools.2.24.0\build\Grpc.Tools.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@ -434,12 +434,12 @@
<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')" /> <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"> <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup> <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> <ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
</PropertyGroup> </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.24.0\build\Grpc.Tools.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Grpc.Tools.2.24.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'))" /> <Error Condition="!Exists('..\packages\Grpc.Tools.2.24.0\build\Grpc.Tools.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Grpc.Tools.2.24.0\build\Grpc.Tools.targets'))" />
</Target> </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')" /> <Import Project="..\packages\Grpc.Tools.2.24.0\build\Grpc.Tools.targets" Condition="Exists('..\packages\Grpc.Tools.2.24.0\build\Grpc.Tools.targets')" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- 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. Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild"> <Target Name="BeforeBuild">

Loading…
Cancel
Save