#tun-tap #tap #tun

tidy-tuntap

tidy-tuntap is a Rust wrapper for working with TUN/TAP devices in Linux

4 releases (2 breaking)

0.3.1 Apr 1, 2023
0.3.0 Dec 21, 2022
0.2.0 Sep 2, 2022
0.1.0 Jul 30, 2022

#9 in #tun-tap

MIT license

42KB
757 lines

tidy-tuntap is a Rust wrapper for working with TUN/TAP devices in Linux.

Examples

There are examples of using this crate in the examples folder which also act as tests. To run these examples you need to build them and set the cap_net_admin capability of each generated executable. There is a convenience shell script in the root folder of the project called run_examples.sh which you can execute to build and run all the examples. Feel free to inspect the contents of this script and all the examples before trying to running them.

Features

  • Multiqueue support
  • Async support
  • IPv6 support

lib.rs:

  • TUN/TAP provides packet reception and transmission for user space programs.
  • It can be seen as a simple Point-to-Point or Ethernet device, which,
  • instead of receiving packets from physical media, receives them from
  • user space program and instead of sending packets via physical media
  • writes them to the user space program.
  • This crate provides three different kinds of TUN/TAP devices:
  • NOTE: There is a device type corrospoding to each TUN/TAP type. You can't construct these
  • devices since they're only there to contain the shared code between TUN/TAP devices.

Dependencies

~3–15MB
~178K SLoC