1
0
mirror of https://github.com/proxysu/ProxySU.git synced 2025-02-16 14:43:14 +03:00

优化域名测试流程,stats-->null

This commit is contained in:
ProxySU 2020-11-15 11:05:11 +08:00
parent 17d40011c9
commit a898314bb6
9 changed files with 59 additions and 79 deletions

View File

@ -5,7 +5,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:ProxySU"
mc:Ignorable="d"
Title="ProxySU - v2.4.22" Height="675" Width="650">
Title="ProxySU - v2.4.23 Beta2" Height="675" Width="650">
<!--以下样式参考自https://yq.aliyun.com/articles/331878
https://docs.microsoft.co/en-us/dotnet/desktop-wpf/fundamentals/styles-templates-overview-->
<Window.Resources>

View File

@ -7450,13 +7450,17 @@ namespace ProxySU
{
if (String.IsNullOrEmpty(ipv6) == false)
{
//apiGithubCom = "api.githubipv6.ga";
//scriptGithubUrl = "raw.githubipv6.ga";
//githubCom = "github.githubipv6.ga";
return true;
}
else
{
FunctionResultErr();
client.Disconnect();
//****未检测到有效的IP地址......***
currentStatus = Application.Current.FindResource("DisplayInstallInfo_NoIpDetect").ToString();
MainWindowsShowInfo(currentStatus);
MessageBox.Show(currentStatus);
return false;
}
}
@ -7935,13 +7939,19 @@ namespace ProxySU
//检测主机是否为纯ipv6的主机
onlyIpv6 = OnlyIpv6HostDetect(client);
if(onlyIpv6 == true)
//如果未检测到有效的ip连接就会被断开
if (client.IsConnected == false)
{
return false;
}
if (onlyIpv6 == true)
{
SetUpNat64(client, true);
sshShellCommand = $"{sshCmdUpdate}";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
}
//****** "检测端口占用情况......" ******
SetUpProgressBarProcessing(22);
currentStatus = Application.Current.FindResource("DisplayInstallInfo_TestPortUsed").ToString();
@ -8237,20 +8247,20 @@ namespace ProxySU
MainWindowsShowInfo(currentStatus);
//再次初始化相关变量
ipv4 = String.Empty;
ipv6 = String.Empty;
onlyIpv6 = false;
//ipv4 = String.Empty;
//ipv6 = String.Empty;
//onlyIpv6 = false;
//sshShellCommand = @"curl -4 ip.sb";
sshShellCommand = @"curl -s https://api.ip.sb/ip --ipv4 --max-time 8";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
ipv4 = currentShellCommandResult.TrimEnd('\r', '\n');
//sshShellCommand = @"curl -s https://api.ip.sb/ip --ipv4 --max-time 8";
//currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
//ipv4 = currentShellCommandResult.TrimEnd('\r', '\n');
sshShellCommand = @"curl -s https://api.ip.sb/ip --ipv6 --max-time 8";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
ipv6 = currentShellCommandResult.TrimEnd('\r', '\n');
//sshShellCommand = @"curl -s https://api.ip.sb/ip --ipv6 --max-time 8";
//currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
//ipv6 = currentShellCommandResult.TrimEnd('\r', '\n');
if (String.IsNullOrEmpty(ipv4) == false)
if (onlyIpv6 == false)
{
string nativeIp = ipv4;
@ -8264,75 +8274,42 @@ namespace ProxySU
SetUpProgressBarProcessing(36);
currentStatus = Application.Current.FindResource("DisplayInstallInfo_DomainResolveOK").ToString();
MainWindowsShowInfo(currentStatus);
onlyIpv6 = false;
//onlyIpv6 = false;
return true;
}
else
{
//****** "域名未能正确解析到当前VPS的IP上!安装失败!" ******
currentStatus = Application.Current.FindResource("DisplayInstallInfo_ErrorDomainResolve").ToString();
MainWindowsShowInfo(currentStatus);
//****** "域名未能正确解析到当前VPS的IP上请检查若解析设置正确请等待生效后再重试安装。如果域名使用了CDN请先关闭" ******
MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorDomainResolve").ToString());
//client.Disconnect();
return false;
}
}
else
{
if (String.IsNullOrEmpty(ipv6) == false)
string nativeIp = ipv6;
//sshShellCommand = "ping6 " + ReceiveConfigurationParameters[4] + " -c1 | grep -oE -m1 \"([0-9]{1,3}\\.){3}[0-9]{1,3}\"";
sshShellCommand = $"dig @resolver1.opendns.com AAAA {ReceiveConfigurationParameters[4]} +short -6";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
string resultTestDomainCmd = currentShellCommandResult.TrimEnd('\r', '\n');
if (String.Equals(nativeIp, resultTestDomainCmd) == true)
{
string nativeIp = ipv6;
//sshShellCommand = "ping6 " + ReceiveConfigurationParameters[4] + " -c1 | grep -oE -m1 \"([0-9]{1,3}\\.){3}[0-9]{1,3}\"";
sshShellCommand = $"dig @resolver1.opendns.com AAAA {ReceiveConfigurationParameters[4]} +short -6";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
string resultTestDomainCmd = currentShellCommandResult.TrimEnd('\r', '\n');
if (String.Equals(nativeIp, resultTestDomainCmd) == true)
{
//****** "解析正确OK!" ******12
SetUpProgressBarProcessing(36);
currentStatus = Application.Current.FindResource("DisplayInstallInfo_DomainResolveOK").ToString();
MainWindowsShowInfo(currentStatus);
onlyIpv6 = true;
//apiGithubCom = "api.githubipv6.ga";
//scriptGithubUrl = "raw.githubipv6.ga";
//githubCom = "github.githubipv6.ga";
//纯ipv6主机目前暂不支持
//currentStatus = Application.Current.FindResource("DisplayInstallInfo_OnlyIpv6").ToString();
//MainWindowsShowInfo(currentStatus);
//MessageBox.Show(currentStatus);
return true;
}
else
{
//****** "域名未能正确解析到当前VPS的IP上!安装失败!" ******
currentStatus = Application.Current.FindResource("DisplayInstallInfo_ErrorDomainResolve").ToString();
MainWindowsShowInfo(currentStatus);
//****** "域名未能正确解析到当前VPS的IP上请检查若解析设置正确请等待生效后再重试安装。如果域名使用了CDN请先关闭" ******
MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorDomainResolve").ToString());
//client.Disconnect();
return false;
}
}
else
{
//****** "域名未能正确解析到当前VPS的IP上!安装失败!" ******
currentStatus = Application.Current.FindResource("DisplayInstallInfo_ErrorDomainResolve").ToString();
//****** "解析正确OK!" ******12
SetUpProgressBarProcessing(36);
currentStatus = Application.Current.FindResource("DisplayInstallInfo_DomainResolveOK").ToString();
MainWindowsShowInfo(currentStatus);
//onlyIpv6 = true;
//****** "域名未能正确解析到当前VPS的IP上请检查若解析设置正确请等待生效后再重试安装。如果域名使用了CDN请先关闭" ******
MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorDomainResolve").ToString());
//client.Disconnect();
return false;
return true;
}
}
//return true;
//****** "域名未能正确解析到当前VPS的IP上!安装失败!" ******
currentStatus = Application.Current.FindResource("DisplayInstallInfo_ErrorDomainResolve").ToString();
MainWindowsShowInfo(currentStatus);
//****** "域名未能正确解析到当前VPS的IP上请检查若解析设置正确请等待生效后再重试安装。如果域名使用了CDN请先关闭" ******
MessageBox.Show(Application.Current.FindResource("MessageBoxShow_ErrorDomainResolve").ToString());
//client.Disconnect();
return false;
}

