feat: 添加API地址和加密密钥配置,重构API服务启动逻辑

This commit is contained in:
tongque
2025-04-22 19:03:42 +08:00
parent f921d81a76
commit 16e40fe7ed
5 changed files with 68 additions and 31 deletions
+13 -2
View File
@@ -2,9 +2,11 @@ package main
import (
"fmt"
"os"
"github.com/shadow1ng/fscan/Common"
"github.com/shadow1ng/fscan/Core"
"os"
rpc "github.com/shadow1ng/fscan/RPC"
)
func main() {
@@ -12,14 +14,23 @@ func main() {
var Info Common.HostInfo
Common.Flag(&Info)
// 启动 gRPC + HTTP Gateway 服务
if err := rpc.StartApiServer(); err != nil {
os.Exit(1)
}
// 解析 CLI 参数
if err := Common.Parse(&Info); err != nil {
os.Exit(1)
}
// 初始化输出系统,如果失败则直接退出
if err := Common.InitOutput(); err != nil {
Common.LogError(fmt.Sprintf("初始化输出系统失败: %v", err))
os.Exit(1) // 关键修改:初始化失败时直接退出
os.Exit(1)
}
defer Common.CloseOutput()
// 执行 CLI 扫描逻辑
Core.Scan(Info)
}