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;
HideForm();
return;
}
}
}
private void MainForm_Resize(object sender, EventArgs e)
@ -109,24 +109,24 @@ namespace v2rayN.Forms
//config.uiItem.mainQRCodeWidth = splitContainer1.SplitterDistance;
}
private const int WM_QUERYENDSESSION = 0x0011;
protected override void WndProc(ref Message m)
{
switch (m.Msg)
{
case WM_QUERYENDSESSION:
Utils.SaveLog("Windows shutdown UnsetProxy");
ConfigHandler.ToJsonFile(config);
statistics?.SaveToFile();
ProxySetting.UnsetProxy();
m.Result = (IntPtr)1;
break;
default:
base.WndProc(ref m);
break;
}
}
//private const int WM_QUERYENDSESSION = 0x0011;
//protected override void WndProc(ref Message m)
//{
// switch (m.Msg)
// {
// case WM_QUERYENDSESSION:
// Utils.SaveLog("Windows shutdown UnsetProxy");
// ConfigHandler.ToJsonFile(config);
// statistics?.SaveToFile();
// ProxySetting.UnsetProxy();
// m.Result = (IntPtr)1;
// break;
// default:
// base.WndProc(ref m);
// break;
// }
//}
#endregion
#region 显示服务器 listview 和 menu
@ -593,44 +593,43 @@ namespace v2rayN.Forms
private void menuPingServer_Click(object sender, EventArgs e)
{
GetLvSelectedIndex();
ClearTestResult();
var statistics = new SpeedtestHandler(ref config, ref v2rayHandler, lvSelecteds, "ping", UpdateSpeedtestHandler);
Speedtest("ping");
}
private void menuTcpingServer_Click(object sender, EventArgs e)
{
GetLvSelectedIndex();
ClearTestResult();
var statistics = new SpeedtestHandler(ref config, ref v2rayHandler, lvSelecteds, "tcping", UpdateSpeedtestHandler);
Speedtest("tcping");
}
private void menuRealPingServer_Click(object sender, EventArgs e)
{
if (!config.sysAgentEnabled)
{
UI.Show(UIRes.I18N("NeedHttpGlobalProxy"));
return;
}
//if (!config.sysAgentEnabled)
//{
// UI.Show(UIRes.I18N("NeedHttpGlobalProxy"));
// return;
//}
UI.Show(UIRes.I18N("SpeedServerTips"));
//UI.Show(UIRes.I18N("SpeedServerTips"));
GetLvSelectedIndex();
ClearTestResult();
var statistics = new SpeedtestHandler(ref config, ref v2rayHandler, lvSelecteds, "realping", UpdateSpeedtestHandler);
Speedtest("realping");
}
private void menuSpeedServer_Click(object sender, EventArgs e)
{
if (!config.sysAgentEnabled)
{
UI.Show(UIRes.I18N("NeedHttpGlobalProxy"));
return;
}
//if (!config.sysAgentEnabled)
//{
// UI.Show(UIRes.I18N("NeedHttpGlobalProxy"));
// return;
//}
UI.Show(UIRes.I18N("SpeedServerTips"));
//UI.Show(UIRes.I18N("SpeedServerTips"));
Speedtest("speedtest");
}
private void Speedtest(string actionType)
{
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)
@ -1005,11 +1004,11 @@ namespace v2rayN.Forms
}
private void menuExit_Click(object sender, EventArgs e)
{
{
this.Visible = false;
this.Close();
this.Close();
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; }))
{
var apiRoutingRule = new Mode.RulesItem();
apiRoutingRule.inboundTag = tag;
apiRoutingRule.inboundTag = new List<string> { tag };
apiRoutingRule.outboundTag = tag;
apiRoutingRule.type = "field";
v2rayConfig.routing.rules.Add(apiRoutingRule);
@ -1430,7 +1430,7 @@ namespace v2rayN.Handler
v2rayConfig.outbounds.Add(v2rayConfigCopy.outbounds[0]);
var rule = new Mode.RulesItem();
rule.inboundTag = inbound.tag;
rule.inboundTag = new List<string> { inbound.tag };
rule.outboundTag = v2rayConfigCopy.outbounds[0].tag;
rule.type = "field";
v2rayConfig.routing.rules.Add(rule);

2
v2rayN/v2rayN/Mode/V2rayConfig.cs

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

2
v2rayN/v2rayN/Sample/SampleClientConfig.txt

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

2
v2rayN/v2rayN/packages.config

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<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>

10
v2rayN/v2rayN/v2rayN.csproj

@ -1,6 +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="..\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')" />
<PropertyGroup>
<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')" />
<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>
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {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'))" />
<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.24.0\build\Grpc.Tools.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Grpc.Tools.2.24.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')" />
<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.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">

Loading…
Cancel
Save