View File

@ -51,5 +51,5 @@ using System.Windows;
// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
// 方法是按如下所示使用“*”: :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.4.22.0")]
[assembly: AssemblyFileVersion("2.4.22.0")]
[assembly: AssemblyVersion("2.4.23.0")]
[assembly: AssemblyFileVersion("2.4.23.0")]

View File

@ -293,6 +293,7 @@
<sys:String x:Key="DisplayInstallInfo_TimeOK">The time difference meets the requirements, OK!</sys:String>
<sys:String x:Key="DisplayInstallInfo_TestDomainResolve">is checking whether the domain name is resolved to the IP of the current VPS...</sys:String>
<sys:String x:Key="DisplayInstallInfo_OnlyIpv6HostDetect">is detecting whether it is a pure ipv6 host...</sys:String>
<sys:String x:Key="DisplayInstallInfo_NoIpDetect">A valid IP address was not detected...</sys:String>
<sys:String x:Key="DisplayInstallInfo_FindFastestSetUpNat64">Finding the fastest Nat64 gateway...</sys:String>
<sys:String x:Key="DisplayInstallInfo_FindFastestSetUpNat64Failed">Failed to find a valid Nat64 gateway...</sys:String>
<sys:String x:Key="DisplayInstallInfo_FindFastestNat64AsIs">The fastest Nat64 gateway of the current host is:</sys:String>

View File

@ -298,6 +298,7 @@
<sys:String x:Key="DisplayInstallInfo_TimeOK">时间差符合要求OK!</sys:String>
<sys:String x:Key="DisplayInstallInfo_TestDomainResolve">正在检测域名是否解析到当前VPS的IP上......</sys:String>
<sys:String x:Key="DisplayInstallInfo_OnlyIpv6HostDetect">正在检测是否为纯ipv6主机......</sys:String>
<sys:String x:Key="DisplayInstallInfo_NoIpDetect">未检测到有效的IP地址......</sys:String>
<sys:String x:Key="DisplayInstallInfo_FindFastestSetUpNat64">正在查找最快的Nat64网关......</sys:String>
<sys:String x:Key="DisplayInstallInfo_FindFastestSetUpNat64Failed">未能找到有效的Nat64网关......</sys:String>
<sys:String x:Key="DisplayInstallInfo_FindFastestNat64AsIs">当前主机最快的Nat64网关为:</sys:String>

View File

@ -293,6 +293,7 @@
<sys:String x:Key="DisplayInstallInfo_TimeOK">時間差符合要求OK!</sys:String>
<sys:String x:Key="DisplayInstallInfo_TestDomainResolve">正在檢測域名是否解析到當前VPS的IP上......</sys:String>
<sys:String x:Key="DisplayInstallInfo_OnlyIpv6HostDetect">正在檢測是否為純ipv6主機......</sys:String>
<sys:String x:Key="DisplayInstallInfo_NoIpDetect">未檢測到有效的IP地址......</sys:String>
<sys:String x:Key="DisplayInstallInfo_FindFastestSetUpNat64">正在查找最快的Nat64網關......</sys:String>
<sys:String x:Key="DisplayInstallInfo_FindFastestSetUpNat64Failed">未能找到有效的Nat64網關......</sys:String>
<sys:String x:Key="DisplayInstallInfo_FindFastestNat64AsIs">當前主機最快的Nat64網關為:</sys:String>

Binary file not shown.

View File

@ -1,3 +1,3 @@
{
"stats": {}
"stats": null
}

View File

@ -1,3 +1,3 @@
{
"stats": {}
"stats": null
}