GithubHelp home page GithubHelp logo

dns_tunnel's Introduction

A simple DNS tunnel based on WebSocket

I write this to fix DNS pollution in China:

DNS query <--> client <--> WebSocket <--> server <--> DNS server

Deploy on your server

go get -u github.com/gorilla/websocket
cd server
go build
./server -p 9999

Now it's listening on localhost 9999, next to config nginx, add a location for it:

location /shining_tunnel {
    proxy_pass http://127.0.0.1:9999;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
}

Please use HTTPS, not only for security, but also to avoid possible breakage caused by ISP's performance tuning on HTTP.

Deploy on Heroku

Clone this branch, then push:

git push heroku go:master

Deplay on OpenShift

OpenShift does not support outgoing raw socket, so this program won't work, don't waste your time.

Run client

Very simple:

cd client
go build
./client -c wss://your-app-name.herokuapp.com -p 12345
$ dig +short twitter.com @127.0.0.1 -p 12345
199.59.150.7
199.59.149.230
199.59.150.39
199.59.149.198

Or you can use multiple server:

./client -c wss://a.com/tunnel,wss://b.com/tunnel -p 12345,12346

Running inside docker containers

Building a docker image

$ docker build -t dnstunnel:latest .

Running as a server

$ docker run -d --name=dserver -P dnstunnel:latest

Please follow instructions above to set up nginx as an SSL termination. To make fixed port mappings either on server or client, replace -P/--publish-all with -p/--publish option. Otherwise you need to run docker port to figure out which port is actually listen on the host.

dns_tunnel's People

Contributors

radaiming 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.