Go to file
Jason A. Donenfeld bad6caeb82 memmod: fix protected delayed load the right way
The reason this was failing before is that dloadsup.h's
DloadObtainSection was doing a linear search of sections to find which
header corresponds with the IMAGE_DELAYLOAD_DESCRIPTOR section, and we
were stupidly overwriting the VirtualSize field, so the linear search
wound up matching the .text section, which then it found to not be
marked writable and failed with FAST_FAIL_DLOAD_PROTECTION_FAILURE.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2021-07-29 01:27:40 +02:00
conn conn: linux: protect read fds 2021-05-20 18:09:55 +02:00
device device: zero out allowedip node pointers when removing 2021-06-04 16:33:28 +02:00
ipc ipc: allow admins but require high integrity label 2021-06-24 17:01:02 +02:00
ratelimiter global: bump copyright 2021-01-28 17:52:15 +01:00
replay global: bump copyright 2021-01-28 17:52:15 +01:00
rwcancel rwcancel: use ordinary os.ErrClosed instead of custom error 2021-05-20 17:56:36 +02:00
tai64n tai64n: add string representation for error messages 2021-02-03 17:56:46 +01:00
tests device: combine debug and info log levels into 'verbose' 2021-01-26 23:05:48 +01:00
tun memmod: fix protected delayed load the right way 2021-07-29 01:27:40 +02:00
.gitignore gitignore: remove old hacks 2021-02-11 15:48:56 +01:00
format_test.go main: replace crlf on windows in fmt test 2021-05-10 22:23:32 +02:00
go.mod go.mod: bump golang.org/x/sys again 2021-05-25 16:34:54 +02:00
go.sum go.mod: bump golang.org/x/sys again 2021-05-25 16:34:54 +02:00
LICENSE mod: rename COPYING to LICENSE 2021-03-06 09:09:21 -07:00
main_windows.go conn: make binds replacable 2021-02-23 20:00:57 +01:00
main.go main: print kernel warning on OpenBSD and FreeBSD too 2021-04-15 23:35:45 -06:00
Makefile main: check that code is formatted in unit test 2021-05-10 17:48:26 +02:00
README.md README: bump document Go requirement to 1.16 2021-02-22 15:26:29 +01:00
version.go version: bump snapshot 2021-04-24 13:07:27 -04:00

Go Implementation of WireGuard

This is an implementation of WireGuard in Go.

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 instead use the kernel module, which is faster and better integrated into the OS. 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

This runs on Windows, but you should instead use it from the more fully featured Windows app, which uses this as a module.

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.16.

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

License

Copyright (C) 2017-2021 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.