Skip to content
浮生 edited this page Aug 3, 2018 · 9 revisions

Welcome to the tun2socks wiki!

dns mode

fake(default)

This mode worked with rules. Tun2socks created a dns server on 0.0.0.0:53. It will reply depend on rules. If a domain is proxied, the dns server will reply a faked ip, eg hijack www.google.com -> 198.18.26.133. And then all flow with faked ip will be redirected to socks5. And others will be routed to default gateway.

fake mode

udp_relay_via_socks5

This mode worked with route table, so rules are useless, it will use the default proxy for tcp, and udp proxy is the configed one. For example ip2socks/darwin_setup_utun.sh. If you set your system dns server to 8.8.8.8, and route it via proxy. Then all dns query will be redirected to socks5 udp tunnel.

NOTE: darwin does not support batch route. You can use the modify one, compiled version.

udp_relay_via_socks5 mode

android

  1. root you android device
  2. GOOS=linux GOARCH=arm GOARM=7 go build -o tun2socks cmd/main.go, edit GOARM for free.
  3. adb push tun2socks /data/local/tmp/ and adb push config.ini /data/local/tmp/
  4. start tun2socks
adb shell "su -c 'sleep 1'"
adb start-server

adb shell
cd /data/local/tmp/
./tun2socks -config=config.ini
  1. change your dns server to 127.0.0.1
  2. ok

Windows Vista and above, does not support windows xp

You must install tap-windows-9.21.2.exe first. And then start it with administrator command like tun2socks_windows_64.exe --config=config.ini.

NOTE: you must start cmd.exe with administrator.

Clone this wiki locally