[GH-ISSUE #3678] [Feature Request] 提高visitors的拓展性和灵活性 #2926

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

Originally created by @xcanwin on GitHub (Oct 14, 2023).
Original GitHub issue: https://github.com/fatedier/frp/issues/3678

Describe the feature request

首先,感谢作者创造这么好的一个作品。

user参数是一个好东西,可以减少很多重复关键词。
但是它也作用于visitors配置的serverName导致以下场景会报错:

电脑A的frpc服务端配置frpc.toml:
user = "hiA"
proxies
name = "ssh.secret"
type = "stcp"
localIP = "127.0.0.1"
localPort = 22
secretKey = "key"
allowUsers = ["*"]

然后电脑B的frpc访问端配置frpc.toml:
user = "hiB"
visitors
name = "hiA.ssh.secret.vistor"
type = "stcp"
serverName = "hiA.ssh.secret"
secretKey = "key"
bindAddr = "127.0.0.1"
bindPort = 2222

B访问A时报错:
2023/10/14 23:02:58 [W] [stcp.go:114] [64c917bedc65aa77] [hiB.hiA.ssh.secret.vistor] start new visitor connection error: custom listener for [hiB.hiA.ssh.secret] doesn't exist

如果serverName可以在有user参数时不自动添加{user}.的前缀,则上面的配置是不会有问题的。

Describe alternatives you've considered

以下解决方案可以解决问题,还能提高拓展性和灵活性。
建议visitors配置新增一个参数serverNamePrefix,默认值true,为true时为serverName前缀会自动添加{user}.,为false时保持不变。
谢谢。

Affected area

  • Docs
  • Installation
  • Performance and Scalability
  • Security
  • User Experience
  • Test and Release
  • Developer Infrastructure
  • Client Plugin
  • Server Plugin
  • Extensions
  • Others
Originally created by @xcanwin on GitHub (Oct 14, 2023). Original GitHub issue: https://github.com/fatedier/frp/issues/3678 ### Describe the feature request 首先,感谢作者创造这么好的一个作品。 user参数是一个好东西,可以减少很多重复关键词。 但是它也作用于visitors配置的serverName导致以下场景会报错: 电脑A的frpc服务端配置frpc.toml: user = "hiA" [[proxies]] name = "ssh.secret" type = "stcp" localIP = "127.0.0.1" localPort = 22 secretKey = "key" allowUsers = ["*"] 然后电脑B的frpc访问端配置frpc.toml: user = "hiB" [[visitors]] name = "hiA.ssh.secret.vistor" type = "stcp" serverName = "hiA.ssh.secret" secretKey = "key" bindAddr = "127.0.0.1" bindPort = 2222 B访问A时报错: 2023/10/14 23:02:58 [W] [stcp.go:114] [64c917bedc65aa77] [hiB.hiA.ssh.secret.vistor] start new visitor connection error: custom listener for [hiB.hiA.ssh.secret] doesn't exist 如果serverName可以在有user参数时不自动添加{user}.的前缀,则上面的配置是不会有问题的。 ### Describe alternatives you've considered 以下解决方案可以解决问题,还能提高拓展性和灵活性。 建议visitors配置新增一个参数serverNamePrefix,默认值true,为true时为serverName前缀会自动添加{user}.,为false时保持不变。 谢谢。 ### Affected area - [ ] Docs - [ ] Installation - [X] Performance and Scalability - [ ] Security - [X] User Experience - [ ] Test and Release - [ ] Developer Infrastructure - [ ] Client Plugin - [ ] Server Plugin - [ ] Extensions - [ ] Others
Author
Owner

@xqzr commented on GitHub (Oct 14, 2023):

a7ad967231/conf/frpc.toml (L347)

<!-- gh-comment-id:1763192233 --> @xqzr commented on GitHub (Oct 14, 2023): https://github.com/fatedier/frp/blob/a7ad9672318bc1e0fb059274f34a9e8061aef16e/conf/frpc.toml#L347
Author
Owner

@xcanwin commented on GitHub (Oct 15, 2023):

a7ad967231/conf/frpc.toml (L347)

谢谢,确实有用。

<!-- gh-comment-id:1763281115 --> @xcanwin commented on GitHub (Oct 15, 2023): > https://github.com/fatedier/frp/blob/a7ad9672318bc1e0fb059274f34a9e8061aef16e/conf/frpc.toml#L347 谢谢,确实有用。
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#2926
No description provided.