跳到正文

BoringTun

维护中
cloudflare/boringtun

用 Rust 编写的用户态 WireGuard® 实现,注重可移植性和速度。

在 GitHub 查看
星标
7216
Fork
533
关注
7216
未关闭 Issue
109

该介绍目前仅提供英文版本。

BoringTun

BoringTun is a high-performance, userspace implementation of the WireGuard® protocol written in Rust. It’s designed for portability and speed, making it an ideal choice for various platforms including iOS, Android, and Linux servers.

Core Features

  • High Performance: Optimized Rust implementation for maximum speed
  • Cross-Platform: Supports multiple architectures and operating systems
  • Security Focused: Implements the WireGuard protocol with security in mind
  • Userspace Implementation: Runs entirely in userspace for better portability
  • Minimal Dependencies: Lightweight and easy to deploy
  • FFI Support: Provides C ABI bindings for integration with other languages
  • JNI Bindings: Java Native Interface support for Android integration

Supported Platforms

Platform Architecture Binary Library
Linux x86_64 ✓ ✓
Linux aarch64 ✓ ✓
Linux armv7 ✓ ✓
macOS x86_64 ✓ ✓
Windows x86_64 ✓ -
iOS aarch64 ✓ -
iOS armv7 ✓ -
Android aarch64 ✓ -
Android arm ✓ -

Quick Start

  1. Installation:

    cargo install boringtun-cli
  2. Building:

    # Library only
    cargo build --lib --no-default-features --release
    
    # Executable
    cargo build --bin boringtun-cli --release
  3. Running:

    # Basic usage
    boringtun-cli [-f/--foreground] INTERFACE-NAME
    
    # With wg-quick
    sudo WG_QUICK_USERSPACE_IMPLEMENTATION=boringtun-cli WG_SUDO=1 wg-quick up CONFIGURATION

Development

  1. Requirements:

    • Rust toolchain
    • sudo (for testing)
    • Docker (for testing)
  2. Testing:

    cargo test
  3. Contributing:

    • Fork the repository
    • Create a feature branch
    • Submit a pull request
    • Follow the contribution guidelines

Integration

  1. C/C++ Integration:

    #include "wireguard_ffi.h"
    // Use the C ABI bindings
  2. Swift Integration:

    // Use bridging header with C bindings
  3. C# Integration:

    [DllImport("boringtun", CallingConvention = CallingConvention.Cdecl)]
    // Use DLLImport

Security Considerations

  • Privilege Dropping: Drops privileges when started
  • CAP_NET_ADMIN: Requires capability for network operations
  • Fwmark Support: Optional fwmark setting with proper privileges
  • Interface Naming: Follows platform-specific conventions

Community

  • Issues: Report bugs and request features on GitHub
  • Contributions: Pull requests are welcome
  • Documentation: Detailed documentation available
  • Support: Community support through GitHub

License

This project is licensed under the BSD-3-Clause License - see the LICENSE file for details.


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

按共同分类和标签排序的同类开源项目。

全部网络项目 →