5 releases

Uses old Rust 2015

0.1.4 Aug 6, 2023
0.1.3 Aug 5, 2022
0.1.2 Aug 9, 2018
0.1.1 Mar 24, 2018
0.1.0 Dec 3, 2017

#962 in Network programming

Download history 1304/week @ 2024-06-19 857/week @ 2024-06-26 979/week @ 2024-07-03 1563/week @ 2024-07-10 968/week @ 2024-07-17 1634/week @ 2024-07-24 830/week @ 2024-07-31 1283/week @ 2024-08-07 881/week @ 2024-08-14 1540/week @ 2024-08-21 1287/week @ 2024-08-28 998/week @ 2024-09-04 938/week @ 2024-09-11 936/week @ 2024-09-18 716/week @ 2024-09-25 1187/week @ 2024-10-02

3,931 downloads per month
Used in 11 crates

Apache-2.0/MIT

21KB
222 lines

TunTap

Travis Build Status

TUN/TAP wrapper for Rust.

The TUN/TAP allows implementing a virtual network adapter in userspace. This provides the bindings for Rust.

Create an Iface object and send or recv packets. Making some sense of the packets is, however, out of scope, you need something else for that.

There's documentation and some examples.

Known issues

  • Tested only on Linux. Probably doesn't work anywhere else, but pull requests adding support for other OSes are welcome.
  • The asynchronous interface is very minimal and probably inefficient. It'll need to be extended to allow more flexible or efficient use.

Testing

In order to run the tests correctly, a tun10 device with 10.10.10.1/24 needs to be created first. You can simply run:

sh tests/setup.sh

To remove it:

sh tests/clean.sh

Sudo permission is required.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~0–1.4MB
~22K SLoC