Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f199e3bf82 | ||
|
|
7d31c2e472 | ||
|
|
ad406c3682 | ||
|
|
2779670fa2 | ||
|
|
5b00bf82fb | ||
|
|
473e0cf839 |
@@ -41,6 +41,7 @@ namespace v2rayN.Base
|
||||
{
|
||||
if (!listener.Pending())
|
||||
{
|
||||
Thread.Sleep(100);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@ namespace v2rayN.Forms
|
||||
Utils.ClearTempPath();
|
||||
|
||||
v2rayHandler.V2rayStop();
|
||||
HttpProxyHandle.Update(config, true);
|
||||
HttpProxyHandle.CloseHttpAgent(config);
|
||||
PACServerHandle.Stop();
|
||||
|
||||
@@ -88,7 +89,7 @@ namespace v2rayN.Forms
|
||||
e.Cancel = true;
|
||||
HideForm();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void MainForm_Resize(object sender, EventArgs e)
|
||||
@@ -108,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
|
||||
@@ -592,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)
|
||||
@@ -1004,11 +1004,11 @@ namespace v2rayN.Forms
|
||||
}
|
||||
|
||||
private void menuExit_Click(object sender, EventArgs e)
|
||||
{
|
||||
{
|
||||
|
||||
this.Visible = false;
|
||||
this.Close();
|
||||
|
||||
this.Close();
|
||||
|
||||
Application.Exit();
|
||||
}
|
||||
|
||||
|
||||
@@ -515,11 +515,11 @@ namespace v2rayN.Handler
|
||||
{
|
||||
string newFileName = string.Empty;
|
||||
newFileName = string.Format("{0}.json", Utils.GetGUID());
|
||||
newFileName = Path.Combine(Utils.GetTempPath(), newFileName);
|
||||
//newFileName = Path.Combine(Utils.GetTempPath(), newFileName);
|
||||
|
||||
try
|
||||
{
|
||||
File.Copy(fileName, newFileName);
|
||||
File.Copy(fileName, Path.Combine(Utils.GetTempPath(), newFileName));
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
@@ -238,7 +238,7 @@ namespace v2rayN.Handler
|
||||
|
||||
var httpPort = _config.GetLocalPort("speedtest");
|
||||
index = _selecteds[index];
|
||||
|
||||
|
||||
testCounter++;
|
||||
var webProxy = new WebProxy(Global.Loopback, httpPort + index);
|
||||
downloadHandle2.DownloadFileAsync(_config, url, webProxy);
|
||||
@@ -252,7 +252,7 @@ namespace v2rayN.Handler
|
||||
|
||||
try
|
||||
{
|
||||
IPHostEntry ipHostInfo = System.Net.Dns.Resolve(url);
|
||||
IPHostEntry ipHostInfo = System.Net.Dns.GetHostEntry(url);
|
||||
IPAddress ipAddress = ipHostInfo.AddressList[0];
|
||||
|
||||
var timer = new Stopwatch();
|
||||
|
||||
@@ -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);
|
||||
@@ -688,11 +688,21 @@ namespace v2rayN.Handler
|
||||
return -1;
|
||||
}
|
||||
|
||||
string addressFileName = config.address();
|
||||
if (File.Exists(fileName))
|
||||
{
|
||||
File.Delete(fileName);
|
||||
}
|
||||
|
||||
string addressFileName = config.address();
|
||||
if (!File.Exists(addressFileName))
|
||||
{
|
||||
addressFileName = Path.Combine(Utils.GetTempPath(), addressFileName);
|
||||
}
|
||||
if (!File.Exists(addressFileName))
|
||||
{
|
||||
msg = UIRes.I18N("FailedGenDefaultConfiguration");
|
||||
return -1;
|
||||
}
|
||||
File.Copy(addressFileName, fileName);
|
||||
|
||||
msg = string.Format(UIRes.I18N("SuccessfulConfiguration"), config.getSummary());
|
||||
@@ -1430,7 +1440,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);
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -33,4 +33,4 @@ using System.Runtime.InteropServices;
|
||||
// 方法是按如下所示使用“*”:
|
||||
//[assembly: AssemblyVersion("1.0.*")]
|
||||
//[assembly: AssemblyVersion("1.0.0")]
|
||||
[assembly: AssemblyFileVersion("2.47")]
|
||||
[assembly: AssemblyFileVersion("2.48")]
|
||||
|
||||
@@ -76,7 +76,7 @@
|
||||
"domainStrategy": "IPIfNonMatch",
|
||||
"rules": [
|
||||
{
|
||||
"inboundTag": "api",
|
||||
"inboundTag": ["api"],
|
||||
"outboundTag": "api",
|
||||
"type": "field"
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
@@ -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">
|
||||
|
||||
Reference in New Issue
Block a user