11

GO内网穿透,可以让全世界访问家用电脑里的网站。

 3 years ago
source link: https://studygolang.com/articles/32402
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

GO内网穿透,可以让全世界访问家用电脑里的网站。

mb5fe5608dce902 · 大约5小时之前 · 35 次点击 · 预计阅读时间 1 分钟 · 不到1分钟之前 开始浏览    

GO内网穿透,可以让全世界访问家用电脑里的网站。

特点:

  • 基于go开发。

在这里: 有时间学学~... ...

一:原理及使用方法

原理:client运行在家用电脑,内装有自己的网站。user为访问网站的浏览器。 

图片

使用方法:

1、配置好go语言环境

2、把server.go上传到公网服务器上。

运行例子:go run server.go -localPort 3002 -remotePort 20012(如下图) localPort端口为用户访问的端口,remotePort端口为与client通讯的端口。

图片

3、把client.go放在家用电脑上(无公网ip,只能家用电脑80端口可以访问到本地的网站)。

运行例子go run client.go -host 服务器ip -localPort 80 -remotePort 20012(如下图) localPort端口为家用电脑网站的端口,remotePort端口为与server通讯的端口,与server端设置必须一致

图片

4、全世界任何浏览器访问公网

ip:3002即可访问到家用电脑中的网站。(如服务器ip为1.1.1.1则访问1.1.1.1:3002)(如下图) 图片

二:如何一起学习,免费下载使用?

        [email protected]:wapai/chuantou.git

扫码加关注:itcode,免费领取源码/资料

图片

优质源码,大家喜欢

   【写著说明】以上内容分享给喜欢编程,有梦想的程序员们,希望能够帮助到你们。以上文章属于此公众号原创所有,如需转载请注明出处。

 【免责申明】本公众平台不是广告商,也没有为其他三方网站或者个人做广告宣传。此分享的源代码和文章是小编在项目中、学习中整理的一些认为不错的项目。用户产生的一些自愿下载或者付费行为。与平台没有直接关系。


有疑问加站长微信联系(非本文作者)

280

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK