本文介绍了ngrok如何在防火墙后面工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Ngrok()应该允许您通过以下方式向全球网络公开本地端口和服务:转发。但是,如果我在本地机器上打开端口80,如下所示:

  ngrok 80 



我回来了:

 在线隧道状态
版本1.3 / 1.3
转发http://3a4bfceb.ngrok.com - > 127.0.0.1:80
转发https://3a4bfceb.ngrok.com - > 127.0.0.1:80
Web界面http://127.0.0.1:4040
#Conn 0
平均Conn时间0.00ms

据我所知,任何有关的请求将通过端口80转到我的本地计算机,但如果我坐在阻止传入通信的NAT /防火墙后面(非常常见),该怎么办? ngrok是否会启动轮询请求以确定何时收到数据? 客户端第一,这是它如何与服务器协商安全通道的方式。这是一个非常漂亮的解决方案,可以绕过传统的防火墙配置。



这是由客户端在内部完成的,它打开了一个单一的长寿命tcp连接,其中创建了许多逻辑套接字一个物理套接字连接。这种技术称为。通过这种设置,不需要任何种类的轮询,因为客户端和服务器仍然具有完全双向通信。

然后客户端和服务器停留以确保连接处于开放状态并正常工作,甚至在错误或丢失/关闭连接时重新连接。



有关更多信息,请参阅以下网址: a href =https://github.com/inconshreveable/ngrok/blob/master/docs/DEVELOPMENT.md =noreferrer> github.com上的开发者指南


Ngrok (https://ngrok.com/) is supposed to allow you to expose local ports and services to the world wide web through forwarding. But if I open port 80 on my local machine like this:

ngrok 80

and I get back:

Tunnel Status                 online
Version                       1.3/1.3
Forwarding                    http://3a4bfceb.ngrok.com -> 127.0.0.1:80
Forwarding                    https://3a4bfceb.ngrok.com -> 127.0.0.1:80
Web Interface                 http://127.0.0.1:4040
# Conn                        0
Avg Conn Time                 0.00ms

I understand that any requests to http://3a4bfceb.ngrok.com will go to my local machine on port 80 but what if I am sitting behind a NAT/Firewall that's blocking incoming traffic (a very common scenario). Does ngrok initiate polling requests to determine when data has been received?

解决方案

Because an ngrok tunnel is always initiated on the client-side first, this is how it can negotiate a secure channel with the server. It's a really slick solution to getting around conventional firewall configurations.

This is internally accomplished by the client opening up a single long-lived tcp connection where many logical sockets are created within one physical socket connection. This technique is called stream multiplexing. With this setup in place there is no need for any kind of polling because the client and server still have fully bi-directional communication in place.

The client and server then stay alive with a heartbeat mechanism that makes sure the connection is open and working appropriately and will even reconnect upon error or a lost/closed connection.

See this for more information: Developer Guide on github.com

这篇关于ngrok如何在防火墙后面工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-13 13:26