mirror of
https://github.com/shadow1ng/fscan.git
synced 2026-09-25 12:41:53 +08:00
feat: 添加API地址和加密密钥配置,重构API服务启动逻辑
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user