[PR #5004] [CLOSED] 添加Windows服务管理和事件日志集成 #5101

Closed
opened 2026-05-05 14:54:43 -06:00 by gitea-mirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/fatedier/frp/pull/5004
Author: @donmor
Created: 9/29/2025
Status: Closed

Base: devHead: patch-2


📝 Commits (10+)

  • e97300b add basic supports to run as a windows service
  • beeecfd add support for changing parameters on service start
  • f9469ed add support for windows eventlog
  • 0ededf6 fix broken compilation on non-windows platforms
  • 745ba2b implements wait-for-startup and frpc pause/continue/reload
  • 7eb755a fix broken isWinSvc()
  • dcee282 fix broken dummy eventlog.go
  • 3974382 fix broken dummy system.go and system_android.go
  • 83738f9 fix broken dummy eventlog.go
  • a09ac18 now checks existence of event source using powershell;event source added automatically if run as privileged user

📊 Changes

244 files changed (+22264 additions, -6542 deletions)

View changed files

📝 .circleci/config.yml (+1 -1)
📝 .github/workflows/golangci-lint.yml (+5 -5)
📝 .github/workflows/goreleaser.yml (+3 -3)
📝 .gitignore (+2 -12)
📝 .golangci.yml (+8 -7)
📝 Makefile (+11 -10)
📝 README.md (+18 -9)
📝 README_zh.md (+10 -9)
📝 Release.md (+5 -4)
📝 assets/assets.go (+11 -2)
client/api/controller.go (+0 -189)
📝 client/api_router.go (+20 -9)
client/config_manager.go (+422 -0)
client/config_manager_test.go (+137 -0)
client/configmgmt/types.go (+42 -0)
📝 client/control.go (+7 -3)
client/http/controller.go (+395 -0)
client/http/controller_test.go (+531 -0)
client/http/model/proxy_definition.go (+148 -0)
📝 client/http/model/types.go (+14 -1)

...and 80 more files

📄 Description

实现 #2468 ,可直接使用sc.exe(cmd)/New-Service(powershell)/注册表将frps或frpc注册为服务(可使用LocalService、服务账户等提高安全性)

计划实现:

  • 加入golang.org/x/sys/windows/svc包,使frps和frpc符合Windows服务程序规范
  • 加入golang.org/x/sys/windows/svc/eventlog包,为Logger添加Windows事件日志后端(可使用Windows事件查看器查看)
  • 为每种日志输出添加独有的event ID(需要定义更多eid;需要改golib那边) 暂时搁置
  • 为frpc添加pause/continue支持(并同时reload代理配置)
  • 日志事件源存在检测和自动安装(使用powershell命令,自动添加需要UAC提权)
  • 服务安装/卸载命令(在启动参数前插入install以安装,非-c的参数和install命令间需插入--;使用uninstall命令以卸载;会同时注册/移除事件源;需在管理员cmd/powershell中执行;默认使用LocalSystem身份,restricted模式使用NT AUTHORITY\LocalService和受限SID)

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/fatedier/frp/pull/5004 **Author:** [@donmor](https://github.com/donmor) **Created:** 9/29/2025 **Status:** ❌ Closed **Base:** `dev` ← **Head:** `patch-2` --- ### 📝 Commits (10+) - [`e97300b`](https://github.com/fatedier/frp/commit/e97300b9aa6571354c9f97209dc02e30088d81ec) add basic supports to run as a windows service - [`beeecfd`](https://github.com/fatedier/frp/commit/beeecfdb3c68ad3422dc085023d74c96e1d6ad02) add support for changing parameters on service start - [`f9469ed`](https://github.com/fatedier/frp/commit/f9469edea8296d00fd732f3751f02298a731b483) add support for windows eventlog - [`0ededf6`](https://github.com/fatedier/frp/commit/0ededf681847afd83af17f8e1962ddb0f88767ae) fix broken compilation on non-windows platforms - [`745ba2b`](https://github.com/fatedier/frp/commit/745ba2bff891a4eb16ac19b441120ca10fdec458) implements wait-for-startup and frpc pause/continue/reload - [`7eb755a`](https://github.com/fatedier/frp/commit/7eb755a9e3720be791a16fe35135ac5c8baf328a) fix broken isWinSvc() - [`dcee282`](https://github.com/fatedier/frp/commit/dcee282c47d23c629ed04c9b2b7b3f90daf10927) fix broken dummy eventlog.go - [`3974382`](https://github.com/fatedier/frp/commit/3974382beea08652db93c9138359a96718733f87) fix broken dummy system.go and system_android.go - [`83738f9`](https://github.com/fatedier/frp/commit/83738f90037789016ef66407e3fbd65fee25646c) fix broken dummy eventlog.go - [`a09ac18`](https://github.com/fatedier/frp/commit/a09ac18fb4108eda2c271a7d98a573c007927b15) now checks existence of event source using powershell;event source added automatically if run as privileged user ### 📊 Changes **244 files changed** (+22264 additions, -6542 deletions) <details> <summary>View changed files</summary> 📝 `.circleci/config.yml` (+1 -1) 📝 `.github/workflows/golangci-lint.yml` (+5 -5) 📝 `.github/workflows/goreleaser.yml` (+3 -3) 📝 `.gitignore` (+2 -12) 📝 `.golangci.yml` (+8 -7) 📝 `Makefile` (+11 -10) 📝 `README.md` (+18 -9) 📝 `README_zh.md` (+10 -9) 📝 `Release.md` (+5 -4) 📝 `assets/assets.go` (+11 -2) ➖ `client/api/controller.go` (+0 -189) 📝 `client/api_router.go` (+20 -9) ➕ `client/config_manager.go` (+422 -0) ➕ `client/config_manager_test.go` (+137 -0) ➕ `client/configmgmt/types.go` (+42 -0) 📝 `client/control.go` (+7 -3) ➕ `client/http/controller.go` (+395 -0) ➕ `client/http/controller_test.go` (+531 -0) ➕ `client/http/model/proxy_definition.go` (+148 -0) 📝 `client/http/model/types.go` (+14 -1) _...and 80 more files_ </details> ### 📄 Description 实现 #2468 ,可直接使用`sc.exe`(cmd)/`New-Service`(powershell)/注册表将frps或frpc注册为服务(可使用LocalService、服务账户等提高安全性) 计划实现: - [x] 加入`golang.org/x/sys/windows/svc`包,使frps和frpc符合Windows服务程序规范 - [x] 加入`golang.org/x/sys/windows/svc/eventlog`包,为Logger添加Windows事件日志后端(可使用Windows事件查看器查看) - [ ] ~~为每种日志输出添加独有的event ID(需要定义更多eid;需要改golib那边)~~ 暂时搁置 - [x] 为frpc添加pause/continue支持(并同时reload代理配置) - [x] 日志事件源存在检测和自动安装(使用powershell命令,自动添加需要UAC提权) - [x] 服务安装/卸载命令(在启动参数前插入install以安装,非`-c`的参数和install命令间需插入`--`;使用uninstall命令以卸载;会同时注册/移除事件源;需在管理员cmd/powershell中执行;默认使用LocalSystem身份,restricted模式使用`NT AUTHORITY\LocalService`和受限SID) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
gitea-mirror 2026-05-05 14:54:43 -06:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/frp#5101
No description provided.