[PR #1402] [CLOSED] Add clients configuration files modify control API feature #4381

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

📋 Pull Request Information

Original PR: https://github.com/fatedier/frp/pull/1402
Author: @kasuganosoras
Created: 8/21/2019
Status: Closed

Base: newHead: master


📝 Commits (10+)

📊 Changes

14 files changed (+598 additions, -43 deletions)

View changed files

📝 .gitignore (+1 -0)
📝 conf/frps_full.ini (+9 -0)
extend/api/api.go (+234 -0)
extend/limit/limit.go (+44 -0)
extend/limit/reader.go (+63 -0)
extend/limit/w_test.go (+17 -0)
extend/limit/writer.go (+63 -0)
📝 go.mod (+1 -0)
📝 go.sum (+4 -0)
📝 models/config/server_common.go (+27 -4)
📝 server/control.go (+49 -7)
📝 server/service.go (+32 -1)
📝 utils/vhost/http.go (+2 -2)
📝 utils/vhost/resource.go (+52 -29)

📄 Description

英文不好,直接中文介绍下吧。

新增的功能:

  • 服务端控制客户端允许打开哪些隧道,可对接第三方 API
  • Frps 将客户端提交的每个隧道都发送给 API 进行验证,确保隧道合法后才会启动
  • Frps 支持对接 API 实现验证客户端身份(登录)

在配置文件中增加了以下三个选项:

  • api_enable Bool 类型,启用或禁用 API 功能
  • api_baseurl String 类型,API 的基础调用地址,所有请求会 GET 到这上面
  • api_token String 类型,Frps 与 API 通讯时的鉴权秘钥,用于验证 Frps 身份

当 API 启用时,Frps 会在 Frpc 尝试 Add Proxies 的时候将所有的配置字段(例如 proxy_name、proxy_type、remote_port 等)通过 GET 的方式提交到 API 上,由 API 进行验证。
API 验证成功后,将验证结果返回给 Frps,Frps 根据结果的值决定是否开启对应的隧道。

这里提供了一个简单的例子,用于 Frps 对接 PHP 的 API 服务端:https://github.com/ZeroDream-CN/simple-frp-api 已经测试无问题,可正常使用。

另外,编写 API 服务端的语言并不局限于 PHP,因为 Frps 只是对外发起了一个简单的 Http 请求,理论上用任何语言都能实现。

本 Pr 是根据 #1236 的建议更改实现的。

以上就是此 Pr 所有的更改内容 :)


🔄 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/1402 **Author:** [@kasuganosoras](https://github.com/kasuganosoras) **Created:** 8/21/2019 **Status:** ❌ Closed **Base:** `new` ← **Head:** `master` --- ### 📝 Commits (10+) - [`6451583`](https://github.com/fatedier/frp/commit/6451583e60184a90c274f6683a44e89fb7a9118e) Merge pull request #1349 from fatedier/dev - [`ae08811`](https://github.com/fatedier/frp/commit/ae08811636f6ab449deb30cf7579390f9d476ab3) Merge pull request #1364 from fatedier/dev - [`134a46c`](https://github.com/fatedier/frp/commit/134a46c00b59a641dc89ab9265ea73d2d7aa6ff2) Merge pull request #1369 from fatedier/dev - [`8a72230`](https://github.com/fatedier/frp/commit/8a7223033bdaac8292102770f7a98c1e668338b3) Merge pull request #1 from fatedier/master - [`24b71f9`](https://github.com/fatedier/frp/commit/24b71f987cbf344502e19fc203e67ff62ef11f7e) Add api feature - [`f49348f`](https://github.com/fatedier/frp/commit/f49348f34c031b3471b791408e35d10332468ee7) add: proxy limit - [`23d3609`](https://github.com/fatedier/frp/commit/23d36090a0445df841b582a77dcdff8b6836fdfc) Merge pull request #2 from ma6254/master - [`3df9338`](https://github.com/fatedier/frp/commit/3df93382222d56fcc12c02ea7df1202be645496c) Update control.go - [`6a34c73`](https://github.com/fatedier/frp/commit/6a34c730715dbc6561f149a4c4f91a6066a3c22b) Update api.go - [`fb65a33`](https://github.com/fatedier/frp/commit/fb65a3304742245a741736ba886a67207b60e59f) test ### 📊 Changes **14 files changed** (+598 additions, -43 deletions) <details> <summary>View changed files</summary> 📝 `.gitignore` (+1 -0) 📝 `conf/frps_full.ini` (+9 -0) ➕ `extend/api/api.go` (+234 -0) ➕ `extend/limit/limit.go` (+44 -0) ➕ `extend/limit/reader.go` (+63 -0) ➕ `extend/limit/w_test.go` (+17 -0) ➕ `extend/limit/writer.go` (+63 -0) 📝 `go.mod` (+1 -0) 📝 `go.sum` (+4 -0) 📝 `models/config/server_common.go` (+27 -4) 📝 `server/control.go` (+49 -7) 📝 `server/service.go` (+32 -1) 📝 `utils/vhost/http.go` (+2 -2) 📝 `utils/vhost/resource.go` (+52 -29) </details> ### 📄 Description 英文不好,直接中文介绍下吧。 新增的功能: - 服务端控制客户端允许打开哪些隧道,可对接第三方 API - Frps 将客户端提交的每个隧道都发送给 API 进行验证,确保隧道合法后才会启动 - Frps 支持对接 API 实现验证客户端身份(登录) 在配置文件中增加了以下三个选项: - `api_enable ` Bool 类型,启用或禁用 API 功能 - `api_baseurl` String 类型,API 的基础调用地址,所有请求会 GET 到这上面 - `api_token` String 类型,Frps 与 API 通讯时的鉴权秘钥,用于验证 Frps 身份 当 API 启用时,Frps 会在 Frpc 尝试 Add Proxies 的时候将所有的配置字段(例如 proxy_name、proxy_type、remote_port 等)通过 GET 的方式提交到 API 上,由 API 进行验证。 API 验证成功后,将验证结果返回给 Frps,Frps 根据结果的值决定是否开启对应的隧道。 这里提供了一个简单的例子,用于 Frps 对接 PHP 的 API 服务端:https://github.com/ZeroDream-CN/simple-frp-api 已经测试无问题,可正常使用。 另外,编写 API 服务端的语言并不局限于 PHP,因为 Frps 只是对外发起了一个简单的 Http 请求,理论上用任何语言都能实现。 本 Pr 是根据 #1236 的建议更改实现的。 以上就是此 Pr 所有的更改内容 :) --- <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:41:00 -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#4381
No description provided.