部分逻辑优化
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user