Mirror of Go implementation of WireGuard.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Simon Rozman ac4944a708 wintun: Write exchange buffer increased back to 1MiB 23 hours ago
ratelimiter Extend structs rather than embed, when possible 2 weeks ago
replay Update copyright 2 weeks ago
rwcancel Extend structs rather than embed, when possible 2 weeks ago
tai64n tai64n: whiten nano seconds 2 weeks ago
tests Moved test-processes to background 1 year ago
tun wintun: Write exchange buffer increased back to 1MiB 23 hours ago
.gitignore Adopt GOPATH 9 months ago
COPYING Update copyright 2 weeks ago
Makefile Makefile: rename default to all 4 months ago
README.md Update copyright 2 weeks ago
allowedips.go Update copyright 2 weeks ago
allowedips_rand_test.go Update copyright 2 weeks ago
allowedips_test.go Update copyright 2 weeks ago
bind_test.go Update copyright 2 weeks ago
conn.go Extend structs rather than embed, when possible 2 weeks ago
conn_default.go conn: close ipv4 socket when ipv6 socket fails 2 weeks ago
conn_linux.go Change package path 3 days ago
constants.go Update copyright 2 weeks ago
cookie.go Extend structs rather than embed, when possible 2 weeks ago
cookie_test.go Update copyright 2 weeks ago
device.go Change package path 3 days ago
device_test.go Update copyright 2 weeks ago
donotuseon_linux.go Update copyright 2 weeks ago
endpoint_test.go Update copyright 2 weeks ago
go.mod Change package path 3 days ago
go.sum Bump dependencies for ARM ChaCha20 1 week ago
helper_test.go Change package path 3 days ago
indextable.go Extend structs rather than embed, when possible 2 weeks ago
ip.go Update copyright 2 weeks ago
kdf_test.go Update copyright 2 weeks ago
keypair.go Change package path 3 days ago
logger.go Update copyright 2 weeks ago
main.go Change package path 3 days ago
main_windows.go Change package path 3 days ago
mark_default.go Update copyright 2 weeks ago
mark_unix.go Update copyright 2 weeks ago
misc.go Extend structs rather than embed, when possible 2 weeks ago
noise-helpers.go noise: store clamped key instead of raw key 2 weeks ago
noise-protocol.go Change package path 3 days ago
noise-types.go noise: store clamped key instead of raw key 2 weeks ago
noise_test.go Update copyright 2 weeks ago
peer.go Extend structs rather than embed, when possible 2 weeks ago
pools.go Update copyright 2 weeks ago
queueconstants.go Update copyright 2 weeks ago
receive.go Extend structs rather than embed, when possible 2 weeks ago
send.go Extend structs rather than embed, when possible 2 weeks ago
timers.go Extend structs rather than embed, when possible 2 weeks ago
tun.go Change package path 3 days ago
uapi.go uapi: Simpler function signature 2 weeks ago
uapi_bsd.go Update copyright 2 weeks ago
uapi_linux.go Change package path 3 days ago
uapi_windows.go Import windows scafolding 2 weeks ago
version.go Fix up errors and paths 2 weeks ago

README.md

Go Implementation of WireGuard

This is an implementation of WireGuard in Go.

WARNING: This is a work in progress and not ready for prime time, with no official “releases” yet. It is extremely rough around the edges and leaves much to be desired. There are bugs and we are not yet in a position to make claims about its security. Beware.

Usage

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

$ wireguard-go 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-go shutting down.

To run wireguard-go without forking to the background, pass -f or --foreground:

$ wireguard-go -f wg0

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

To run with more logging you may set the environment variable LOG_LEVEL=debug.

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.

macOS

This runs on macOS using the utun driver. It does not yet support sticky sockets, and won’t support fwmarks because of Darwin limitations. Since the utun driver cannot have arbitrary interface names, you must either use utun[0-9]+ for an explicit interface name or utun to have the kernel select one for you. 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.

Windows

It is currently a work in progress to strip out the beginnings of an experiment done with the OpenVPN tuntap driver and instead port to the new UWP APIs for tunnels. In other words, this does not yet work on Windows.

FreeBSD

This will run on FreeBSD. It does not yet support sticky sockets. Fwmark is mapped to SO_USER_COOKIE.

OpenBSD

This will run on OpenBSD. It does not yet support sticky sockets. Fwmark is mapped to SO_RTABLE. Since the tun driver cannot have arbitrary interface names, you must either use tun[0-9]+ for an explicit interface name or tun to have the program select one for you. If you choose tun 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.

Building

This requires an installation of go ≥ 1.11.

$ git clone https://git.zx2c4.com/wireguard-go
$ cd wireguard-go
$ make

License

Copyright (C) 2017-2019 WireGuard LLC. All Rights Reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.