[PR #1242] [CLOSED] support system service of all platform #4346

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

📋 Pull Request Information

Original PR: https://github.com/fatedier/frp/pull/1242
Author: @ma6254
Created: 5/10/2019
Status: Closed

Base: masterHead: master


📝 Commits (3)

📊 Changes

194 files changed (+20477 additions, -1135 deletions)

View changed files

📝 cmd/frpc/sub/root.go (+19 -1)
cmd/frpc/sub/service.go (+115 -0)
📝 cmd/frps/root.go (+19 -0)
cmd/frps/service.go (+130 -0)
📝 go.mod (+3 -2)
📝 go.sum (+30 -2)
vendor/github.com/kardianos/service/.gitignore (+0 -0)
vendor/github.com/kardianos/service/.travis.yml (+17 -0)
vendor/github.com/kardianos/service/LICENSE (+20 -0)
vendor/github.com/kardianos/service/README.md (+14 -0)
vendor/github.com/kardianos/service/appveyor.yml (+21 -0)
vendor/github.com/kardianos/service/console.go (+48 -0)
vendor/github.com/kardianos/service/go.mod (+5 -0)
vendor/github.com/kardianos/service/go.sum (+2 -0)
vendor/github.com/kardianos/service/linux-test-su.sh (+15 -0)
vendor/github.com/kardianos/service/service.go (+393 -0)
vendor/github.com/kardianos/service/service_darwin.go (+282 -0)
vendor/github.com/kardianos/service/service_go1.8.go (+15 -0)
vendor/github.com/kardianos/service/service_linux.go (+75 -0)
vendor/github.com/kardianos/service/service_systemd_linux.go (+251 -0)

...and 80 more files

📄 Description

支持了全平台的服务注册和控制

Overview

使用了github.com/kardianos/service ,该库封装了各平台的底层service操作
此库的func Interactive() bool用来判断是否处于service状态下运行
当检测到为service状态时
frpc从$FRP_HOME/frpc.ini处读取配置文件
frps则是$FRP_HOME/frps.ini

Example

> ./frpc_darwin_amd64 service install
> ./frpc_darwin_amd64 service start
> ./frpc_darwin_amd64 service stop
> ./frpc_darwin_amd64 service uninstall

Usage

> ./frpc_darwin_amd64 service -h
Control frpc system service

Usage:
  frpc service [command]

Aliases:
  service, srv

Available Commands:
  install     install frpc service
  restart     restart frpc service
  start       start frpc service
  stop        stop frpc service
  uninstall   uninstall frpc service

Flags:
  -h, --help   help for service

Global Flags:
  -c, --config string         config file of frpc (default "./frpc.ini")
      --description string    Service description (default "frpc service")
      --display_name string   Service display name (default "frpc")
      --name string           Service name (default "frpc")
  -v, --version               version of frpc

Use "frpc service [command] --help" for more information about a command.
> ./frps_darwin_amd64 service -h
Control frps system service

Usage:
  frps service [command]

Aliases:
  service, srv

Available Commands:
  install     install frps service
  restart     restart frps service
  start       start frps service
  stop        stop frps service
  uninstall   uninstall frps service

Flags:
  -h, --help   help for service

Global Flags:
      --allow_ports string         allow ports
      --bind_addr string           bind address (default "0.0.0.0")
  -p, --bind_port int              bind port (default 7000)
      --bind_udp_port int          bind udp port
  -c, --config string              config file of frps
      --dashboard_addr string      dasboard address (default "0.0.0.0")
      --dashboard_port int         dashboard port
      --dashboard_pwd string       dashboard password (default "admin")
      --dashboard_user string      dashboard user (default "admin")
      --description string         Service description (default "frps service")
      --display_name string        Service display name (default "frps")
      --kcp_bind_port int          kcp bind udp port
      --log_file string            log file (default "console")
      --log_level string           log level (default "info")
      --log_max_days int           log_max_days (default 3)
      --max_ports_per_client int   max ports per client
      --name string                Service name (default "frps")
      --proxy_bind_addr string     proxy bind address (default "0.0.0.0")
      --subdomain_host string      subdomain host
  -t, --token string               auth token
  -v, --version                    version of frpc
      --vhost_http_port int        vhost http port
      --vhost_http_timeout int     vhost http response header timeout (default 60)
      --vhost_https_port int       vhost https port


🔄 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/1242 **Author:** [@ma6254](https://github.com/ma6254) **Created:** 5/10/2019 **Status:** ❌ Closed **Base:** `master` ← **Head:** `master` --- ### 📝 Commits (3) - [`10af000`](https://github.com/fatedier/frp/commit/10af000e28f952d7e77a493f3a6776d0ae302458) support system service of all platform - [`3cb1ddd`](https://github.com/fatedier/frp/commit/3cb1dddb4588eba5dd3dc089a9daedf547f8eff4) fix vendor - [`cd0959b`](https://github.com/fatedier/frp/commit/cd0959bba0e4d2e4c6ff07956f92b1fe0d54b6df) fix frps service init ### 📊 Changes **194 files changed** (+20477 additions, -1135 deletions) <details> <summary>View changed files</summary> 📝 `cmd/frpc/sub/root.go` (+19 -1) ➕ `cmd/frpc/sub/service.go` (+115 -0) 📝 `cmd/frps/root.go` (+19 -0) ➕ `cmd/frps/service.go` (+130 -0) 📝 `go.mod` (+3 -2) 📝 `go.sum` (+30 -2) ➕ `vendor/github.com/kardianos/service/.gitignore` (+0 -0) ➕ `vendor/github.com/kardianos/service/.travis.yml` (+17 -0) ➕ `vendor/github.com/kardianos/service/LICENSE` (+20 -0) ➕ `vendor/github.com/kardianos/service/README.md` (+14 -0) ➕ `vendor/github.com/kardianos/service/appveyor.yml` (+21 -0) ➕ `vendor/github.com/kardianos/service/console.go` (+48 -0) ➕ `vendor/github.com/kardianos/service/go.mod` (+5 -0) ➕ `vendor/github.com/kardianos/service/go.sum` (+2 -0) ➕ `vendor/github.com/kardianos/service/linux-test-su.sh` (+15 -0) ➕ `vendor/github.com/kardianos/service/service.go` (+393 -0) ➕ `vendor/github.com/kardianos/service/service_darwin.go` (+282 -0) ➕ `vendor/github.com/kardianos/service/service_go1.8.go` (+15 -0) ➕ `vendor/github.com/kardianos/service/service_linux.go` (+75 -0) ➕ `vendor/github.com/kardianos/service/service_systemd_linux.go` (+251 -0) _...and 80 more files_ </details> ### 📄 Description 支持了全平台的服务注册和控制 ## Overview 使用了`github.com/kardianos/service` ,该库封装了各平台的底层service操作 此库的`func Interactive() bool`用来判断是否处于service状态下运行 当检测到为service状态时 frpc从`$FRP_HOME/frpc.ini`处读取配置文件 frps则是`$FRP_HOME/frps.ini` ## Example ```bash > ./frpc_darwin_amd64 service install > ./frpc_darwin_amd64 service start > ./frpc_darwin_amd64 service stop > ./frpc_darwin_amd64 service uninstall ``` ## Usage ```bash > ./frpc_darwin_amd64 service -h Control frpc system service Usage: frpc service [command] Aliases: service, srv Available Commands: install install frpc service restart restart frpc service start start frpc service stop stop frpc service uninstall uninstall frpc service Flags: -h, --help help for service Global Flags: -c, --config string config file of frpc (default "./frpc.ini") --description string Service description (default "frpc service") --display_name string Service display name (default "frpc") --name string Service name (default "frpc") -v, --version version of frpc Use "frpc service [command] --help" for more information about a command. ``` ```bash > ./frps_darwin_amd64 service -h Control frps system service Usage: frps service [command] Aliases: service, srv Available Commands: install install frps service restart restart frps service start start frps service stop stop frps service uninstall uninstall frps service Flags: -h, --help help for service Global Flags: --allow_ports string allow ports --bind_addr string bind address (default "0.0.0.0") -p, --bind_port int bind port (default 7000) --bind_udp_port int bind udp port -c, --config string config file of frps --dashboard_addr string dasboard address (default "0.0.0.0") --dashboard_port int dashboard port --dashboard_pwd string dashboard password (default "admin") --dashboard_user string dashboard user (default "admin") --description string Service description (default "frps service") --display_name string Service display name (default "frps") --kcp_bind_port int kcp bind udp port --log_file string log file (default "console") --log_level string log level (default "info") --log_max_days int log_max_days (default 3) --max_ports_per_client int max ports per client --name string Service name (default "frps") --proxy_bind_addr string proxy bind address (default "0.0.0.0") --subdomain_host string subdomain host -t, --token string auth token -v, --version version of frpc --vhost_http_port int vhost http port --vhost_http_timeout int vhost http response header timeout (default 60) --vhost_https_port int vhost https port ``` --- <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:40:19 -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#4346
No description provided.