firstboot / rein

This program is used to efficiently redirect connections(TCP proxy to redirect) from one IP address/port combination to another. It is useful when operating virtual servers, dockers, firewalls and the like. Simple deployment. It creates a tunnel from a public endpoint to a locally running service.It was developed by golang.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

rein rein

| English | 中文 |

| Commit Log |

Introduction

This program is used to efficiently redirect connections from one IP address/port combination to another.

It is useful when operating virtual servers, dockers, firewalls and so on.

It creates a tunnel from a public endpoint to a locally running service (version >= 1.0.5). It was developed by golang.

  • rein support mode:
mode tip
upstream It is used to efficiently redirect connections from one IP address/port combination to another.
fileshare local files publishing.
inps It creates a tunnel from a public endpoint to a locally running service. Put inps onto your server with public IP. (version >= 1.0.5)
inpc It creates a tunnel from a public endpoint to a locally running service. Put inpc onto your server in LAN (that can't be connected from public Internet). (version >= 1.0.5)
  • inps and inpc mode illustration:

mode-inps-inc


1. Download by your OS

All release download: https://github.com/firstboot/rein/releases

1.1 Download

  • 1.1.1 Download by CentOS/RHEL/Ubuntu (amd64)
cd ~
wget \
https://github.com/firstboot/rein/releases/download/v1.0.6-bin/rein-1.0.6-amd64-linux.zip
unzip rein-1.0.6-amd64-linux.zip
mv rein-1.0.6-amd64-linux rein
chmod +x rein

2. Simple deployment

2.1 Specify required functions

  • Which mode do you want to use ?
mode tip
upstream It is used to efficiently redirect connections from one IP address/port combination to another.
fileshare local files publishing.
inps/inpc It creates a tunnel from a public endpoint to a locally running service. (server/client endpoint) (version >= 1.0.5)

2.2 Function mode tip

Tip: OS description of operating differences, CentOS/RHEL/Ubuntu will be used by default in subsequent instructions. 2.2.1 will still introduce them separately.

# show all mode, CentOS/RHEL/Ubuntu, eg: upstream
./rein -e-detail
./rein -e-detail-upstream

# generate config file, CentOS/RHEL/Ubuntu, eg: upstream
./rein -e-detail-upstream > rein.json

#####################################################

# show all mode, Windows, eg: upstream
./rein.exe -e-detail
./rein.exe -e-detail-upstream

# generate a mode conf file, eg: upstream
# Windows cmd 
./rein.exe -e-detail-upstream > rein.json

# Windows powershell, eg: upstream
./rein.exe -e-detail-upstream | out-file -encoding ascii rein.json
  • 2.2.1 How to use mode upstream?

    Use -e-detail-xxx option, generate config and running.

    • CentOS/RHEL/Ubuntu

      • # show all mode
        ./rein -e-detail
        Enter a mode, show specific example, as follow:
        -e-detail-upstream
        -e-detail-inps
        -e-detail-inpc
        -e-detail-fileshare
        
        # generate a mode conf file, eg: upstream
        ./rein -e-detail-upstream > rein.json
        
        # rein.json, modify rein.json for you
        {
        	"upstream": [
        		{"source": "0.0.0.0:8150", "target": "127.0.0.1:9990"}
        	]
        }
        
        # running
        ./rein -c rein.json
    • Windows

      • # show all mode
        ./rein.exe -e-detail
        Enter a mode, show specific example, as follow:
        -e-detail-upstream
        -e-detail-inps
        -e-detail-inpc
        -e-detail-fileshare
        
        # generate a mode conf file, eg: upstream
        # windows cmd 
        ./rein.exe -e-detail-upstream > rein.json
        
        # windows powershell
        ./rein.exe -e-detail-upstream | out-file -encoding ascii rein.json
        
        # rein.json, modify rein.json for you
        {
        	"upstream": [
        		{"source": "0.0.0.0:8150", "target": "127.0.0.1:9990"}
        	]
        }
        
        # running
        ./rein.exe -c rein.json
  • 2.2.2 How to use mode fileshare?

    # show default config
    ./rein -e-detail-fileshare
    {
    	"fileshare": [
    		{"port": "9990", "path": "."}
    	]
    }
    
    # generate a mode conf file
    ./rein -e-detail-fileshare > rein.json
    
    # rein.json, modify rein.json for you
    {
    	"fileshare": [
    		{"port": "9990", "path": "."}
    	]
    }
    
    # running
    ./rein -c rein.json
  • 2.2.3 How to use mode inps/inpc?

    If you have a server(A) public IP is 52.74.223.119 , and you have a server(B) private IP is 192.168.1.122.

    Put inps onto your server A with public IP. Put inpc onto your server B in LAN (that can't be connected from public Internet).

    illustration:

    example-inps-inpc

    deploy: inps

    Put inps onto your server A with public IP.

    # generate a mode conf file
    ./rein -e-detail-inps > rein.json
    
    # rein.json, modify rein.json for you
    {
    	"inps": [
    		{"ctrl": "0.0.0.0:17500"}
    	]
    }
    
    # running
    ./rein -c rein.json

    deploy: inpc

    Put inpc onto your server B in LAN (that can't be connected from public Internet).

    # generate a mode conf file
    ./rein -e-detail-inpc > rein.json
    
    # rein.json, modify rein.json for you
    # port 17500 is 'inps' server port
    # port 22 is local host service port, this port is ssh
    # port 9800 is 'inps' server open port
    {
    	"inpc": [
    		{
    			"ctrl": "52.74.223.119:17500",
    			"source": "0.0.0.0:9800",
    			"target": "127.0.0.1:22"
    		}
    	]
    }
    
    # running
    ./rein -c rein.json

    query: inpq (verion 1.0.6+)

    Get current inps link status.

    # get inps link status, x.x.x.x:17500 is inps ip addr.
    ./rein -inpq x.x.x.x:17500
    0.0.0.0:9800/127.0.0.1:22, online

About

This program is used to efficiently redirect connections(TCP proxy to redirect) from one IP address/port combination to another. It is useful when operating virtual servers, dockers, firewalls and the like. Simple deployment. It creates a tunnel from a public endpoint to a locally running service.It was developed by golang.

License:MIT License


Languages

Language:Go 97.3%Language:Makefile 2.5%Language:Batchfile 0.2%