#wireguard #interface #embeddable #safe #jason #secure #donfeld

bin+lib wireguard-embeddable

An embeddable wireguard library that wraps the C implementation by Jason Donfeld. Allows interacting with the kernel-land wireguard native implementation from Rust to create, modify, delete, or view wireguard interfaces or statistics. The intended 1.0, stable, and safe release is Q1 2022.

4 releases

0.1.3 Dec 28, 2021
0.1.2 Dec 28, 2021
0.1.1 Dec 28, 2021
0.1.0 Dec 28, 2021

#32 in #wireguard

LGPL-2.1-or-later

74KB
2.5K SLoC

C 1.5K SLoC // 0.0% comments Rust 820 SLoC // 0.0% comments

wg-rust

Since this is a work in progress, I recommend looking at:

This project provides rust bindings to the embeddable-wg-library provided by Jason Donfeld as part of his wireguard-tools.

The point of the embeddable library is to be included in an application application which adds, modifies, removes, monitors, updates, or otherwise manages wireguard interfaces as part of its normal operation.

The library does not implement a user or kernel space wireguard implementation. For that, you want the system wireguard (apt install wireguard) or user-space rust implementation (boringtun).

This does provide rust-friendly bindings to the user-side C code that interacts with the kernel via ipc calls. This allows you to interact with the kernel-space wireguard implementation, just like wg-quick or the other tools do. Since we use Jason Donfeld's code directly, it is expected to be blazing fast, secure, and error-free.

Building

It should build fine with cargo build.

Status

This is a work in progress. Currently unsafe wrappers are generated with bindgen, and the library is built using cc (see build.rs).

The next steps are to generate safe rust interfaces and to make the layout and naming more idomatic. As such, until this reaches around a 1.0 release, I'd consider anything but the unsafe interfaces to be subject to rapid iteration.

Copyright & Trademarks

"Wireguard" is a registered trademark of Jason Donfeld, and is not associated with, or necessarily endorsing of this project.

All code is copyright 2021 Joshua Vander Hook, AENAC Devices.

You may use this code freely under the MIT Licsense for personal use, and we welcome any patches or contribtuions.

No runtime deps

~0–2MB
~37K SLoC