public void Install() { Task.Factory.StartNew(() => { try { var index = 1; Progress.Step = $"{index++}. 检测系统环境"; EnsureRootUser(); EnsureSystemEnv(); Progress.Percentage = 20; Progress.Step = $"{index++}. 安装系统必要工具"; InstallSystemTools(); Progress.Percentage = 30; Progress.Step = $"{index++}. 配置防火墙"; ConfigFirewalld(); Progress.Percentage = 40; Progress.Step = $"{index++}. 检测网络环境"; EnsureNetwork(); Progress.Percentage = 50; Progress.Step = $"{index++}. 检测域名是否绑定到本机"; ValidateDomain(); Progress.Percentage = 60; Progress.Step = $"{index++}. 安装NaiveProxy"; InstallNaiveProxy(); Progress.Percentage = 80; Progress.Step = $"{index++}. 优化网络参数"; ConfigNetwork(); Progress.Percentage = 90; Progress.Step = $"{index++}. 启动BBR"; EnableBBR(); Progress.Desc = "重启Caddy服务"; RunCmd("systemctl restart caddy"); Progress.Percentage = 100; Progress.Step = "NaiveProxy安装成功"; Progress.Desc = string.Empty; AppendCommand("分享连接:"); AppendCommand(ShareLink.BuildNaiveProxy(Settings)); NavigationService.Navigate <NaiveProxyConfigViewModel, NaiveProxySettings>(Settings); } catch (Exception ex) { MessageBox.Show(ex.Message); } }); }
public void Install() { Task.Factory.StartNew(() => { try { Progress.Step = "安装Brook"; Progress.Percentage = 0; Progress.Desc = "检测系统环境"; EnsureRootUser(); EnsureSystemEnv(); Progress.Percentage = 20; Progress.Desc = "安装必要的系统工具"; InstallSystemTools(); Progress.Percentage = 40; Progress.Desc = "配置防火墙"; ConfigFirewalld(); Progress.Percentage = 50; Progress.Step = "检测网络环境"; EnsureNetwork(); Progress.Percentage = 60; if (Settings.BrookType == BrookType.wssserver) { Progress.Desc = "检测域名是否绑定本机IP"; ValidateDomain(); Progress.Percentage = 80; } Progress.Step = "安装Brook服务"; InstallBrook(); Progress.Percentage = 100; Progress.Step = "安装Brook成功"; Progress.Desc = "安装Brook成功"; AppendCommand("分享连接:"); AppendCommand(ShareLink.BuildBrook(Settings)); NavigationService.Navigate <BrookConfigViewModel, BrookSettings>(Settings); } catch (Exception ex) { MessageBox.Show(ex.Message); } }); }
public void Install() { Task.Factory.StartNew(() => { try { Progress.Percentage = 0; Progress.Step = "安装TrojanGo"; Progress.Desc = "安装TrojanGo"; EnsureRootUser(); if (FileExists("/usr/local/bin/trojan-go")) { var btnResult = MessageBox.Show("已经安装Trojan-Go,是否需要重装?", "提示", MessageBoxButton.YesNo); if (btnResult == MessageBoxResult.No) { MessageBox.Show("安装终止", "提示"); return; } } var index = 1; Progress.Step = $"{index++}. 检测系统环境"; EnsureSystemEnv(); Progress.Percentage = 10; Progress.Step = $"{index++}. 安装必要的系统工具"; InstallSystemTools(); Progress.Percentage = 30; Progress.Step = $"{index++}. 配置防火墙"; ConfigFirewalld(); Progress.Percentage = 40; Progress.Step = $"{index++}. 检测网络环境"; EnsureNetwork(); Progress.Percentage = 50; Progress.Step = $"{index++}. 检测域名是否解析到本机"; ValidateDomain(); Progress.Percentage = 60; Progress.Step = $"{index++}. 安装Caddy服务"; InstallCaddy(); Progress.Percentage = 70; Progress.Step = $"{index++}. 安装TrojanGo"; InstallTrojanGo(); Progress.Percentage = 80; Progress.Step = $"{index++}. 上传Caddy配置文件"; UploadCaddySettings(); Progress.Percentage = 90; Progress.Step = $"{index++}. 启动BBR"; EnableBBR(); Progress.Step = $"{index++}. 重启caddy服务"; RunCmd("systemctl restart caddy"); Progress.Desc = "启用Trojan-Go开机启动"; RunCmd("systemctl enable trojan-go"); RunCmd("systemctl restart trojan-go"); AppendCommand("分享连接:"); AppendCommand(ShareLink.BuildTrojanGo(Settings)); Progress.Percentage = 100; Progress.Step = "安装成功"; Progress.Desc = string.Empty; if (!Settings.WithTLS) { Progress.Step = "安装成功,请上传您的 TLS 证书。"; } else { NavigationService.Navigate <TrojanGoConfigViewModel, TrojanGoSettings>(Settings); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }); }