4 Commits
Author SHA1 Message Date
luke-win 581ba6aa00 fix: 修复 install.ps1 和 clash.ps1 共 4 个 bug 2026-08-11 12:22:14 +08:00
lukeopen 551ff9c4c9 fix: 修复 Windows 部署 install.ps1 解压 bug + reload 鉴权
- install.ps1: 官方 zip 内 exe 名为 mihomo-windows-amd64-v1.exe,
  改为匹配 *.exe + mihomo* 前缀,不再硬找 mihomo.exe
- clash.ps1: 热重载 PUT /configs 补上 secret Bearer 鉴权,
  避免开启 secret 后 reload 一直 401 退化成重启
2026-08-11 09:53:43 +08:00
lukeopen e94e38e39c fix: 彻底修复 stop 后 TUN 残留导致断网
根因:mihomo 退出后 0.0.0.0/1 + 128.0.0.0/1 黑洞路由未清掉,
所有流量指向已消失的 TUN 网关 198.18.0.1 → 断网。

macOS (clash):
- start 解析 mihomo 真实 PID 写入 PID 文件(原记的是 sudo PID)
- cmd_stop 直接 pkill -TERM/-9 mihomo,不再依赖 sudo PID
- network_restore 无条件删除 0.0.0.0/1 + 128.0.0.0/1 黑洞路由,
  并放宽 TUN 识别到整个 198.18.x fake-IP 段(不再只认 198.18.0.1)
- network_leftovers 检测同步放宽

Windows (clash.ps1):
- NetworkRestore 删除 wintun 网卡上的全部路由(不限网段)+ 清理
  网关落在 198.18.x 的所有路由
- Test-NetworkLeftovers 路由检测放宽到 198.18.x
- CmdStop 强制终止时增加按进程名强杀兜底(防止 PID 文件不准杀不掉)

两版已做语法检查与入口冒烟测试。
2026-08-10 17:29:24 +08:00
lukeopen 061b2bb46e feat: add Windows PowerShell port (clash.ps1 + install.ps1)
- clash.ps1: 1:1 port of macOS clash script to PowerShell 7
  - TUN-only mode, auto UAC elevation via Start-Process -Verb RunAs
  - Subcommands: start/stop/restart/reload/status/link/open/edit/
    log/cleanup/doctor/verge-off/help + interactive menu
  - win_adapt_config: strip Linux-only fields, stack system→gvisor
  - wintun adapter + route cleanup for network recovery
  - ANSI colors (pwsh 7 + Windows Terminal)
  - 5-path mihomo binary detection (Get-Command→scoop→~/Mihomo→LOCALAPPDATA→ProgramFiles)

- install.ps1: one-command Windows deploy
  - Detect pwsh 7, download mihomo v1.19.15 + wintun.dll 0.14.1
  - Architecture-aware (amd64/arm64)
  - Deploy clash.ps1 to PATH

- README.md: add Windows section
- .gitignore: add wintun.dll, *.exe
2026-08-10 17:11:22 +08:00