# BoringTun

BoringTun is an implementation of the [WireGuard® protocol](https://www.wireguard.com/protocol/) designed for portability and speed. It is written in [Rust](https://rust-lang.org/) and was originally published by Cloudflare.

In the Defguard ecosystem, BoringTun is an important building block for running WireGuard functionality in user space where a kernel implementation is unavailable, unsuitable, or not the preferred integration model. This makes it especially useful on platforms where portability and embedding matter.

The Defguard team uses a fork of the [original repository](https://github.com/cloudflare/boringtun) with the following changes:

* [Swift](https://www.swift.org/) bindings using [UniFFI](https://mozilla.github.io/uniffi-rs)
* cleaned-up code
* dependencies updated regularly

BoringTun is used by [wireguard-rs](https://github.com/defGuard/wireguard-rs), which serves as a foundation for Defguard Gateway, and by [Defguard Client](https://github.com/defGuard/client) for handling VPN tunnels on [macOS](https://www.apple.com/os/macos/).

In practice, this means BoringTun helps Defguard support WireGuard-based connectivity in environments where kernel-level WireGuard integration is not the default approach. It also allows the project to build platform-specific integrations on top of a shared Rust implementation.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.defguard.net/in-depth/boringtun.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
