feat: Windows 安装器 + 修复 daemon 无法连接问题

- 新增 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 传输层抽象
This commit is contained in:
2026-07-07 19:29:41 +08:00
parent 019df7bc23
commit 3c076785f6
10 changed files with 626 additions and 24 deletions
+17 -1
View File
@@ -13,7 +13,7 @@ GIT_HASH = $(shell git rev-parse --short HEAD 2>/dev/null || echo unknown)
VERSION = 0.3.6-$(GIT_HASH)
LDFLAGS = -s -w -X lmvpn/internal/version.Version=$(VERSION)
.PHONY: all build app run daemon clean vet tidy fmt icon icon-windows build-windows
.PHONY: all build app run daemon clean vet tidy fmt icon icon-windows build-windows installer-windows
## all: build the .app bundle (default)
all: app
@@ -96,3 +96,19 @@ build-windows: icon-windows
CGO_ENABLED=1 GOOS=windows GOARCH=amd64 CC=x86_64-w64-mingw32-gcc \
$(GO) build -ldflags "$(LDFLAGS)" -o $(BUILD_DIR)/$(DAEMON_BIN).exe ./cmd/lmvpnd
@echo "Built $(BUILD_DIR)/$(GUI_BIN).exe and $(BUILD_DIR)/$(DAEMON_BIN).exe"
## installer-windows: build exes and compile Inno Setup installer (.exe)
## Requires ISCC on PATH (Windows) or Wine + Inno Setup 6 (macOS/Linux).
installer-windows: build-windows
@echo "Compiling installer with version $(VERSION)..."
@if command -v ISCC >/dev/null 2>&1; then \
ISCC /DAppVersion=$(VERSION) installer/lmvpn.iss; \
elif command -v wine >/dev/null 2>&1; then \
wine "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" /DAppVersion=$(VERSION) installer/lmvpn.iss; \
else \
echo "ERROR: ISCC not found. Install Inno Setup 6 on Windows,"; \
echo " or install Wine + Inno Setup 6 on macOS/Linux."; \
echo " Download: https://jrsoftware.org/isdl.php"; \
exit 1; \
fi
@echo "Installer: $(BUILD_DIR)/LMVPN-Setup-$(VERSION).exe"