Socks 4 绑定请求说明

发布于 2024-12-09 05:03:00 字数 458 浏览 0 评论 0原文

我正在读这个话题 http://ftp.icm.edu.pl/packages/socks/ ocks4/SOCKS4.protocol

我想做的是:
我有一个客户端/服务器应用程序,我尝试使用socks 4 BIND请求将我的服务器绑定到远程socks服务器,并使客户端连接到该socks服务器,而socks服务器将使它们连接到我的服务器(位于至少这就是我理解socks BIND请求的方式)

但是我不完全理解它(我的英语有点糟糕),我要问的是,当我不知道任何远程IP时是否可以这样做客户?由于服务器的 BIND 请求包必须包含远程客户端的地址,而我实际上没有,因为客户端来自未知用户,从我的服务器检索状态信息(或者我可以使用 0 作为 INANY_ADDR)吗?

i was reading this topic
http://ftp.icm.edu.pl/packages/socks/socks4/SOCKS4.protocol

What I'm trying to do is:
I have a client/server application, I'm trying to use socks 4 BIND request to bind my server to a remote socks server, and make the clients connect to that socks server and the socks server will make them connect to my server (at least that's how I understand socks BIND request)

But I don't fully understand it (my English is kinda bad), what I'm asking is, is it possible to do so when I don't know any of the remote IPs of the clients? Since the server's BIND request package must contain the address of the remote client and I don't really have than since the clients are from unknown users retrieving status info from my server (or can I use 0 for INANY_ADDR) ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

爱*していゐ 2024-12-16 05:03:00

您所要求的 SOCKS 是不可能实现的,也不是为了这个目的。更仔细地再次阅读规范。 BIND 命令适用于多连接协议(如 FTP),其中主连接用于在客户端和服务器之间进行通信,BIND 有助于服务器在连接完成后需要将辅助连接连接到客户端的情况。客户端告诉服务器连接到哪里。在这种情况下,客户端将向 SOCKS 发出 BIND 命令,告诉它服务器的 IP/端口,以便它只接受该连接,然后将生成的 SOCKS 侦听 IP/端口发送到要连接的服务器。

使用定义了端口转发规则的路由器可以更好地满足您的要求。然后,您可以在路由器上打开一个侦听端口,该端口接受任何入站连接并将其转发到您的应用程序的侦听 IP/端口。大多数现代路由器都支持 uPNP(通用即插即用),因此您可以通过编程方式配置转发规则,而无需管理员访问路由器的配置软件。

What you are asking for is not possible with SOCKS, nor is it meant for that purpose. Read the spec again more carefully. The BIND command is meant for use with multi-connection protocols (like FTP), where a primary connection is used to communicate between a client and a server, and BIND facilitates situations where the server needs to connect a secondary connection to the client after the client tells the server where to connect. In that situation, the client would issue a BIND command to SOCKS telling it the server's IP/Port so it only accepts that connection, then send the resulting SOCKS listening IP/Port to the server to connect to.

What you are asking for is better served by using a router with Port Forwarding rules defined. Then you can open a listening port on the router that accepts any inbound connection and forwards it to your app's listening IP/Port. Most modern routers support uPNP (Universal Plug-N-Play) so you can configure the forwarding rules programmably instead of requiring admin access to the router's configuration software.

时光礼记 2024-12-16 05:03:00

雷米解释得很好。
我想补充一点,如果你想实现你的目标,你还可以实现一个稍微打破协议的 SOCKS5 服务器:监听特定端口的传入连接(在你的场景中来自客户端),接受任何传入连接无论 DST.ADDR 和 DST.PORT 是什么,然后将其中继到您的服务器。
但要注意安全风险!

Remy explained it well.
I'd like to add that, if you want to achieve your goal, you can also implement a SOCKS5 server that breaks the protocol a little bit: listen on a specific port for incoming connection (from clients, in your scenario), accept any incoming connection no matter what the DST.ADDR and DST.PORT is, then relay it to your server.
Watch out for security risk though!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文