[英]UDP punch hole for a web-server?
For my academic project, I am trying to achieve this. 对于我的学术项目,我正在努力实现这一目标。 A web server node JS application listening on port 3000. So If you
curl http://localhost:3000
you will get Hello World!
一个在端口3000上侦听的Web服务器节点JS应用程序。因此,如果
curl http://localhost:3000
您将获得Hello World!
. 。 ( A simple web page.
(一个简单的网页。
Now I am running above webserver in my local machine. 现在,我在本地计算机上的网络服务器上方运行。 And my modem is behind NAT.
我的调制解调器位于NAT之后。 Suppose If I port forward in the modem to
myip:3000
then it is open to the world. 假设如果我将调制解调器中的端口转发到
myip:3000
那么它将对世界开放。 But here is the biggest thing I am stuck - I don't want to use the modem for port forwarding, instead, I will use third party server for UDP Punch Hole. 但是,这是我最大的困难-我不想使用调制解调器进行端口转发,而是将第三方服务器用于UDP Punch Hole。
Now my requirement is anyone from net should able to access my webserver at curl http://third-party-server-ip:3000
. 现在,我的要求是,任何来自net的人都应该能够通过
curl http://third-party-server-ip:3000
访问我的Web curl http://third-party-server-ip:3000
。
What I am trying is to write another client - which opens a connection to the third party server. 我正在尝试编写另一个客户端-这将打开与第三方服务器的连接。 Say it did a hole punching at port
41234
. 说它在端口
41234
打孔。 That port is open. 该端口是开放的。 The third-party host can send something to that port.
第三方主机可以向该端口发送内容。
Now anyone in the internet initiate this command curl http://third-party-ip:3000
to the third party host. 现在,互联网上的任何人都可以向第三方主机发起以下命令
curl http://third-party-ip:3000
。 So the third party returns the myip:udpPunchHolePort ie, myip:41234
. 因此,第三方返回myip:udpPunchHolePort即
myip:41234
。
anyone will again curl to myip:41234
it will be received by the node js UDP punch app, so it will redirect to localhost:3000
. 任何人都将再次卷曲到
myip:41234
,它将被节点js UDP打孔应用程序接收,因此它将重定向到localhost:3000
。 Finally, the anyone
will receive the response from localhost:3000
. 最后,
anyone
都会收到localhost:3000
的响应。
My two questions - 我的两个问题-
Note - In this academic project, we are trying to learn how to make any local application open to the world without port forwarding in the modem. 注意-在此学术项目中,我们正在尝试学习如何使任何本地应用程序对世界开放,而无需在调制解调器中进行端口转发。
We read on skype protocol analysis , that is also our inspiration. 我们阅读了Skype协议分析 ,这也是我们的灵感。
No, that won't work. 不,那行不通。
HTTP runs over TCP, not UDP. HTTP通过TCP而不是UDP运行。 Punching a UDP hole doesn't do you any good -- any TCP connection to the backend HTTP server will still fail.
刺破UDP漏洞对您没有任何好处-与后端HTTP服务器的任何TCP连接仍将失败。
HTTP redirects are not magic. HTTP重定向不是魔术。 If a user cannot access a specific host:port, redirecting them to a URL on that host:port will just make their browser time out when it requests that URL.
如果用户无法访问特定的host:port,则将其重定向到该host:port上的URL只会使他们的浏览器在请求该URL时超时。
You cannot send a response from a different host:port from what the browser requested, because there is no TCP connection established with that endpoint. 您无法从浏览器请求的主机,端口发送响应,因为没有与该端点建立TCP连接。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.