diff --git a/.drone.yml b/.drone.yml
index 6544341..5bd353c 100644
--- a/.drone.yml
+++ b/.drone.yml
@@ -3,10 +3,11 @@ kind: pipeline
name: default
steps:
- - name: fetch
- image: docker:git
+ - name: git
+ image: alpine/git
commands:
- git fetch --tags
+ - git submodule update --recursive --remote
- name: go-bindata
image: golang:latest
diff --git a/.goreleaser.yml b/.goreleaser.yml
index 2f3c2f9..786dfc9 100644
--- a/.goreleaser.yml
+++ b/.goreleaser.yml
@@ -3,13 +3,65 @@ project_name: wg-quicker
gitea_urls:
api: https://git.xsfx.dev/api/v1/
builds:
- - env:
+ - id: amd64
+ env:
- CGO_ENABLED=0
goarch:
- amd64
- - arm
+ goos:
+ - linux
+ ldflags:
+ - "-s"
+ - "-w"
+ - "-extldflags '-static'"
+ - "-X go.xsfx.dev/wg-quicker/cmd.version={{.Version}}"
+ - "-X go.xsfx.dev/wg-quicker/cmd.commit={{.ShortCommit}}"
+ - "-X go.xsfx.dev/wg-quicker/cmd.date={{.Date}}"
+ hooks:
+ pre:
+ - make clean
+ - make generate GOARCH={{.Arch}}
+ - id: arm64
+ env:
+ - CGO_ENABLED=0
+ goarch:
- arm64
+ goos:
+ - linux
+ ldflags:
+ - "-s"
+ - "-w"
+ - "-extldflags '-static'"
+ - "-X go.xsfx.dev/wg-quicker/cmd.version={{.Version}}"
+ - "-X go.xsfx.dev/wg-quicker/cmd.commit={{.ShortCommit}}"
+ - "-X go.xsfx.dev/wg-quicker/cmd.date={{.Date}}"
+ hooks:
+ pre:
+ - make clean
+ - make generate GOARCH={{.Arch}}
+ - id: 386
+ env:
+ - CGO_ENABLED=0
+ goarch:
- 386
+ goos:
+ - linux
+ ldflags:
+ - "-s"
+ - "-w"
+ - "-extldflags '-static'"
+ - "-X go.xsfx.dev/wg-quicker/cmd.version={{.Version}}"
+ - "-X go.xsfx.dev/wg-quicker/cmd.commit={{.ShortCommit}}"
+ - "-X go.xsfx.dev/wg-quicker/cmd.date={{.Date}}"
+ hooks:
+ pre:
+ - make clean
+ - make generate GOARCH={{.Arch}}
+ - id: arm-5
+ env:
+ - CGO_ENABLED=0
+ goarch:
+ - arm
goarm:
- 5
goos:
@@ -24,7 +76,47 @@ builds:
hooks:
pre:
- make clean
- - make generate GOARCH={{.Arch}}
+ - make generate GOARCH={{.Arch}} GOARM=5
+ - id: arm-6
+ env:
+ - CGO_ENABLED=0
+ goarch:
+ - arm
+ goarm:
+ - 6
+ goos:
+ - linux
+ ldflags:
+ - "-s"
+ - "-w"
+ - "-extldflags '-static'"
+ - "-X go.xsfx.dev/wg-quicker/cmd.version={{.Version}}"
+ - "-X go.xsfx.dev/wg-quicker/cmd.commit={{.ShortCommit}}"
+ - "-X go.xsfx.dev/wg-quicker/cmd.date={{.Date}}"
+ hooks:
+ pre:
+ - make clean
+ - make generate GOARCH={{.Arch}} GOARM=6
+ - id: arm-7
+ env:
+ - CGO_ENABLED=0
+ goarch:
+ - arm
+ goarm:
+ - 7
+ goos:
+ - linux
+ ldflags:
+ - "-s"
+ - "-w"
+ - "-extldflags '-static'"
+ - "-X go.xsfx.dev/wg-quicker/cmd.version={{.Version}}"
+ - "-X go.xsfx.dev/wg-quicker/cmd.commit={{.ShortCommit}}"
+ - "-X go.xsfx.dev/wg-quicker/cmd.date={{.Date}}"
+ hooks:
+ pre:
+ - make clean
+ - make generate GOARCH={{.Arch}} GOARM=7
archives:
- replacements:
darwin: macos
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
deleted file mode 100644
index bde1df6..0000000
--- a/.idea/encodings.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
diff --git a/.idea/misc.xml b/.idea/misc.xml
deleted file mode 100644
index 10af178..0000000
--- a/.idea/misc.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
diff --git a/.idea/modules.xml b/.idea/modules.xml
deleted file mode 100644
index f3760a5..0000000
--- a/.idea/modules.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
deleted file mode 100644
index 5ace414..0000000
--- a/.idea/vcs.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
diff --git a/.idea/watcherTasks.xml b/.idea/watcherTasks.xml
deleted file mode 100644
index 5243a75..0000000
--- a/.idea/watcherTasks.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/.idea/wg-quick-go.iml b/.idea/wg-quick-go.iml
deleted file mode 100644
index 6972aef..0000000
--- a/.idea/wg-quick-go.iml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Makefile b/Makefile
index 1fa76c4..064f1a2 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,3 @@
-WIREGUARD-GO_VERSION ?= v0.0.20201118
-WIREGUARD-GO_REPO ?= https://git.zx2c4.com/wireguard-go
export GO111MODULE := on
GO ?= go
GOFLAGS ?= -ldflags '-s -w -extldflags "-static"'
@@ -18,17 +16,12 @@ all: clean wg-quicker
clean:
rm wg-quicker || true
rm -rf assets || true
- rm -rf bin || true
+ rm third_party/wireguard-go/wireguard-go || true
.PHONY: wireguard-go
wireguard-go: clean
- mkdir bin
- cd /tmp; \
- git clone $(WIREGUARD-GO_REPO); \
- cd wireguard-go; \
- git checkout -b $(WIREGUARD-GO_VERSION) $(WIREGUARD-GO_VERSION); \
+ cd third_party/wireguard-go; \
GOOS=linux GOARCH=$(GOARCH) $(GOARMLINE) $(GO) build -v -o wireguard-go $(GOFLAGS) .
- mv /tmp/wireguard-go/wireguard-go bin/wireguard-go
.PHONY: generate
generate: wireguard-go
diff --git a/cmd/root.go b/cmd/root.go
index e850b3f..bf722a7 100644
--- a/cmd/root.go
+++ b/cmd/root.go
@@ -124,7 +124,7 @@ func loadConfig(cfg string) (*wgquick.Config, logrus.FieldLogger) {
}
func init() {
- rootCmd.PersistentFlags().StringVarP(&iface, "iface", "i", "", "interface")
+ rootCmd.PersistentFlags().StringVarP(&iface, "iface", "i", "", "if interface name should differ from config")
rootCmd.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "verbose")
rootCmd.PersistentFlags().IntVarP(&protocol, "route-protocol", "p", 0, "route protocol to use for our routes")
rootCmd.PersistentFlags().IntVarP(&metric, "route-metric", "m", 0, "route metric to use for our routes")
diff --git a/main.go b/main.go
index 995a8f2..171bb55 100644
--- a/main.go
+++ b/main.go
@@ -2,7 +2,7 @@ package main
import "go.xsfx.dev/wg-quicker/cmd"
-//go:generate go-bindata -pkg assets -o assets/bindata.go -nomemcopy bin/wireguard-go
+//go:generate go-bindata -pkg assets -o assets/bindata.go -nomemcopy third_party/wireguard-go/wireguard-go
func main() {
cmd.Execute()
diff --git a/wgquick/wg.go b/wgquick/wg.go
index 8c8bbf4..6f149f1 100644
--- a/wgquick/wg.go
+++ b/wgquick/wg.go
@@ -22,7 +22,7 @@ import (
// wgGo runs a embedded wireguard-go for interface creation.
func wgGo(iface string) error {
- wgob, err := assets.Asset("bin/wireguard-go")
+ wgob, err := assets.Asset("third_party/wireguard-go/wireguard-go")
if err != nil {
return fmt.Errorf("cannot get wireguard-go: %w", err)
}