Skip to content

Commit

Permalink
优化设置与删除Nat64网关
Browse files Browse the repository at this point in the history
  • Loading branch information
proxysu committed Nov 16, 2020
1 parent 1823d8b commit 72f7198
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
2 changes: 1 addition & 1 deletion ProxySU/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.23 Beta3" Height="675" Width="650">
Title="ProxySU - v2.4.23 Beta4" 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>
Expand Down
25 changes: 14 additions & 11 deletions ProxySU/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7484,7 +7484,7 @@ private bool SetUpNat64(SshClient client,bool set)
currentStatus = Application.Current.FindResource("DisplayInstallInfo_FindFastestSetUpNat64Failed").ToString();
MainWindowsShowInfo(currentStatus);
MessageBox.Show(currentStatus);
FunctionResultErr();
//FunctionResultErr();
client.Disconnect();
return false;
}
Expand All @@ -7493,8 +7493,13 @@ private bool SetUpNat64(SshClient client,bool set)
currentStatus = Application.Current.FindResource("DisplayInstallInfo_SetUpNat64").ToString();
MainWindowsShowInfo(currentStatus);

sshShellCommand = @"mv /etc/resolv.conf /etc/resolv.conf.bak";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
functionResult = FileCheckExists(client, @"/etc/resolv.conf.proxysu");
if (functionResult == false)
{
sshShellCommand = @"mv /etc/resolv.conf /etc/resolv.conf.proxysu";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
}


foreach (string gateip in dns64)
{
Expand All @@ -7511,10 +7516,7 @@ private bool SetUpNat64(SshClient client,bool set)
}

}


//sshShellCommand = $"echo \"nameserver {dns64[1]}\" >>/etc/resolv.conf";
//currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);

}
else
{
Expand All @@ -7523,7 +7525,7 @@ private bool SetUpNat64(SshClient client,bool set)
MainWindowsShowInfo(currentStatus);
sshShellCommand = @"rm /etc/resolv.conf";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
sshShellCommand = @"ln -s /etc/resolvconf/run/resolv.conf /etc/resolv.conf";
sshShellCommand = @"mv /etc/resolv.conf.proxysu /etc/resolv.conf";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
}

Expand Down Expand Up @@ -7947,9 +7949,10 @@ private bool ShutDownSelinuxAndSysComponentsDetect(SshClient client)
}
if (onlyIpv6 == true)
{
SetUpNat64(client, true);
sshShellCommand = $"{sshCmdUpdate}";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
functionResult = SetUpNat64(client, true);
if (functionResult == false) { FunctionResultErr(); client.Disconnect(); return false; }
//sshShellCommand = $"{sshCmdUpdate}";
//currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
}

//****** "检测端口占用情况......" ******
Expand Down
Binary file modified ProxySU/bin/Beta/Beta.zip
Binary file not shown.

0 comments on commit 72f7198

Please sign in to comment.