Giter Site home page Giter Site logo

tcp-tunnel's Introduction

tcp-tunnel

a tcp-tunnel implemented by golang.

It supports to forward any traffic through a tcp tunnel, regardless of the original protocol (like UDP, ARP, normal IP, etc). Besides, I create an interface for the tunnel, so we can easily apply QoS onto it.

usage example

create tcp tunnel

VM1 with ip 172.21.7.103:
root@vm1:~# ./tcptun
>>> debug warn                # set the debug level
>>> start 172.21.7.103        # the tcp tunnel daemon will listen on 172.21.7.103
>>> add t1 t2  172.21.7.102   # add a new tcp tunnel with local name t1, remote name t2, remote addr 172.21.7.102
VM2 with ip 172.21.7.102:
root@vm2:~# ./tcptun
>>> debug warn
>>> start 172.21.7.102
>>> add t2 t1  172.21.7.103

verify the setup

Link t1 is created automatically on vm1: 
root@vm1:~# ip link show dev t1
16: t1: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN mode DEFAULT group default qlen 500
    link/none

Link t2 is created automatically on vm2: 
root@vm2:~# ip link show dev t2
16: t2: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN mode DEFAULT group default qlen 500
    link/none
    
t1, t2 is a generic linux network interface, which can be used to apply QoS, route etc. 
    
On VM1:
ip add add 1.1.1.1/32 dev lo
ip route add 1.1.1.2/32 dev t1

On VM2: 
ip add add 1.1.1.2/32 dev lo
ip route add 1.1.1.1/32 dev t2

On VM1: 
ping 1.1.1.2 -I 1.1.1.1

On VM2:
ping 1.1.1.1 -I 1.1.1.2

tcp-tunnel's People

Contributors

wofanli avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.