tun

module
v0.0.0-...-b3e8d20 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 14, 2023 License: Apache-2.0

README

tun

This is a mini program that creates virtual IP using tun device and gvisor's user space stack.

Here is how it works:

client <-> tun <-> gvisor userspace TCP/IP stack <-> local webserver

Here is how to use it on MacOS:

make
# Will create a tun device utun5
sudo ./build/tun
# In a separate tab: bring up virtual device and routing rule that forwards all requests
# to any ip in subnet 10.0.0.1/24 to this utun5 device
sudo make tunup
# In a separate tab, spin up a web server using python
python3 -m http.server
# In a separate tab: hit the webserver via virtual IP
curl http://10.1.0.2:8000 -vvv
# Also works
curl http://10.1.0.3:8000 -vvv

Directories

Path Synopsis
cmd
tun
Lots of code and samples taken from here: https://github.com/tailscale/tailscale/blob/main/wgengine/netstack/netstack.go#L202 Copyright, etc, etc, etc.
Lots of code and samples taken from here: https://github.com/tailscale/tailscale/blob/main/wgengine/netstack/netstack.go#L202 Copyright, etc, etc, etc.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL