rein 介绍
rein 主要用于进行反向代理 IP 地址和端口,功能类似于 Nginx 的 upstream 模式和rinetd的功能,由于rein使用了golang语言开发,并且提供已经编译好的可下载版本,在部署配置方面比它们要方便些。
功能列表:
模式 | 说明 |
---|---|
`upstream` | 反向代理模式 |
`fileshare` | 提供本地文件的快速网络(`http`协议)分享 |
`inps` | 内网穿透的服务器端,`inps` 需要部署在有公网地址服务器上(版本 >= 1.0.5) |
`inpc` | 内网穿透的客户机端,`inpc` 部署在能访问互联网,没有公网 IP 地址的 PC 或服务器上(版本 >= 1.0.5) |
inps 和 inpc 模式图解:
1. 简单快速部署
已经编译好的版本下载地址:
https://note.youdao.com/ynoteshare1/index.html?id=b1e1ad270ba1b1af97ebdf3e2c8b7403&type=note
下载 rein-amd64-linux-x.x.x.zip
如果您的 Linux 具备公网下载功能,可以直接通过下面的命令进行下载使用:
cd ~ wget http://note.youdao.com/yws/public/resource/b1e1ad270ba1b1af97ebdf3e2c8b7403/xmlnote/0AD1EF713B9A428D86631C7282A1B04F/27232 -O rein.zip # 需要安装 unzip unzip rein.zip mv rein-*-linux rein chmod +x rein ./rein -e > rein.json # modify rein.json for you ./rein -c rein.json
使用您的浏览器下载
https://note.youdao.com/ynoteshare1/index.html?id=b1e1ad270ba1b1af97ebdf3e2c8b7403&type=note
rein-amd64-windows-x.x.x.zip并解压它。
# 解压后先改名 ren rein-1.0.3-amd64-win.exe rein.exe # generate default conf 'rein.json' # 使用 cmd 时 ./rein.exe -e > rein.json # 使用 powershell 时 ./rein.exe -e | out-file -encoding ascii rein.json
{ upstream: [ {source: 0.0.0.0:8150, target: 127.0.0.1:9991} ], fileshare: [ {port: 9991, path: .} ] }
./rein.exe -c rein.json
2. 配置文件说明
upstream 模式主要由 source 和 target
构成,实现的功能就是将主机上的某个IP地址与端口,映射到其他的主机(本机)和端口上。在 upstream 模式下,支持多组由 source 和
target 构成的映射对。source 是监听 IP 和端口,target是需要转发到的 IP 和端口。
举例说明:
{ upstream: [ {source: 0.0.0.0:8150, target: 127.0.0.1:9991} ] }
此模式类似于ftp功能,能快速将本地资源进行网络(http方式)发布,它由port和path构成。port是要开放的端口,path是本地资源的路径。类似地,这个功能也支持多组。
举例说明:
{ fileshare: [ {port: 9991, path: /home/lz} ] }
rein 官网
https://github.com/firstboot/rein
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。