Tokio TUN/TAP
Asynchronous allocation of TUN/TAP devices in Rust using tokio
. Use async-tun for async-std
version.
Getting Started
- Create a tun device using
TunBuilder
and read from it in a loop:
use Ipv4Addr;
use AsRawFd;
use *;
use Result;
use TunBuilder;
async
- Run the code using
sudo
:
- Set the address of device (address and netmask could also be set using
TunBuilder
):
- Ping to read packets:
- Display devices and analyze the network traffic:
➜ ip tuntap
➜ sudo tshark -i <tun-name>
Supported Platforms
- Linux
- FreeBSD
- Android
- OSX
- iOS
- Windows