[GH-ISSUE #3590] [Feature Request] 需要服务器插件中获取到远程端口 #2865

Closed
opened 2026-05-05 13:51:13 -06:00 by gitea-mirror · 2 comments
Owner

Originally created by @zhangshengping on GitHub (Aug 28, 2023).
Original GitHub issue: https://github.com/fatedier/frp/issues/3590

Describe the feature request

应用过程中需要使用动态端口分配,
客户端的配置中使用了 remote_port = 0,
希望在服务端的插件中拿到实际使用的远程端口号,
看了一下服务端插件post的数据中不包含远程端口号,
是否可以已添加这个字段

[common]
server_addr = 127.0.0.1
server_port = 17000

[ssh]
type = tcp
local_ip = 127.0.0.1
local_port = 22
remote_port = 0

Describe alternatives you've considered

No response

Affected area

  • Docs
  • Installation
  • Performance and Scalability
  • Security
  • User Experience
  • Test and Release
  • Developer Infrastructure
  • Client Plugin
  • Server Plugin
  • Extensions
  • Others
Originally created by @zhangshengping on GitHub (Aug 28, 2023). Original GitHub issue: https://github.com/fatedier/frp/issues/3590 ### Describe the feature request 应用过程中需要使用动态端口分配, 客户端的配置中使用了 remote_port = 0, 希望在服务端的插件中拿到实际使用的远程端口号, 看了一下服务端插件post的数据中不包含远程端口号, 是否可以已添加这个字段 ``` [common] server_addr = 127.0.0.1 server_port = 17000 [ssh] type = tcp local_ip = 127.0.0.1 local_port = 22 remote_port = 0 ``` ### Describe alternatives you've considered _No response_ ### Affected area - [ ] Docs - [ ] Installation - [ ] Performance and Scalability - [ ] Security - [ ] User Experience - [ ] Test and Release - [ ] Developer Infrastructure - [ ] Client Plugin - [X] Server Plugin - [ ] Extensions - [ ] Others
Author
Owner

@fatedier commented on GitHub (Aug 28, 2023):

之前有过类似 issue,如果你希望主动分配端口,可以自行修改这个值。

如果你希望获取被分配到的端口,建议通过 api 查询。

<!-- gh-comment-id:1695086812 --> @fatedier commented on GitHub (Aug 28, 2023): 之前有过类似 issue,如果你希望主动分配端口,可以自行修改这个值。 如果你希望获取被分配到的端口,建议通过 api 查询。
Author
Owner

@leadscloud commented on GitHub (May 12, 2025):

这个是怎么通过api查询?目前只能通过管理界面可以拿到 /api/proxy/tcp。能否支持通过plugins解决。

比如

[[httpPlugins]]
name = "port-manager"
addr = "192.168.2.xx:9001"
path = "/handler"
ops = ["NewProxy", "NewUserConn", "NewWorkConn"]

比如在NewUserConn或 NewWorkConn 发送这个remotePort

目前只发送这些数据

{"version":"0.1.0","op":"NewWorkConn","content":{"user":{"user":"","metas":null,"run_id":"7fe7ef2b3a004446"},"run_id":"7fe7ef2b3a004446"}}

<!-- gh-comment-id:2871740988 --> @leadscloud commented on GitHub (May 12, 2025): 这个是怎么通过api查询?目前只能通过管理界面可以拿到 /api/proxy/tcp。能否支持通过plugins解决。 比如 ``` [[httpPlugins]] name = "port-manager" addr = "192.168.2.xx:9001" path = "/handler" ops = ["NewProxy", "NewUserConn", "NewWorkConn"] ``` 比如在NewUserConn或 NewWorkConn 发送这个remotePort 目前只发送这些数据 {"version":"0.1.0","op":"NewWorkConn","content":{"user":{"user":"","metas":null,"run_id":"7fe7ef2b3a004446"},"run_id":"7fe7ef2b3a004446"}}
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#2865
No description provided.