[GH-ISSUE #3800] [Feature Request] 能否配置连续多端口? #3023

Closed
opened 2026-05-05 13:57:17 -06:00 by gitea-mirror · 7 comments
Owner

Originally created by @winterant on GitHub (Nov 27, 2023).
Original GitHub issue: https://github.com/fatedier/frp/issues/3800

Describe the feature request

能否为配置一个连续的端口区间?或者端口序列?例如:

serverAddr = "*************"
serverPort = 8000

[[proxies]]
name = "my-project"
type = "tcp"
localIP = "127.0.0.1"
localPort = 8001-9000
remotePort = 8001-9000

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 @winterant on GitHub (Nov 27, 2023). Original GitHub issue: https://github.com/fatedier/frp/issues/3800 ### Describe the feature request 能否为配置一个连续的端口区间?或者端口序列?例如: ``` serverAddr = "*************" serverPort = 8000 [[proxies]] name = "my-project" type = "tcp" localIP = "127.0.0.1" localPort = 8001-9000 remotePort = 8001-9000 ``` ### 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
gitea-mirror 2026-05-05 13:57:17 -06:00
Author
Owner

@xqzr commented on GitHub (Nov 27, 2023):

0.52.0 及以上 INI 配置格式才支持
d5b41f1e14/conf/legacy/frpc_legacy_full.ini (L194-L202)

<!-- gh-comment-id:1827280332 --> @xqzr commented on GitHub (Nov 27, 2023): 0.52.0 及以上 **INI** 配置格式才支持 https://github.com/fatedier/frp/blob/d5b41f1e1485f7205d96ea4522ed7655d145d47e/conf/legacy/frpc_legacy_full.ini#L194-L202
Author
Owner

@superzjg commented on GitHub (Nov 27, 2023):

旧的 ini 格式是支持的。并且作者大佬说在 v0 版会保留 ini 格式支持。

参看:https://github.com/fatedier/frp/issues/3711

<!-- gh-comment-id:1827323866 --> @superzjg commented on GitHub (Nov 27, 2023): 旧的 ini 格式是支持的。并且作者大佬说在 v0 版会保留 ini 格式支持。 参看:https://github.com/fatedier/frp/issues/3711
Author
Owner

@firemakergk commented on GitHub (Dec 22, 2023):

在此请求在新版本配置文件中支持对range的支持,这对于webrtc这类流服务的代理至关重要,它的协商接口不确定且是一个范围。

<!-- gh-comment-id:1867156795 --> @firemakergk commented on GitHub (Dec 22, 2023): 在此请求在新版本配置文件中支持对range的支持,这对于webrtc这类流服务的代理至关重要,它的协商接口不确定且是一个范围。
Author
Owner

@scientificworld commented on GitHub (Dec 26, 2023):

同上。可否做成类似于这样的配置?不知道 TOML 有没有单独的 range type 之类的东西。

[[proxies]]
name = "tcp_port"
type = "tcp"
localIP = "127.0.0.1"
localPortRange = "6010-6020,6022,6024-6028"
remotePortRange = "6010-6020,6022,6024-6028"
<!-- gh-comment-id:1869512149 --> @scientificworld commented on GitHub (Dec 26, 2023): 同上。可否做成类似于这样的配置?不知道 TOML 有没有单独的 range type 之类的东西。 ```toml [[proxies]] name = "tcp_port" type = "tcp" localIP = "127.0.0.1" localPortRange = "6010-6020,6022,6024-6028" remotePortRange = "6010-6020,6022,6024-6028" ```
Author
Owner

@superzjg commented on GitHub (Dec 26, 2023):

同上。可否做成类似于这样的配置?不知道 TOML 有没有单独的 range type 之类的东西。

[[proxies]]
name = "tcp_port"
type = "tcp"
localIP = "127.0.0.1"
localPortRange = "6010-6020,6022,6024-6028"
remotePortRange = "6010-6020,6022,6024-6028"

看上去应该不是这种表达方式,参考 frps 的:
allowPorts = [ { start = 2000, end = 3000 }, { single = 3001 }, { single = 3003 }, { start = 4000, end = 50000 } ]
暂时toml不支持肯定是有原因的,目前使用改用ini格式就可以了

<!-- gh-comment-id:1869515208 --> @superzjg commented on GitHub (Dec 26, 2023): > 同上。可否做成类似于这样的配置?不知道 TOML 有没有单独的 range type 之类的东西。 > > ```toml > [[proxies]] > name = "tcp_port" > type = "tcp" > localIP = "127.0.0.1" > localPortRange = "6010-6020,6022,6024-6028" > remotePortRange = "6010-6020,6022,6024-6028" > ``` 看上去应该不是这种表达方式,参考 frps 的: `allowPorts = [ { start = 2000, end = 3000 }, { single = 3001 }, { single = 3003 }, { start = 4000, end = 50000 } ]` 暂时toml不支持肯定是有原因的,目前使用改用ini格式就可以了
Author
Owner

@github-actions[bot] commented on GitHub (Jan 25, 2024):

Issues go stale after 21d of inactivity. Stale issues rot after an additional 7d of inactivity and eventually close.

<!-- gh-comment-id:1909338436 --> @github-actions[bot] commented on GitHub (Jan 25, 2024): Issues go stale after 21d of inactivity. Stale issues rot after an additional 7d of inactivity and eventually close.
Author
Owner

@slipperstree commented on GitHub (Jun 26, 2024):

在toml下定义穿透端口的范围,我使用暴力方式一个一个的映射,写几行python小脚本即可批量生成配置,比如
下面这段可以为我生成ftp被动模式需要的100个端口映射。
跑在我的树莓派4b上,目前没发现性能问题。

for i in range(50000, 50101):
    print("[[proxies]]")
    print(f'name = "my-ftp_pasv_{i}"')
    print('type = "tcp"')
    print('localIP = "127.0.0.1"')
    print(f'localPort = {i}')
    print(f'remotePort = {i}')
    print()
<!-- gh-comment-id:2191101103 --> @slipperstree commented on GitHub (Jun 26, 2024): 在toml下定义穿透端口的范围,我使用暴力方式一个一个的映射,写几行python小脚本即可批量生成配置,比如 下面这段可以为我生成ftp被动模式需要的100个端口映射。 跑在我的树莓派4b上,目前没发现性能问题。 ```python for i in range(50000, 50101): print("[[proxies]]") print(f'name = "my-ftp_pasv_{i}"') print('type = "tcp"') print('localIP = "127.0.0.1"') print(f'localPort = {i}') print(f'remotePort = {i}') print() ```
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#3023
No description provided.