[GH-ISSUE #4298] 支持不同ip的用户使用相同的 frp 配置名字 #3392

Closed
opened 2026-05-05 14:11:04 -06:00 by gitea-mirror · 5 comments
Owner

Originally created by @snail2sky on GitHub (Jun 24, 2024).
Original GitHub issue: https://github.com/fatedier/frp/issues/4298

Describe the feature request

只有一个公网IP
需要通过这个公网IP 来暴露多个内网设备,有可能是ssh服务或者web服务
要进行代理的服务无法都使用 name=ssh 或者name=web
猜测frp内部只用name作为hash的key,由于这一个公网ip可能给多个租户使用,他们之间可能会暴露相同的服务,导致服务名很有可能会相同
希望能加上一个功能,使用 name+客户端ip进行hash,这样的话,就可以允许 不同ip的用户 可以使用相同的名字创建自己的代理服务了

端口肯定没办法复用,这个没有办法~
但是配置文件种的名字应该是可以的

Describe alternatives you've considered

frp-client 连接 frp-server时,以name+ip作为map的key
frp-client 断开连接时,按照之前的逻辑移除即可

当然用ip不一定是最优解,因为很有可能在同一个局域网中有多个需要暴露的内网设备,那么这些设备的出口ip可能是一样的
因此,可以给每个frpc实例增加一个唯一标识可能会更好,如果用户没写,则自动生成一个随机的也行,反正 最终会使用 端口进行访问,只要能把这个配置写入到 frps 中即可,单一用名字进行hash,冲突的可能性很大

Affected area

  • Docs
  • Installation
  • Performance and Scalability
  • Security
  • User Experience
  • Test and Release
  • Developer Infrastructure
  • Client Plugin
  • Server Plugin
  • Extensions
  • Others
Originally created by @snail2sky on GitHub (Jun 24, 2024). Original GitHub issue: https://github.com/fatedier/frp/issues/4298 ### Describe the feature request 只有一个公网IP 需要通过这个公网IP 来暴露多个内网设备,有可能是ssh服务或者web服务 要进行代理的服务无法都使用 name=ssh 或者name=web 猜测frp内部只用name作为hash的key,由于这一个公网ip可能给多个租户使用,他们之间可能会暴露相同的服务,导致服务名很有可能会相同 希望能加上一个功能,使用 name+客户端ip进行hash,这样的话,就可以允许 不同ip的用户 可以使用相同的名字创建自己的代理服务了 端口肯定没办法复用,这个没有办法~ 但是配置文件种的名字应该是可以的 ### Describe alternatives you've considered frp-client 连接 frp-server时,以name+ip作为map的key frp-client 断开连接时,按照之前的逻辑移除即可 当然用ip不一定是最优解,因为很有可能在同一个局域网中有多个需要暴露的内网设备,那么这些设备的出口ip可能是一样的 因此,可以给每个frpc实例增加一个唯一标识可能会更好,如果用户没写,则自动生成一个随机的也行,反正 最终会使用 端口进行访问,只要能把这个配置写入到 frps 中即可,单一用名字进行hash,冲突的可能性很大 ### Affected area - [ ] Docs - [ ] Installation - [ ] Performance and Scalability - [ ] Security - [X] User Experience - [ ] Test and Release - [ ] Developer Infrastructure - [ ] Client Plugin - [ ] Server Plugin - [ ] Extensions - [ ] Others
Author
Owner

@wuai1024 commented on GitHub (Jun 24, 2024):

不用这么麻烦,现在就支持的。

serverAddr: "xxx.xxx.xxx.xxx"
serverPort: 7000
# 新增
user: "frpc-client1"

通过添加 user 标记不同用户,proxy 中的 name 就可以重复了

<!-- gh-comment-id:2186029807 --> @wuai1024 commented on GitHub (Jun 24, 2024): 不用这么麻烦,现在就支持的。 ```shell serverAddr: "xxx.xxx.xxx.xxx" serverPort: 7000 # 新增 user: "frpc-client1" ``` 通过添加 `user` 标记不同用户,proxy 中的 name 就可以重复了
Author
Owner

@snail2sky commented on GitHub (Jun 24, 2024):

不用这么麻烦,现在就支持的。不用这么麻烦,现在就支持的。

serverAddr: "xxx.xxx.xxx.xxx"
serverPort: 7000
# 新增
user: "frpc-client1"

通过添加 user 标记不同用户,proxy 中的 name 就可以重复了通过添加用户标记不同的用户,代理中的名字就可以重复了

对对对 就是这个需求

<!-- gh-comment-id:2186036758 --> @snail2sky commented on GitHub (Jun 24, 2024): > 不用这么麻烦,现在就支持的。不用这么麻烦,现在就支持的。 > > ```shell > serverAddr: "xxx.xxx.xxx.xxx" > serverPort: 7000 > # 新增 > user: "frpc-client1" > ``` > > 通过添加 `user` 标记不同用户,proxy 中的 name 就可以重复了通过添加用户标记不同的用户,代理中的名字就可以重复了 对对对 就是这个需求
Author
Owner

@waxi-i commented on GitHub (Oct 19, 2024):

这个user可以自动生成吗,因为想客户端自动注册

<!-- gh-comment-id:2423588263 --> @waxi-i commented on GitHub (Oct 19, 2024): 这个user可以自动生成吗,因为想客户端自动注册
Author
Owner

@fatedier commented on GitHub (Oct 21, 2024):

这个user可以自动生成吗,因为想客户端自动注册

可以结合环境变量模版使用,随机生成一个特定的环境变量,然后在配置模版中引用这个变量。

<!-- gh-comment-id:2425505213 --> @fatedier commented on GitHub (Oct 21, 2024): > 这个user可以自动生成吗,因为想客户端自动注册 可以结合环境变量模版使用,随机生成一个特定的环境变量,然后在配置模版中引用这个变量。
Author
Owner

@snail2sky commented on GitHub (Oct 23, 2024):

高版本 已经支持了 通过user配置,issue 已关闭

<!-- gh-comment-id:2430636121 --> @snail2sky commented on GitHub (Oct 23, 2024): 高版本 已经支持了 通过user配置,issue 已关闭
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#3392
No description provided.