liudf0716 / xfrpc

The xfrpc project is a lightweight implementation of the FRP client written in C language for OpenWRT and IoT systems. It is designed to provide an efficient solution for resource-constrained devices such as OpenWRT routers and IoT devices, which often have limited ROM and RAM space.
GNU General Public License v3.0
721 stars 92 forks source link

请问是否支持 remote_port = 0 配置,我期望自动远程端口,但是报错:Proxy [ssh01] error: remote_port or local_port or local_ip not found #63

Closed ztj1993 closed 4 weeks ago

ztj1993 commented 1 month ago

版本:3.05.661 配置:

[common]
server_addr = xxx
server_port = 7000
token = xxx
[ssh01]
type = tcp
local_ip = 127.0.0.1
local_port = 22
remote_port = 0

启动报错:

[3][Mon Oct 14 17:20:31 2024][24317](config.c:245) Proxy [ssh01] error: remote_port or local_port or local_ip not found
[3][Mon Oct 14 17:20:31 2024][24317](config.c:130) Error: validate_proxy failed

如果指定 remote_port 为具体的端口,则不报错。 请问是否 remote_port = 0 配置,我以前的 frpc 是可以这样配置的。

我是在 OpenWrt 23.05.3 测试的,通过 opkg install xfrpc 安装。

还有 name 参数,经过测试也不支持。

[ssh01]
name = aaa
type = tcp
local_ip = 127.0.0.1
local_port = 22
remote_port = 0
liudf0716 commented 1 month ago

远程端口支持需要服务段frps支持才行,这个要看frp项目

ztj1993 commented 1 month ago

服务端肯定是支持的,因为我一直有部署使用,并且 frpc 也支持 remote_port = 0 的配置,但是我切换到 xfrpc 后,发现不支持 remote_port = 0 的配置。

请看 frpc 的配置文件:https://github.com/fatedier/frp/blob/466d69eae08e44f118302cf433d3f4d6e8d04893/conf/frpc_full.ini#L192

请看最新版本的配置文件: https://github.com/fatedier/frp/blob/6ba849fc750749d796c020987dbe467cf3a361b0/conf/frpc_full_example.toml#L183

因此我对 xfrpc 不能将 remote_port 设置为 0 感到疑惑。

liudf0716 commented 1 month ago

好的,我看看。按说这个配置是上传到frps端的,可能xfrpc对这个配置做了非零检验,刚好把这个配置给限制了

liudf0716 commented 1 month ago

@ztj1993 的确是xfrpc做了限制,已经把限制取消了 https://github.com/liudf0716/xfrpc/commit/3e9c465e041fd335bbfa73dfe9445d464a49a91f

ztj1993 commented 4 weeks ago

@liudf0716 OK,谢谢