rein 反向代理 IP 地址和端口 rein

agolangf • 1950 次点击    
这是一个分享于 的项目,其中的信息可能已经有所发展或是发生改变。
**rein** 主要用于进行反向代理IP地址和端口,功能类似于 `nginx` 的 `upstream` 模式和`rinetd` 的功能,由于`rein`使用了`golang`语言开发,并且提供已经编译好的可下载版本,在部署配置方面比它们要方便些。 功能列表: 1. 反向代理`IP`和端口。 2. 提供本地文件的快速网络(`http`模式)分享。 ### **1. 简单快速部署** #### _**1.1 CentOS/RHEL/Ubuntu 平台**_ 已经编译好的版本下载地址: [https://note.youdao.com/ynoteshare1/index.html?id=b1e1ad270ba1b1af97ebdf3e2c8b7403&amp;type=note](https://note.youdao.com/ynoteshare1/index.html?id=b1e1ad270ba1b1af97ebdf3e2c8b7403&amp;type=note) 下载 `rein-amd64-linux-x.x.x.zip` 如果您的 Linux 具备公网下载功能,可以直接通过下面的命令进行下载使用: <pre>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 &gt; rein.json # modify rein.json for you ./rein -c rein.json</pre> #### **_1.2 Windows 平台_** 使用您的浏览器下载 [https://note.youdao.com/ynoteshare1/index.html?id=b1e1ad270ba1b1af97ebdf3e2c8b7403&amp;type=note](https://note.youdao.com/ynoteshare1/index.html?id=b1e1ad270ba1b1af97ebdf3e2c8b7403&amp;type=note) `rein-amd64-windows-x.x.x.zip`并解压它。 使用下面的命令生成并修改 `rein.json` 配置文件 <pre># 解压后先改名 ren rein-1.0.3-amd64-win.exe rein.exe # generate default conf &#39;rein.json&#39; # 使用 cmd 时 ./rein.exe -e &gt; rein.json # 使用 powershell 时 ./rein.exe -e | out-file -encoding ascii rein.json</pre> 生成的默认配置文件如下: <pre>{ &#34;upstream&#34;: [ {&#34;source&#34;: &#34;0.0.0.0:8150&#34;, &#34;target&#34;: &#34;127.0.0.1:9991&#34;} ], &#34;fileshare&#34;: [ {&#34;port&#34;: &#34;9991&#34;, &#34;path&#34;: &#34;.&#34;} ] }</pre> 根据您的需要进行修改配置文件后,运行: <pre>./rein.exe -c rein.json</pre> ### **2. 配置文件说明** #### **_2.1 upstream 模式_** `upstream` 模式主要由 `source` 和 `target` 构成,实现的功能就是将主机上的某个IP地址与端口,映射到其他的主机(本机)和端口上。在 `upstream` 模式下,支持多组由 `source` 和 `target` 构成的映射对。`source` 是监听 IP 和端口,`target`是需要转发到的 IP 和端口。 举例说明: <pre>{ &#34;upstream&#34;: [ {&#34;source&#34;: &#34;0.0.0.0:8150&#34;, &#34;target&#34;: &#34;127.0.0.1:9991&#34;} ] }</pre> #### **_2.2 file share 模式_** 此模式类似于`ftp`功能,能快速将本地资源进行网络(`http`方式)发布,它由`port`和`path`构成。`port`是要开放的端口,`path`是本地资源的路径。类似地,这个功能也支持多组。 举例说明: <pre>{ &#34;fileshare&#34;: [ {&#34;port&#34;: &#34;9991&#34;, &#34;path&#34;: &#34;/home/lz&#34;} ] }</pre>
授权协议:
MIT
开发语言:
Google Go 查看源码»
操作系统:
跨平台
1950 次点击  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传