部分逻辑优化

This commit is contained in:
2026-08-07 22:25:12 +08:00
parent 2f766b4184
commit d7f3ffd476
3 changed files with 49 additions and 28 deletions
+16 -1
View File
@@ -4,6 +4,7 @@ import (
"context"
"log"
"os"
"runtime"
"strings"
"time"
@@ -35,7 +36,21 @@ func main() {
log.Println("⚠️ 生成配置文件失败:", err)
}
pm := process.NewManager("./data", "./data/frpc.toml", "./data/frpc")
// ============================================================
// 获取 frpc 二进制路径(自动处理平台差异)
// ============================================================
frpcPath, err := frp.GetFrpcPath()
if err != nil {
log.Printf("⚠️ 获取 frpc 路径失败: %v", err)
frpcPath = "./frpc"
if runtime.GOOS == "windows" {
frpcPath += ".exe"
}
}
log.Printf("📌 frpc 路径: %s", frpcPath)
pm := process.NewManager("./data", "./data/frpc.toml", frpcPath)
process.SetGlobalManager(pm)
if err := pm.LoadConfig(); err != nil {