项目作者: ooclab

项目描述 :
peer-to-peer tunnel tool
高级语言: Go
项目地址: git://github.com/ooclab/otunnel.git
创建时间: 2016-11-07T09:44:38Z
项目社区:https://github.com/ooclab/otunnel

开源协议:MIT License

下载


otunnel

otunnel is a simple safe tunnel for peer-to-peer

Build

simple build (RECOMMENDED):

  1. $ ./build-by-docker.sh

others:

  1. $ go get -v github.com/ooclab/otunnel
  2. $ export GOPATH=${GOPATH:-~/go}
  3. $ cd $GOPATH/src/github.com/ooclab/otunnel
  4. $ # use any of following commands to build otunnel
  5. $ make # normal build
  6. $ make static # build a static program
  7. $ go build -v # the go build
  8. $ gox # simple cross build, you should install gox first!

Platform Example

dd-wrt

Netgear WNDR4300 (Firmware: DD-WRT v3.0-r37882 std (11/30/18))

  1. GOOS=linux GOARCH=mips GOMIPS=softfloat go build -a -ldflags '-s -w'

Usage

Start a server at a public server ( example.com ):

  1. ./otunnel listen -d

Start a client (reverse forward):

  1. ./otunnel connect example.com:10000 -d -t r:LOCAL_HOST:LOCAL_PORT::REMOTE_PORT

Now, anyone can access your LOCAL_HOST:LOCAL_PORT by example.com:REMOTE_PORT.

SystemD

In the server side (listen a port) , create /etc/systemd/system/otunnel-listen.service :

  1. [Unit]
  2. Description=Otunnel Listen Service
  3. After=network.target
  4. [Service]
  5. Type=simple
  6. Restart=on-failure
  7. ExecStart=/usr/local/bin/otunnel listen :20000 -d -s THE_SECRET
  8. [Install]
  9. WantedBy=multi-user.target

start otunnel-listen service:

  1. systemctl start otunnel-listen

In the client side, create /etc/systemd/system/otunnel-connect.service :

  1. [Unit]
  2. Description=Otunnel Connect Service
  3. After=network.target
  4. [Service]
  5. Type=simple
  6. Restart=on-failure
  7. ExecStart=/usr/local/bin/otunnel connect YOUR_SERVER_IP:20000 -d -s THE_SECRET -t "r:127.0.0.1:22::50022"
  8. [Install]
  9. WantedBy=multi-user.target

start otunnel-connect service:

  1. systemctl start otunnel-connect

Docker

Run a server:

  1. docker run --rm -it --net=host ooclab/otunnel-amd64 /otunnel listen :10000 -d -s abc123

Run a client:

  1. docker run --rm -it --net=host ooclab/otunnel-amd64 /otunnel connect SERVER_IP:10000 -d -s abc123 -t 'f:127.0.0.1:10022:HOST_IP:HOST_PORT'

Document

Wiki / 手册

Download

Download

For example:

  1. wget http://dl.ooclab.com/otunnel/1.2.3/otunnel_linux_amd64.xz
  2. unxz otunnel_linux_amd64.xz
  3. chmod a+x otunnel_linux_amd64
  4. mv otunnel_linux_amd64 otunnel

Help

Please send issues to github.com/ooclab/otunnel/issues .

Other Projects

  • qtunnel
  • ngrok
  • frp
  • pagekite