diff options
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | Gopkg.lock | 32 | ||||
-rw-r--r-- | Gopkg.toml | 4 | ||||
-rw-r--r-- | Makefile | 29 | ||||
-rw-r--r-- | README.md | 4 | ||||
-rw-r--r-- | conn_linux.go | 2 | ||||
-rw-r--r-- | cookie.go | 2 | ||||
-rw-r--r-- | device.go | 4 | ||||
-rw-r--r-- | donotuseon_linux.go | 15 | ||||
-rwxr-xr-x | generate-vendor.sh | 20 | ||||
-rw-r--r-- | keypair.go | 2 | ||||
-rw-r--r-- | main.go | 2 | ||||
-rw-r--r-- | noise-protocol.go | 2 | ||||
-rw-r--r-- | tun.go | 2 | ||||
-rw-r--r-- | tun/tun_darwin.go | 2 | ||||
-rw-r--r-- | tun/tun_freebsd.go | 2 | ||||
-rw-r--r-- | tun/tun_linux.go | 2 | ||||
-rw-r--r-- | tun/tun_openbsd.go | 2 | ||||
-rw-r--r-- | uapi_linux.go | 2 |
19 files changed, 88 insertions, 44 deletions
@@ -1,2 +1,4 @@ wireguard-go vendor +.gopath +ireallywantobuildon_linux.go @@ -1,16 +1,42 @@ -# This was generated by ./generate-vendor.sh +# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. + + [[projects]] branch = "master" name = "golang.org/x/crypto" + packages = [ + "blake2s", + "chacha20poly1305", + "curve25519", + "internal/chacha20", + "poly1305" + ] revision = "1a580b3eff7814fc9b40602fd35256c63b50f491" [[projects]] branch = "master" name = "golang.org/x/net" - revision = "8e0cdda24ed423affc8f35c241e5e9b16180338e" + packages = [ + "bpf", + "internal/iana", + "internal/socket", + "ipv4", + "ipv6" + ] + revision = "9ef9f5bb98a1fdc41f8cf6c250a4404b4085e389" [[projects]] branch = "master" name = "golang.org/x/sys" - revision = "7f59abf37be6a6007f075af1bc7f16f137bc176b" + packages = [ + "cpu", + "unix" + ] + revision = "88eb85aaee56831ad49eaf7aa80d73de9814cde2" +[solve-meta] + analyzer-name = "dep" + analyzer-version = 1 + inputs-digest = "d85ae9d2b4afafc3d7535505c46368cbbbec350cf876616302c1bcf44f6ec103" + solver-name = "gps-cdcl" + solver-version = 1 @@ -1,4 +1,3 @@ -# This was generated by ./generate-vendor.sh [[constraint]] branch = "master" name = "golang.org/x/crypto" @@ -11,3 +10,6 @@ branch = "master" name = "golang.org/x/sys" +[prune] + go-tests = true + unused-packages = true @@ -5,18 +5,39 @@ BINDIR ?= $(PREFIX)/bin ifeq ($(shell go env GOOS),linux) ifeq ($(wildcard .git),) $(error Do not build this for Linux. Instead use the Linux kernel module. See wireguard.com/install/ for more info.) +else +$(shell printf 'package main\nconst UseTheKernelModuleInstead = 0xdeadbabe\n' > ireallywantobuildon_linux.go) endif endif all: wireguard-go -wireguard-go: $(wildcard *.go) $(wildcard */*.go) - go build -v -o $@ +export GOPATH := $(CURDIR)/.gopath +export PATH := $(PATH):$(CURDIR)/.gopath/bin +GO_IMPORT_PATH := git.zx2c4.com/wireguard-go + +.gopath/.created: + rm -rf .gopath + mkdir -p $(dir .gopath/src/$(GO_IMPORT_PATH)) + ln -s ../../.. .gopath/src/$(GO_IMPORT_PATH) + touch $@ + +vendor/.created: Gopkg.toml Gopkg.lock .gopath/.created + command -v dep >/dev/null || go get -v github.com/golang/dep/cmd/dep + cd .gopath/src/$(GO_IMPORT_PATH) && dep ensure -vendor-only -v + touch $@ + +wireguard-go: $(wildcard *.go) $(wildcard */*.go) .gopath/.created vendor/.created + go build $(GO_BUILD_EXTRA_ARGS) -v $(GO_IMPORT_PATH) install: wireguard-go - @install -v -d "$(DESTDIR)$(BINDIR)" && install -m 0755 -v wireguard-go "$(DESTDIR)$(BINDIR)/wireguard-go" + @install -v -d "$(DESTDIR)$(BINDIR)" && install -v -m 0755 wireguard-go "$(DESTDIR)$(BINDIR)/wireguard-go" clean: rm -f wireguard-go -.PHONY: clean install +update-dep: + command -v dep >/dev/null || go get -v github.com/golang/dep/cmd/dep + cd .gopath/src/$(GO_IMPORT_PATH) && dep ensure -update -v + +.PHONY: clean install update-dep @@ -48,13 +48,11 @@ This will run on OpenBSD. It does not yet support sticky sockets. Fwmark is mapp ## 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: +This requires an installation of [go](https://golang.org) and of [dep](https://github.com/golang/dep). If dep is not installed, it will be downloaded and built as part of the build process. ``` $ git clone https://git.zx2c4.com/wireguard-go $ cd wireguard-go -$ export GOPATH="$PWD/gopath" -$ go get -d -v $ make ``` diff --git a/conn_linux.go b/conn_linux.go index fa09087..fe30afb 100644 --- a/conn_linux.go +++ b/conn_linux.go @@ -18,7 +18,7 @@ package main import ( - "./rwcancel" + "git.zx2c4.com/wireguard-go/rwcancel" "errors" "golang.org/x/sys/unix" "net" @@ -7,7 +7,7 @@ package main import ( - "./xchacha20poly1305" + "git.zx2c4.com/wireguard-go/xchacha20poly1305" "crypto/hmac" "crypto/rand" "golang.org/x/crypto/blake2s" @@ -7,8 +7,8 @@ package main import ( - "./ratelimiter" - "./tun" + "git.zx2c4.com/wireguard-go/ratelimiter" + "git.zx2c4.com/wireguard-go/tun" "runtime" "sync" "sync/atomic" diff --git a/donotuseon_linux.go b/donotuseon_linux.go new file mode 100644 index 0000000..7197375 --- /dev/null +++ b/donotuseon_linux.go @@ -0,0 +1,15 @@ +// +build !android + +/* SPDX-License-Identifier: GPL-2.0 + * + * Copyright (C) 2017-2018 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved. + */ + +package main + +const DoNotUseThisProgramOnLinux = UseTheKernelModuleInstead + +// -------------------------------------------------------- +// Do not use this on Linux. Instead use the kernel module. +// See wireguard.com/install for more information. +// -------------------------------------------------------- diff --git a/generate-vendor.sh b/generate-vendor.sh deleted file mode 100755 index 51d0fff..0000000 --- a/generate-vendor.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash - -echo "# This was generated by ./generate-vendor.sh" > Gopkg.lock -echo "# This was generated by ./generate-vendor.sh" > Gopkg.toml - -while read -r package; do - cat >> Gopkg.lock <<-_EOF - [[projects]] - branch = "master" - name = "$package" - revision = "$(< "$GOPATH/src/$package/.git/refs/heads/master")" - - _EOF - cat >> Gopkg.toml <<-_EOF - [[constraint]] - branch = "master" - name = "$package" - - _EOF -done < <(sed -n 's/.*"\(golang.org\/x\/[^/]\+\)\/\?.*".*/\1/p' *.go */*.go | sort | uniq) @@ -7,7 +7,7 @@ package main import ( - "./replay" + "git.zx2c4.com/wireguard-go/replay" "crypto/cipher" "sync" "time" @@ -7,7 +7,7 @@ package main import ( - "./tun" + "git.zx2c4.com/wireguard-go/tun" "fmt" "os" "os/signal" diff --git a/noise-protocol.go b/noise-protocol.go index c6a95d8..a527be9 100644 --- a/noise-protocol.go +++ b/noise-protocol.go @@ -7,7 +7,7 @@ package main import ( - "./tai64n" + "git.zx2c4.com/wireguard-go/tai64n" "errors" "golang.org/x/crypto/blake2s" "golang.org/x/crypto/chacha20poly1305" @@ -7,7 +7,7 @@ package main import ( - "./tun" + "git.zx2c4.com/wireguard-go/tun" "sync/atomic" ) diff --git a/tun/tun_darwin.go b/tun/tun_darwin.go index fcbb4f9..04020cb 100644 --- a/tun/tun_darwin.go +++ b/tun/tun_darwin.go @@ -7,7 +7,7 @@ package tun import ( - "../rwcancel" + "git.zx2c4.com/wireguard-go/rwcancel" "errors" "fmt" "golang.org/x/net/ipv6" diff --git a/tun/tun_freebsd.go b/tun/tun_freebsd.go index b4cf57d..bd70104 100644 --- a/tun/tun_freebsd.go +++ b/tun/tun_freebsd.go @@ -6,7 +6,7 @@ package tun import ( - "../rwcancel" + "git.zx2c4.com/wireguard-go/rwcancel" "bytes" "errors" "fmt" diff --git a/tun/tun_linux.go b/tun/tun_linux.go index acfb942..d048c21 100644 --- a/tun/tun_linux.go +++ b/tun/tun_linux.go @@ -12,7 +12,7 @@ package tun */ import ( - "../rwcancel" + "git.zx2c4.com/wireguard-go/rwcancel" "bytes" "errors" "fmt" diff --git a/tun/tun_openbsd.go b/tun/tun_openbsd.go index 74b25e5..709b5cd 100644 --- a/tun/tun_openbsd.go +++ b/tun/tun_openbsd.go @@ -6,7 +6,7 @@ package tun import ( - "../rwcancel" + "git.zx2c4.com/wireguard-go/rwcancel" "errors" "fmt" "golang.org/x/net/ipv6" diff --git a/uapi_linux.go b/uapi_linux.go index 2b5b9a0..5e86628 100644 --- a/uapi_linux.go +++ b/uapi_linux.go @@ -7,7 +7,7 @@ package main import ( - "./rwcancel" + "git.zx2c4.com/wireguard-go/rwcancel" "errors" "fmt" "golang.org/x/sys/unix" |