Go to file
Jason A. Donenfeld 711f929879 Fill out readme
2018-05-17 16:55:45 +02:00
ratelimiter Cleanup ratelimiter 2018-05-13 18:42:06 +02:00
rwcancel No more finalizer for rwcancel 2018-05-14 06:10:08 +02:00
tai64n global: Add SPDX tags and copyright header 2018-05-03 15:06:25 +02:00
tests Moved test-processes to background 2018-02-11 23:31:53 +01:00
xchacha20poly1305 global: Add SPDX tags and copyright header 2018-05-03 15:06:25 +02:00
.gitignore Add vendoring for Homebrew 2018-05-15 14:49:52 +02:00
allowedips_rand_test.go Fix refactoring mistakes 2018-05-15 06:28:42 +02:00
allowedips_test.go Better common bits function 2018-05-14 15:49:20 +02:00
allowedips.go Print utun name on darwin 2018-05-14 19:33:35 +02:00
bind_test.go global: Add SPDX tags and copyright header 2018-05-03 15:06:25 +02:00
build.cmd Align with go library layout 2018-02-04 16:08:26 +01:00
conn_default.go Look up route for every peer 2018-05-14 03:26:38 +02:00
conn_linux.go Cancelable netlink writes and better response correlation 2018-05-14 14:18:26 +02:00
conn.go Finer-grained start-stop synchronization 2018-05-16 22:20:15 +02:00
constants.go Rewrite timers and related state machines 2018-05-10 16:08:03 +02:00
cookie_test.go global: Add SPDX tags and copyright header 2018-05-03 15:06:25 +02:00
cookie.go Clean more 2018-05-14 12:27:29 +02:00
COPYING Initial scaffolding 2017-05-30 00:13:20 +02:00
device_test.go global: Add SPDX tags and copyright header 2018-05-03 15:06:25 +02:00
device.go Finer-grained start-stop synchronization 2018-05-16 22:20:15 +02:00
endpoint_test.go global: Add SPDX tags and copyright header 2018-05-03 15:06:25 +02:00
generate-vendor.sh Avoid vendoring tooling as much as possible 2018-05-15 15:27:46 +02:00
Gopkg.lock Avoid vendoring tooling as much as possible 2018-05-15 15:27:46 +02:00
Gopkg.toml Avoid vendoring tooling as much as possible 2018-05-15 15:27:46 +02:00
helper_test.go Fix up tests 2018-05-13 19:35:11 +02:00
indextable.go Rework index hashtable 2018-05-13 18:26:09 +02:00
ip.go global: Add SPDX tags and copyright header 2018-05-03 15:06:25 +02:00
kdf_test.go global: Add SPDX tags and copyright header 2018-05-03 15:06:25 +02:00
keypair.go Odds and ends 2018-05-13 19:34:28 +02:00
logger.go Optional logging even in background 2018-05-14 03:38:06 +02:00
main.go Use /dev/null as place holder 2018-05-14 20:06:33 +02:00
Makefile Add vendoring for Homebrew 2018-05-15 14:49:52 +02:00
misc.go Introduce rwcancel 2018-05-14 00:30:52 +02:00
noise_test.go Fix noise test 2018-05-14 14:47:31 +02:00
noise-helpers.go Odds and ends 2018-05-13 19:34:28 +02:00
noise-protocol.go Clean more 2018-05-14 12:27:29 +02:00
noise-types.go Odds and ends 2018-05-13 19:34:28 +02:00
peer.go Finer-grained start-stop synchronization 2018-05-16 22:20:15 +02:00
README.md Fill out readme 2018-05-17 16:55:45 +02:00
receive.go Finer-grained start-stop synchronization 2018-05-16 22:20:15 +02:00
replay_test.go global: Add SPDX tags and copyright header 2018-05-03 15:06:25 +02:00
replay.go global: Add SPDX tags and copyright header 2018-05-03 15:06:25 +02:00
send.go Finer-grained start-stop synchronization 2018-05-16 22:20:15 +02:00
timers.go Lock timers on modification 2018-05-15 18:44:00 +02:00
tun_darwin.go Temporary work around. Please revert me 2018-05-15 19:56:06 +02:00
tun_linux.go Netlink sockets can't be shutdown 2018-05-14 14:08:03 +02:00
tun_windows.go Odds and ends 2018-05-13 19:34:28 +02:00
tun.go Finer-grained start-stop synchronization 2018-05-16 22:20:15 +02:00
uapi_darwin.go Fix dir permissions 2018-05-15 19:57:43 +02:00
uapi_linux.go Fix dir permissions 2018-05-15 19:57:43 +02:00
uapi_windows.go global: Add SPDX tags and copyright header 2018-05-03 15:06:25 +02:00
uapi.go Fix refactoring mistakes 2018-05-15 06:28:42 +02:00

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_DARWIN_UTUN_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

Work in progress, but nothing yet to share.

Building

You can satisfy dependencies with either go get -d -v or dep ensure -vendor-only. Then run make. As this is a Go project, a GOPATH is required. For example, wireguard-go can be built with:

$ git clone https://git.zx2c4.com/wireguard-go
$ cd wireguard-go
$ export GOPATH="$PWD/gopath"
$ go get -d -v
$ make

License

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2 as
published by the Free Software Foundation.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

---------------------------------------------------------------------------
Additional Permissions For Submission to Apple App Store: Provided that you
are otherwise in compliance with the GPLv2 for each covered work you convey
(including without limitation making the Corresponding Source available in
compliance with Section 3 of the GPLv2), you are granted the additional
the additional permission to convey through the Apple App Store
non-source executable versions of the Program as incorporated into each
applicable covered work as Executable Versions only under the Mozilla
Public License version 2.0 (https://www.mozilla.org/en-US/MPL/2.0/).