[GH-ISSUE #2742] 请问插件开发时,如何获取到frpc客户端的真实IP? #2191

Closed
opened 2026-05-05 13:24:35 -06:00 by gitea-mirror · 4 comments
Owner

Originally created by @zhizunbao84 on GitHub (Jan 9, 2022).
Original GitHub issue: https://github.com/fatedier/frp/issues/2742

Bug Description

首先非常感谢能有这么好的工具!!非常感谢。

我使用frps的时候,一开始什么认证也没设,然后使用的过程中发现除了我的内网机器(frpc 客户端),还有美国ip的frpc 客户端在连接我的frps。

我就想在frpc 客户端连接我的frps的时候验证一下是否是我的内网机器ip,如果是就放行,否则就拒绝。

我稍微研究了一下,frps的log文件中有frpc 客户端的ip,但是插件开发时,Login,NewProxy,NewWorkConn,NewUserConn这些过程中的json信息中没有frpc 客户端的信息。
还请多多指教?!

frpc Version

0.37.1

frps Version

0.37.1

System Architecture

windows/amd64

Configurations

NONE

Logs

No response

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 @zhizunbao84 on GitHub (Jan 9, 2022). Original GitHub issue: https://github.com/fatedier/frp/issues/2742 ### Bug Description 首先非常感谢能有这么好的工具!!非常感谢。 我使用frps的时候,一开始什么认证也没设,然后使用的过程中发现除了我的内网机器(frpc 客户端),还有美国ip的frpc 客户端在连接我的frps。 我就想在frpc 客户端连接我的frps的时候验证一下是否是我的内网机器ip,如果是就放行,否则就拒绝。 我稍微研究了一下,frps的log文件中有frpc 客户端的ip,但是插件开发时,Login,NewProxy,NewWorkConn,NewUserConn这些过程中的json信息中没有frpc 客户端的信息。 还请多多指教?! ### frpc Version 0.37.1 ### frps Version 0.37.1 ### System Architecture windows/amd64 ### Configurations NONE ### Logs _No response_ ### Steps to reproduce 1. 2. 3. ... ### Affected area - [ ] Docs - [ ] Installation - [ ] Performance and Scalability - [ ] Security - [ ] User Experience - [ ] Test and Release - [ ] Developer Infrastructure - [ ] Client Plugin - [X] Server Plugin - [ ] Extensions - [ ] Others
gitea-mirror 2026-05-05 13:24:35 -06:00
  • closed this issue
  • added the
    todo
    label
Author
Owner

@fatedier commented on GitHub (Jan 9, 2022):

建议设置上 token,避免任何人都可以连接,也可以通过防火墙禁止某些 ip 段连接。

<!-- gh-comment-id:1008303810 --> @fatedier commented on GitHub (Jan 9, 2022): 建议设置上 token,避免任何人都可以连接,也可以通过防火墙禁止某些 ip 段连接。
Author
Owner

@hlpan commented on GitHub (Jan 10, 2022):

我也遇到这个问题了,能不能加上IP限制或类似功能。

<!-- gh-comment-id:1008561434 --> @hlpan commented on GitHub (Jan 10, 2022): 我也遇到这个问题了,能不能加上IP限制或类似功能。
Author
Owner

@zhizunbao84 commented on GitHub (Jan 10, 2022):

建议设置上 token,避免任何人都可以连接,也可以通过防火墙禁止某些 ip 段连接。

我现在设置了,但是如果能设置IP限制什么的肯定更保险了。

<!-- gh-comment-id:1008907670 --> @zhizunbao84 commented on GitHub (Jan 10, 2022): > 建议设置上 token,避免任何人都可以连接,也可以通过防火墙禁止某些 ip 段连接。 我现在设置了,但是如果能设置IP限制什么的肯定更保险了。
Author
Owner

@fatedier commented on GitHub (Jan 10, 2022):

可以考虑在 Login 的消息里附加上 frpc IP。

<!-- gh-comment-id:1008917508 --> @fatedier commented on GitHub (Jan 10, 2022): 可以考虑在 Login 的消息里附加上 frpc IP。
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#2191
No description provided.