Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
B

boringtun

> 编程语言
Open source

Userspace WireGuard® Implementation in Rust

7.2K stars0 likes0 views
WebsiteGitHub

About

Userspace WireGuard® Implementation in Rust

BoringTun

Warning

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:
  • boringtun-cli

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.

Installation

You can install this project using cargo:

cargo install boringtun-cli

Building

  • 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 ..

Running

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:

sudo WG_QUICK_USERSPACE_IMPLEMENTATION=boringtun-cli WG_SUDO=1 wg-quick up CONFIGURATION

Testing

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
x86_64-unknown-linux-gnu ✓ ✓
aarch64-unknown-linux-gnu ✓ ✓
armv7-unknown-linux-gnueabihf ✓ ✓
x86_64-apple-darwin ✓ ✓
x86_64-pc-windows-msvc ✓
aarch64-apple-ios ✓
armv7-apple-ios ✓
armv7s-apple-ios ✓
aarch64-linux-android ✓
arm-linux-androideabi ✓

Other platforms may be added in the future

Linux

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.

macOS

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.

License

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

Contribution

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.

Issues· 109 open

View all issuesOpen on GitHub
  • #495

    0.7.1 regression: sessions go one-way deaf ~15-30s after handshake (0.6.0 stable)

    Updated Aug 29, 2026
  • #494

    Data packets are not padded to 16 bytes (RFC/WireGuard whitepaper §5.4.6), exposing exact inner packet lengths

    Updated Aug 20, 2026
  • #309

    Keeping timers relative to start of tunnel initiation is confusing

    good first issuecode qualityUpdated Aug 10, 2026
  • #493

    Persistent keepalive waits a full interval before the initial send

    Updated Jul 21, 2026
  • #447

    Latest handshake 55 years, 258 days, 13 hours, 48 minutes, 5 seconds ago

    Updated Jul 5, 2026
  • #481

    Static compilation on Android

    Updated May 15, 2026
  • #470

    All supported platforms should be built and tested in CI

    Updated Apr 25, 2026
  • #352

    Slow work during testing on VM

    Updated Jan 13, 2026
  • #357

    Decapsulate error InvalidCounter (not a huge problem, just curious why it happens and whether I should worry)

    Updated Jan 3, 2026
  • #379

    Failed to initialize tunnel, error: Socket kind: NotFound

    Updated Oct 22, 2025

> Tags

Rustcloudflarerustwireguard

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 22, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言