[GH-ISSUE #4761] [Feature Request] TCP转发时能附带真实IP #3760

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

Originally created by @raphaelcheung on GitHub (Apr 20, 2025).
Original GitHub issue: https://github.com/fatedier/frp/issues/4761

Describe the feature request

希望用 FRP 转发 TCP 长连接(非HTTP)时能附带上请求方的真实IP。

类似 NGINX 中 stream 下的的proxy_protocol on;

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 @raphaelcheung on GitHub (Apr 20, 2025). Original GitHub issue: https://github.com/fatedier/frp/issues/4761 ### Describe the feature request 希望用 FRP 转发 TCP 长连接(非HTTP)时能附带上请求方的真实IP。 类似 NGINX 中 stream 下的的` proxy_protocol on; ` ### Describe alternatives you've considered _No response_ ### Affected area - [ ] Docs - [ ] Installation - [ ] Performance and Scalability - [ ] Security - [x] User Experience - [ ] Test and Release - [ ] Developer Infrastructure - [ ] Client Plugin - [ ] Server Plugin - [ ] Extensions - [ ] Others
Author
Owner

@tonyzhou777 commented on GitHub (Apr 23, 2025):

同求,很多内网服务无法走HTTP,但是需要真实IP来判断。

<!-- gh-comment-id:2825621220 --> @tonyzhou777 commented on GitHub (Apr 23, 2025): 同求,很多内网服务无法走HTTP,但是需要真实IP来判断。
Author
Owner
<!-- gh-comment-id:2830761221 --> @xqzr commented on GitHub (Apr 25, 2025): https://gofrp.org/zh-cn/docs/features/common/realip/#proxy-protocol
Author
Owner

@tonyzhou777 commented on GitHub (Apr 26, 2025):

https://gofrp.org/zh-cn/docs/features/common/realip/#proxy-protocol

这个需要服务接收端支持才能用,现在需要一个模拟真实IP访问的功能,这样即使服务端不支持proxy-protocol,也能获得用户真实IP。

<!-- gh-comment-id:2831972448 --> @tonyzhou777 commented on GitHub (Apr 26, 2025): > https://gofrp.org/zh-cn/docs/features/common/realip/#proxy-protocol 这个需要服务接收端支持才能用,现在需要一个模拟真实IP访问的功能,这样即使服务端不支持proxy-protocol,也能获得用户真实IP。
Author
Owner

@xqzr commented on GitHub (Apr 26, 2025):

模拟真实IP访问的功能

最新版的 TUN 功能,也许可以

<!-- gh-comment-id:2832489831 --> @xqzr commented on GitHub (Apr 26, 2025): > 模拟真实IP访问的功能 最新版的 TUN 功能,也许可以
Author
Owner

@tonyzhou777 commented on GitHub (Apr 26, 2025):

模拟真实IP访问的功能

最新版的 TUN 功能,也许可以

好的,谢谢,我试试

<!-- gh-comment-id:2832497019 --> @tonyzhou777 commented on GitHub (Apr 26, 2025): > > 模拟真实IP访问的功能 > > 最新版的 TUN 功能,也许可以 好的,谢谢,我试试
Author
Owner

@raphaelcheung commented on GitHub (Apr 27, 2025):

https://gofrp.org/zh-cn/docs/features/common/realip/#proxy-protocol

这个只支持https/http协议,希望非http的所有TCP连接都能支持

<!-- gh-comment-id:2832856487 --> @raphaelcheung commented on GitHub (Apr 27, 2025): > https://gofrp.org/zh-cn/docs/features/common/realip/#proxy-protocol 这个只支持https/http协议,希望非http的所有TCP连接都能支持
Author
Owner

@raphaelcheung commented on GitHub (Apr 27, 2025):

模拟真实IP访问的功能

最新版的 TUN 功能,也许可以

好的,谢谢,我试试

能用吗,我没找到这个功能用法

<!-- gh-comment-id:2832864861 --> @raphaelcheung commented on GitHub (Apr 27, 2025): > > > 模拟真实IP访问的功能 > > > > > > 最新版的 TUN 功能,也许可以 > > 好的,谢谢,我试试 能用吗,我没找到这个功能用法
Author
Owner

@xqzr commented on GitHub (Apr 27, 2025):

非http的所有TCP连接都能支持

可以支持,但需要本地 TCP 应用支持

<!-- gh-comment-id:2833467915 --> @xqzr commented on GitHub (Apr 27, 2025): > 非http的所有TCP连接都能支持 可以支持,但需要本地 TCP 应用支持
Author
Owner

@raphaelcheung commented on GitHub (Apr 28, 2025):

非http的所有TCP连接都能支持

可以支持,但需要本地 TCP 应用支持

我本地应用是支持的,用nginx转发测过proxy_protocol,能正确解析到真实IP。

请问FRPC是这样配置吗:

proxies
name = "xxx"
type = "tcp"
localIP = "192.168.0.2"
localPort = xxxxx
remotePort = xxxxx
transport.proxyProtocolVersion = "v2"

<!-- gh-comment-id:2833762103 --> @raphaelcheung commented on GitHub (Apr 28, 2025): > > 非http的所有TCP连接都能支持 > > 可以支持,但需要本地 TCP 应用支持 我本地应用是支持的,用nginx转发测过proxy_protocol,能正确解析到真实IP。 请问FRPC是这样配置吗: [[proxies]] name = "xxx" type = "tcp" localIP = "192.168.0.2" localPort = xxxxx remotePort = xxxxx transport.proxyProtocolVersion = "v2"
Author
Owner

@raphaelcheung commented on GitHub (May 4, 2025):

非http的所有TCP连接都能支持

可以支持,但需要本地 TCP 应用支持

我本地应用是支持的,用nginx转发测过proxy_protocol,能正确解析到真实IP。

请问FRPC是这样配置吗:

proxies name = "xxx" type = "tcp" localIP = "192.168.0.2" localPort = xxxxx remotePort = xxxxx transport.proxyProtocolVersion = "v2"

pls ~

<!-- gh-comment-id:2849016788 --> @raphaelcheung commented on GitHub (May 4, 2025): > > > 非http的所有TCP连接都能支持 > > > > > > 可以支持,但需要本地 TCP 应用支持 > > 我本地应用是支持的,用nginx转发测过proxy_protocol,能正确解析到真实IP。 > > 请问FRPC是这样配置吗: > > [[proxies]] name = "xxx" type = "tcp" localIP = "192.168.0.2" localPort = xxxxx remotePort = xxxxx transport.proxyProtocolVersion = "v2" pls ~
Author
Owner

@raphaelcheung commented on GitHub (May 4, 2025):

误操作把本帖关闭了,怎么重开啊

<!-- gh-comment-id:2849017107 --> @raphaelcheung commented on GitHub (May 4, 2025): 误操作把本帖关闭了,怎么重开啊
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#3760
No description provided.