Skip to content

Latest commit

 

History

History
61 lines (39 loc) · 1.04 KB

README.md

File metadata and controls

61 lines (39 loc) · 1.04 KB

Go ToyVpn

implement ToyVpn in native golang shared libraries.

Different between original ToyVpn

  1. call native golang shared library
  2. go through TCP, not UDP

Build

for apk:

$ cd jni/ $ sh build.sh $ cd .. $ ./gradlew build --info

apk file will at: build/outputs/apk/

for server:

$ cd server/golang/ $ git clone https://github.com/songgao/water.git $ go build server.go

Run

1. setting TUN interface

# Enable IP forwarding
echo 1 > /proc/sys/net/ipv4/ip_forward

# Pick a range of private addresses and perform NAT over eth0.
iptables -t nat -A POSTROUTING -s 10.0.0.0/8 -o eth0 -j MASQUERADE

# Create a TUN interface.
tunctl -n -t tun2

# Set the addresses and bring up the interface.
ifconfig tun2 10.0.0.0/8 up

2. start server

# Create a server on port 23456 with shared secret "test123456".
cd server/golang/
./server -bind ":23456" -tun tun2 -m 1400 -s test123456

3. connect to server by app

TODO

  • fix buggy Android log
  • show current status and notification