- 新增 Inno Setup 安装器脚本 (installer/lmvpn.iss),支持自定义安装路径、 桌面快捷方式、安装前杀死旧进程,打包 wintun.dll - Makefile 新增 installer-windows 目标,支持 ISCC 和 Wine 两种编译方式 - Windows IPC 从 AF_UNIX 改为 TCP (127.0.0.1:18923),解决提权 daemon 与 非提权 GUI 之间的完整性级别限制导致 daemon did not become reachable - 修复 elevation_windows.go 中 ShellExecute 参数路径含空格时被截断的问题 (C:\Program Files\LMVPN\lmvpnd.exe → 只取到 C:\Program) - ensureDaemon 重试次数 40→60,添加连接失败日志便于诊断 - 新增 IPCNetwork()/IPCAddress() 跨平台函数,统一 IPC 传输层抽象
49 lines
1.4 KiB
Go
49 lines
1.4 KiB
Go
//go:build windows
|
|
|
|
package paths
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
)
|
|
|
|
// IPCNetwork returns the transport network for GUI <-> daemon IPC.
|
|
// Windows uses TCP because AF_UNIX sockets enforce mandatory
|
|
// integrity-level checks: a socket created by the elevated daemon
|
|
// (High Integrity) cannot be connected to by the non-elevated GUI
|
|
// (Medium Integrity). TCP on 127.0.0.1 has no such restriction.
|
|
func IPCNetwork() string { return "tcp" }
|
|
|
|
// IPCAddress returns the listen/dial address for GUI <-> daemon IPC.
|
|
// On Windows this is a TCP address on localhost.
|
|
const ipcPort = "18923"
|
|
|
|
func IPCAddress() string { return "127.0.0.1:" + ipcPort }
|
|
|
|
func init() {
|
|
home, _ := os.UserHomeDir()
|
|
recomputePaths(home)
|
|
}
|
|
|
|
// recomputePaths sets Paths based on the given home directory.
|
|
// On Windows the layout follows platform conventions:
|
|
//
|
|
// %APPDATA%\<BundleID>\ data (db, config)
|
|
// %LOCALAPPDATA%\<BundleID>\ cache
|
|
// %LOCALAPPDATA%\<BundleID>\Logs\ logs
|
|
func recomputePaths(home string) {
|
|
appData := os.Getenv("APPDATA")
|
|
if appData == "" {
|
|
appData = filepath.Join(home, "AppData", "Roaming")
|
|
}
|
|
localAppData := os.Getenv("LOCALAPPDATA")
|
|
if localAppData == "" {
|
|
localAppData = filepath.Join(home, "AppData", "Local")
|
|
}
|
|
Paths = Dirs{
|
|
Data: filepath.Join(appData, BundleID),
|
|
Cache: filepath.Join(localAppData, BundleID),
|
|
Log: filepath.Join(localAppData, BundleID, "Logs"),
|
|
}
|
|
}
|