[GH-ISSUE #3930] 两端 toml 都配置了 user 名称,stcp和xtcp无法使用 #3120

Closed
opened 2026-05-05 14:01:10 -06:00 by gitea-mirror · 1 comment
Owner

Originally created by @aklivecai on GitHub (Jan 12, 2024).
Original GitHub issue: https://github.com/fatedier/frp/issues/3930

Bug Description

两端 toml 都配置了 user 名称,stcpxtcp 无法使用
visitorsserverName 中会把 user名称带入,导致无法链接远程数据

frpc Version

0.53.2

frps Version

0.53.2

System Architecture

linux/amd64,

Configurations

两端 toml 配置

  • AA 端配置

    AA.ssh_stcp


user = "AA"

[[proxies]]
name = "ssh_stcp"
allowUsers = ["*"]
type = "stcp"
secretKey = "ssh_stcp"
localIP = "0.0.0.0"
localPort = 22

  • BB 端配置

    BB.ssh_stcp_visitor

user = "BB"

[[visitors]]
name = "ssh_stcp_visitor"
type = "stcp"
# 这里不应该把 BB 前缀放到 `serverName` 中
serverName = "AA.ssh_stcp"
secretKey = "ssh_stcp"
bindAddr = "0.0.0.0"
bindPort = 19620

Logs

2024/01/13 00:11:50 [W] [stcp.go:114] [030d63124577cb45]
[BB.ssh_stcp_visitor] start new visitor connection error: custom listener for [BB.AA.ssh_stcp] doesn't exist

Steps to reproduce

...

Affected area

  • Docs
  • Installation
  • Performance and Scalability
  • Security
  • User Experience
  • Test and Release
  • Developer Infrastructure
  • Client Plugin
  • Server Plugin
  • Extensions
  • Others
Originally created by @aklivecai on GitHub (Jan 12, 2024). Original GitHub issue: https://github.com/fatedier/frp/issues/3930 ### Bug Description 两端 `toml` 都配置了 `user` 名称,`stcp` 和 `xtcp` 无法使用 `visitors` 端 `serverName` 中会把 `user`名称带入,导致无法链接远程数据 ### frpc Version 0.53.2 ### frps Version 0.53.2 ### System Architecture linux/amd64, ### Configurations ### 两端 `toml` 配置 - AA 端配置 > `AA.ssh_stcp` ```toml user = "AA" [[proxies]] name = "ssh_stcp" allowUsers = ["*"] type = "stcp" secretKey = "ssh_stcp" localIP = "0.0.0.0" localPort = 22 ``` - BB 端配置 > `BB.ssh_stcp_visitor` ```toml user = "BB" [[visitors]] name = "ssh_stcp_visitor" type = "stcp" # 这里不应该把 BB 前缀放到 `serverName` 中 serverName = "AA.ssh_stcp" secretKey = "ssh_stcp" bindAddr = "0.0.0.0" bindPort = 19620 ``` ### Logs 2024/01/13 00:11:50 [W] [stcp.go:114] [030d63124577cb45] [BB.ssh_stcp_visitor] start new visitor connection error: custom listener for [BB.AA.ssh_stcp] doesn't exist ### Steps to reproduce 1. 2. 3. ... ### Affected area - [x] Docs - [x] Installation - [ ] Performance and Scalability - [ ] Security - [ ] User Experience - [ ] Test and Release - [ ] Developer Infrastructure - [ ] Client Plugin - [ ] Server Plugin - [ ] Extensions - [ ] Others
Author
Owner

@aklivecai commented on GitHub (Jan 12, 2024):

  • BB 端配置
user = "BB"

[[visitors]]
name = "ssh_stcp_visitor"
type = "stcp"
# 正确的配置!
serverUser="AA"
serverName = "ssh_stcp"
secretKey = "ssh_stcp"
bindAddr = "0.0.0.0"
bindPort = 19620


func (c *VisitorBaseConfig) Complete(g *ClientCommonConfig) {
	if c.BindAddr == "" {
		c.BindAddr = "127.0.0.1"
	}
	namePrefix := ""
	if g.User != "" {
		namePrefix = g.User + "."
	}
	c.Name = namePrefix + c.Name

  //  核心代码
	if c.ServerUser != "" {
		c.ServerName = c.ServerUser + "." + c.ServerName
	} else {
		c.ServerName = namePrefix + c.ServerName
	}
}
<!-- gh-comment-id:1889619665 --> @aklivecai commented on GitHub (Jan 12, 2024): - BB 端配置 ```toml user = "BB" [[visitors]] name = "ssh_stcp_visitor" type = "stcp" # 正确的配置! serverUser="AA" serverName = "ssh_stcp" secretKey = "ssh_stcp" bindAddr = "0.0.0.0" bindPort = 19620 ``` - https://github.com/fatedier/frp/blob/dev/pkg/config/v1/visitor.go#L65 ```go func (c *VisitorBaseConfig) Complete(g *ClientCommonConfig) { if c.BindAddr == "" { c.BindAddr = "127.0.0.1" } namePrefix := "" if g.User != "" { namePrefix = g.User + "." } c.Name = namePrefix + c.Name // 核心代码 if c.ServerUser != "" { c.ServerName = c.ServerUser + "." + c.ServerName } else { c.ServerName = namePrefix + c.ServerName } } ```
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#3120
No description provided.