重构命令执行器和防火墙管理逻辑

- 优化Base.go中防火墙清空命令,使用更结构化的命令执行方式
- 修改Proxy.go中Xray安装命令,改用SingleLineCommandExecutor
- 重构Excutor.go,新增RealTimeCommandExecutor方法,支持实时输出命令执行日志
- 简化命令执行日志输出,移除冗余的日志前缀
- 改进管道命令执行的日志记录,增加可读性
This commit is contained in:
zeaslity
2025-03-11 16:07:19 +08:00
parent 35646ff89f
commit 34b5f80704
3 changed files with 89 additions and 24 deletions

View File

@@ -288,7 +288,7 @@ func installXray() {
os.Chmod("/tmp/install-release.sh", 0777)
// 执行安装脚本
ok, resultLog := op.HardCodeCommandExecutor("/bin/bash /tmp/install-release.sh -u root install")
ok, resultLog := op.SingleLineCommandExecutor([]string{"/bin/bash", "/tmp/install-release.sh", "-u", "root", "install"})
if !ok {
log.Error("Install Xray failed ! error is %s", resultLog)
return