docs(windows): add NSSM service option and gensiot native client
Document NSSM (fawno/nssm.cc rebuild) as an alternative to WinSW for wrapping frpc/ser2net, with a WinSW-vs-NSSM recommendation. Add gensiot as a native RFC 2217 client alongside pySerial, noting it is optional for a server-only deployment. Update references. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -301,6 +301,32 @@ sc.exe config frpc start= delayed-auto
|
||||
|
||||
`sc.exe` 要求 `start=` 后保留空格。`frpc` 可以先于本地 RFC 2217 服务启动并稍后重连,但在本地监听器就绪前,外部连接会失败。延迟自动启动和 WinSW 的失败重启策略有助于处理开机时 USB 枚举较慢的情况。
|
||||
|
||||
### 4. 备选:使用 NSSM
|
||||
|
||||
[NSSM](https://nssm.cc/)(Non-Sucking Service Manager)是另一个把控制台程序包装成 Windows 服务的常用工具,特点是命令行/GUI 都很简单。上游 NSSM 本体停在 2014 年的 2.24;[fawno/nssm.cc](https://github.com/fawno/nssm.cc) 用 GitHub Actions 重新编译,提供较新的 32/64 位构建(如 `v2.24.1`,2024 年)。
|
||||
|
||||
安装服务并注入与 `.env` 相同的三个变量:
|
||||
|
||||
```bat
|
||||
nssm install frpc "C:\frp\frpc.exe" -c "C:\frp\frpc.toml"
|
||||
nssm set frpc AppDirectory "C:\frp"
|
||||
nssm set frpc AppEnvironmentExtra FRP_SERVER_ADDR=your-frps-host.example.com FRP_SERVER_PORT=21315 FRP_AUTH_TOKEN=your-frps-token
|
||||
nssm set frpc AppStdout "C:\frp\logs\frpc.log"
|
||||
nssm set frpc AppStderr "C:\frp\logs\frpc.log"
|
||||
nssm set frpc AppRestartDelay 10000
|
||||
nssm set frpc Start SERVICE_DELAYED_AUTO_START
|
||||
nssm start frpc
|
||||
```
|
||||
|
||||
NSSM 默认在被管进程异常退出时自动重启;`AppRestartDelay` 以毫秒为单位设置重启前延迟。令牌此时保存在服务配置(注册表)中,仅管理员可读,因此 `frpc.toml` 依旧只含模板。修改可用 `nssm edit frpc` 打开 GUI,或用 `nssm set` 逐项调整。
|
||||
|
||||
**推荐取舍**:两者都远优于直接用 `sc.exe create` 包装控制台程序。
|
||||
|
||||
- 若希望服务定义可版本化、随仓库走、便于复制到多台机器——**优先 WinSW**:其 XML(含 `<env>`)是纯文本,正好与本手册的 `{{ .Envs.* }}` 模板衔接。本手册默认使用 WinSW。
|
||||
- 若偏好交互式一条条命令或 GUI、不打算把服务定义纳入版本管理——**用 NSSM** 更快。
|
||||
|
||||
同样的两种方式也适用于把原生 `ser2net.exe` 或 `hub4com` 包装为服务,只需替换可执行文件与参数。
|
||||
|
||||
## 四、暴露面、防火墙与安全边界
|
||||
|
||||
### 1. 回环监听与 Windows 防火墙
|
||||
|
||||
Reference in New Issue
Block a user