A simple VPN written in Go.
Go to file
2021-12-14 00:49:41 +08:00
common update route on mac 2021-12-14 00:49:41 +08:00
register fix 2021-05-14 18:20:54 +08:00
scripts add client global mode 2021-12-13 21:46:33 +08:00
tun update route on mac 2021-12-14 00:49:41 +08:00
udp add key auth 2021-10-18 17:19:55 +08:00
ws update log 2021-11-11 09:55:38 +08:00
.gitignore update 2021-04-26 13:02:59 +08:00
.travis.yml update ws lib 2021-11-10 16:50:50 +08:00
Dockerfile add proxy 2021-09-09 17:00:44 +08:00
go.mod update ws lib 2021-11-10 16:50:50 +08:00
go.sum update ws lib 2021-11-10 16:50:50 +08:00
LICENSE Add vtun 2020-10-27 22:17:50 +08:00
main.go add client global mode 2021-12-13 21:46:33 +08:00
README.md add client global mode 2021-12-13 21:46:33 +08:00

vtun

A simple VPN written in golang.

Travis Go Report Card image image

Features

  • VPN over udp
  • VPN over websocket

Usage

Usage of ./vtun:
  -c string
        tun interface CIDR (default "172.16.0.10/24")
  -k string
        key (default "6w9z$C&F)J@NcRfWjXn3r4u7x!A%D*G-")
  -l string
        local address (default ":3000")
  -p string
        protocol ws/wss/udp (default "wss")
  -s string
        server address (default ":3001")
  -P    enable pporf server on :6060
  -S    server mode
  -g    client global mode
  -o    enable data obfuscation

Build

sh scripts/build.sh

Client

sudo ./vtun-linux-amd64 -l=:3000 -s=server-addr:3001 -c=172.16.0.10/24 -k=123456

Client with global mode(routing all your traffic to server)

sudo ./vtun-linux-amd64 -l=:3000 -s=server-addr:3001 -c=172.16.0.10/24 -k=123456 -g

Server

sudo ./vtun-linux-amd64 -S -l=:3001 -c=172.16.0.1/24 -k=123456

Server setup on Linux

  1. Add TLS for websocket,reverse proxy server(3001) via nginx/caddy(443)

  2. Enable IP forwarding on server

  sudo echo 1 > /proc/sys/net/ipv4/ip_forward
  sudo sysctl -p
  sudo iptables -t nat -A POSTROUTING -s 172.16.0.0/24 -o ens3 -j MASQUERADE

Docker

Run client

docker run  -d --privileged --restart=always --net=host --name vtun-client netbyte/vtun -l :3000 -s server-addr:3001 -c 172.16.0.10/24 -k 123456

Run client with global mode

docker run  -d --privileged --restart=always --net=host --name vtun-client netbyte/vtun -l :3000 -s server-addr:3001 -c 172.16.0.10/24 -k 123456 -g

Run server

docker run  -d --privileged --restart=always --net=host --name vtun-server netbyte/vtun -S -l :3001 -c 172.16.0.1/24 -k 123456

Mobile client

Android

TODO

  1. support windows
  2. support IPv6