Crate tun_tap[][src]

A TUN/TAP bindings for Rust.

This is a basic interface to create userspace virtual network adapter.

For basic usage, create an Iface object and call the send and recv methods.

You can also use Async if you want to integrate with tokio event loop. This is configurable by a feature (it is on by default).

Creating the devices requires CAP_NETADM privileges (most commonly done by running as root).

Known issues

  • It is tested only on Linux and probably doesn't work anywhere else, even though other systems have some TUN/TAP support. Reports that it works (or not) and pull request to add other sustem's support are welcome.
  • The Async interface is very minimal and will require extention for further use cases and better performance.
  • This doesn't support advanced usage patters, like reusing already created device or creating persistent devices. Again, pull requests are welcome.
  • There are no automated tests. Any idea how to test this in a reasonable way?



Integration of TUN/TAP into tokio.



The virtual interface.



The mode in which open the virtual network adapter.