#wireguard #tunnel #networking #protocols #portability #speed #boringtun

app boringtun-cli

an implementation of the WireGuard® protocol designed for portability and speed

3 unstable releases

0.6.0 Jul 7, 2023
0.5.2 Jul 20, 2022
0.5.1 Jul 14, 2022
0.5.0 Jul 12, 2022

#913 in Network programming

Download history 380/week @ 2023-12-14 251/week @ 2023-12-21 258/week @ 2023-12-28 290/week @ 2024-01-04 299/week @ 2024-01-11 316/week @ 2024-01-18 253/week @ 2024-01-25 308/week @ 2024-02-01 174/week @ 2024-02-08 263/week @ 2024-02-15 254/week @ 2024-02-22 280/week @ 2024-02-29 296/week @ 2024-03-07 221/week @ 2024-03-14 200/week @ 2024-03-21 164/week @ 2024-03-28

895 downloads per month



boringtun logo banner



Boringtun is currently undergoing a restructuring. You should probably not rely on or link to the master branch right now. Instead you should use the crates.io page.

  • boringtun: crates.io
  • boringtun-cli crates.io

BoringTun is an implementation of the WireGuard® protocol designed for portability and speed.

BoringTun is successfully deployed on millions of iOS and Android consumer devices as well as thousands of Cloudflare Linux servers.

The project consists of two parts:

  • The executable boringtun-cli, a userspace WireGuard implementation for Linux and macOS.
  • The library boringtun that can be used to implement fast and efficient WireGuard client apps on various platforms, including iOS and Android. It implements the underlying WireGuard protocol, without the network or tunnel stacks, those can be implemented in a platform idiomatic way.


You can install this project using cargo:

cargo install boringtun-cli


  • Library only: cargo build --lib --no-default-features --release [--target $(TARGET_TRIPLE)]
  • Executable: cargo build --bin boringtun-cli --release [--target $(TARGET_TRIPLE)]

By default the executable is placed in the ./target/release folder. You can copy it to a desired location manually, or install it using cargo install --bin boringtun --path ..


As per the specification, to start a tunnel use:

boringtun-cli [-f/--foreground] INTERFACE-NAME

The tunnel can then be configured using wg, as a regular WireGuard tunnel, or any other tool.

It is also possible to use with wg-quick by setting the environment variable WG_QUICK_USERSPACE_IMPLEMENTATION to boringtun. For example:



Testing this project has a few requirements:

  • sudo: required to create tunnels. When you run cargo test you'll be prompted for your password.
  • Docker: you can install it here. If you are on Ubuntu/Debian you can run apt-get install docker.io.

Supported platforms

Target triple Binary Library

Other platforms may be added in the future


x86-64, aarch64 and armv7 architectures are supported. The behaviour should be identical to that of wireguard-go, with the following difference:

boringtun will drop privileges when started. When privileges are dropped it is not possible to set fwmark. If fwmark is required, such as when using wg-quick, run with --disable-drop-privileges or set the environment variable WG_SUDO=1.

You will need to give the executable the CAP_NET_ADMIN capability using: sudo setcap cap_net_admin+epi boringtun. sudo is not needed.


The behaviour is similar to that of wireguard-go. Specifically the interface name must be utun[0-9]+ for an explicit interface name or utun to have the kernel select the lowest available. If you choose utun as the interface name, and the environment variable WG_TUN_NAME_FILE is defined, then the actual name of the interface chosen by the kernel is written to the file specified by that variable.

FFI bindings

The library exposes a set of C ABI bindings, those are defined in the wireguard_ffi.h header file. The C bindings can be used with C/C++, Swift (using a bridging header) or C# (using DLLImport with CallingConvention set to Cdecl).

JNI bindings

The library exposes a set of Java Native Interface bindings, those are defined in src/jni.rs.


The project is licensed under the 3-Clause BSD License.


Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the 3-Clause BSD License, shall be licensed as above, without any additional terms or conditions.

If you want to contribute to this project, please read our CONTRIBUTING.md.

WireGuard is a registered trademark of Jason A. Donenfeld. BoringTun is not sponsored or endorsed by Jason A. Donenfeld.


~412K SLoC