Registry / networking / tokio-tun

tokio-tun

JSON →
library0.15.2rscratesunverified

Asynchronous allocation and management of TUN/TAP devices using the Tokio runtime.

# Cargo.toml [dependencies] tokio-tun = "0.15.2"
INSTALL
IMPORT
SIG · TOKIO-TUN
T
tokio-tun
networkingrustv0.15.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Tun
use tokio_tun::Tun;

Creates a TUN device and reads a packet asynchronously.

use tokio_tun::Tun; #[tokio::main] async fn main() -> Result<(), Box<dyn std::error::Error>> { let mut tun = Tun::new("tun0", 1500).await?; let mut buf = vec![0u8; 1500]; let n = tun.recv(&mut buf).await?; println!("Received {} bytes", n); Ok(()) }
Debug
Known issues
gotchaRequires root/administrator privileges to create TUN/TAP devices.
fix
Run the binary with sudo or appropriate capabilities.
affects: >=0.15.0
breakingOnly works on Unix-like systems (Linux, macOS, BSD).
fix
Use conditional compilation or alternative for Windows.
affects: >=0.15.0
Upgrade
Version history
0.15.2latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
56 hits · last 30 days
node
50
OpenAI (training)
1
Resources
tokio-tun — cargo add tokio-tun · libregistry