Need help with gotunnel?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

524 Stars 134 Forks MIT License 119 Commits 4 Opened issues


tcp tunnel

Services available


Need anything else?

Contributors list

Build Status


gotunnel is a secure tcp tunnel software. It can use tcp or udp connectioin as low level tunnel.

gotunnel could be added to any c/s system using tcp protocol. Make system structure evolve from

client  server
client  gotunnel  gotunnel  server
to gain gotunnel's valuable features, such as secure and persistent.


go install


usage: bin/gotunnel
  -backend string
        backend address (default "")
  -listen string
        listen address (default ":8001")
  -log uint
        log level (default 1)
  -secret string
        tunnel secret (default "the answer to life, the universe and everything")
  -timeout int
        tunnel read/write timeout (default 3)
  -tunnels uint
        low level tunnel count, 0 if work as server

some options: * secret: for authentication and exchanging encryption key * tunnels: 0 means gotunnel will and as server; Any value larger than 0 means gotunnel will work as client, and build tunnels tcp connections to server. * timeout: if can't read a packet body in timeout seconds, will recreate this tunnel. It's useful if theres is a critical firewall between gotunnel client and server.


Suppose you have a squid server, and you use it as a http proxy. Usually, you will start the server:

$ squid3 -a 8080
and use it on your pc:
curl --proxy server:8080
It works fine but all traffic between your server and pc is plaintext, so someone can monitor you easily. In this case, gotunnel could help to encrypt your traffic.

First, on your server, resart squid to listen on a local port, for example Then start gotunnel server listen on 8080 and use as backend.

$ ./gotunnel -listen=:8001 -backend= -secret="your secret" -log=10 
Second, on your pc, start gotunnel client:
$ ./gotunnel -tunnels=100 -listen="" -backend="server:8001" -secret="your secret" -log=10 

Then you can use squid3 on you local port as before, but all your traffic is encrypted.

Besides that, you don't need to create and destory tcp connection between your pc and server, because gotunnel use long-live tcp connections as low tunnel. In most cases, it would be faster.


The MIT License (MIT)

Copyright (c) 2015 xjdrew

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.