• Stars
    star
    465
  • Rank 94,287 (Top 2 %)
  • Language
    Rust
  • License
    MIT License
  • Created over 7 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Mirror only. Official repository is at https://git.zx2c4.com/wireguard-rs

Rust Implementation of WireGuard

Usage

Most Linux kernel WireGuard users are used to adding an interface with ip link add wg0 type wireguard. With wireguard-rs, instead simply run:

$ wireguard-rs wg0

This will create an interface and fork into the background. To remove the interface, use the usual ip link del wg0, or if your system does not support removing interfaces directly, you may instead remove the control socket via rm -f /var/run/wireguard/wg0.sock, which will result in wireguard-rs shutting down.

When an interface is running, you may use wg(8) to configure it, as well as the usual ip(8) and ifconfig(8) commands.

Platforms

Linux

This will run on Linux; however YOU SHOULD NOT RUN THIS ON LINUX. Instead use the kernel module; see the installation page for instructions.

Windows

Coming soon.

FreeBSD

Coming soon.

OpenBSD

Coming soon.

Building

The wireguard-rs project is targeting the current nightly (although it should also build with stable Rust).

To build wireguard-rs (on supported platforms):

  1. Obtain nightly cargo and rustc through rustup
  2. Clone the repository: git clone https://git.zx2c4.com/wireguard-rs.
  3. Run cargo build --release from inside the wireguard-rs directory.

Architecture

This section is intended for those wishing to read/contribute to the code.

WireGuard Rust has a similar separation of concerns as many other implementations of various cryptographic transports: separating the handshake code from the packet protector. The handshake module implements an authenticated key-exchange (NoiseIK), which provides key-material, which is then consumed by the router module (packet protector) responsible for the actual encapsulation of transport messages (IP packets). This is illustrated below:

Structure

More Repositories

1

wireguard-go

Mirror only. Official repository is at https://git.zx2c4.com/wireguard-go
Go
3,068
star
2

wireguard-monolithic-historical

Historical monolithic WireGuard repository, split into wireguard-tools, wireguard-linux, and wireguard-linux-compat.
C
2,320
star
3

wireguard-windows

Download WireGuard for Windows at https://www.wireguard.com/install . This repo is a mirror only. Official repository is at https://git.zx2c4.com/wireguard-windows
Go
1,794
star
4

wireguard-vyatta-ubnt

WireGuard for Ubiquiti Devices
Shell
1,458
star
5

wireguard-linux

Mirror only. Official repository is at https://git.zx2c4.com/wireguard-linux
C
1,211
star
6

wireguard-android

Mirror only. Official repository is at https://git.zx2c4.com/wireguard-android
Kotlin
1,032
star
7

wireguard-apple

Mirror only. Official repository is at https://git.zx2c4.com/wireguard-apple
Swift
947
star
8

wgctrl-go

Package wgctrl enables control of WireGuard interfaces on multiple platforms.
Go
742
star
9

wireguard-tools

Mirror only. Official repository is at https://git.zx2c4.com/wireguard-tools
C
464
star
10

wintun

Mirror only. Official repository is at https://git.zx2c4.com/wintun
C
414
star
11

wg-dynamic

Mirror only. Official repository is at https://git.zx2c4.com/wg-dynamic
C
328
star
12

wireguard-linux-compat

Mirror only. Official repository is at https://git.zx2c4.com/wireguard-linux-compat
C
94
star
13

wireguard-nt

This repo is a mirror only. Official repository is at https://git.zx2c4.com/wireguard-nt
C
89
star
14

android-wireguard-module-builder

Builder for WireGuard module for various Android kernels
Shell
62
star
15

wireguard-freebsd

Mirror only. Official repository is at https://git.zx2c4.com/wireguard-freebsd
C
45
star
16

android_kernel_wireguard

Mirror only. Official repository is at https://git.zx2c4.com/android_kernel_wireguard
Shell
38
star