uses wireguard-go submodule + arm 6 and 7 builds
This commit is contained in:
parent
58c681c536
commit
d578d0a5e4
@ -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
|
||||
|
@ -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
|
||||
|
@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding" addBOMForNewFiles="with NO BOM" />
|
||||
</project>
|
@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="JavaScriptSettings">
|
||||
<option name="languageLevel" value="ES6" />
|
||||
</component>
|
||||
</project>
|
@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/wg-quick-go.iml" filepath="$PROJECT_DIR$/.idea/wg-quick-go.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
@ -1,29 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectTasksOptions">
|
||||
<TaskOptions isEnabled="true">
|
||||
<option name="arguments" value="-w $FilePath$" />
|
||||
<option name="checkSyntaxErrors" value="true" />
|
||||
<option name="description" />
|
||||
<option name="exitCodeBehavior" value="ERROR" />
|
||||
<option name="fileExtension" value="go" />
|
||||
<option name="immediateSync" value="false" />
|
||||
<option name="name" value="goimports" />
|
||||
<option name="output" value="$FilePath$" />
|
||||
<option name="outputFilters">
|
||||
<array />
|
||||
</option>
|
||||
<option name="outputFromStdout" value="false" />
|
||||
<option name="program" value="goimports" />
|
||||
<option name="runOnExternalChanges" value="false" />
|
||||
<option name="scopeName" value="Project Files" />
|
||||
<option name="trackOnlyRoot" value="true" />
|
||||
<option name="workingDir" value="$ProjectFileDir$" />
|
||||
<envs>
|
||||
<env name="GOROOT" value="$GOROOT$" />
|
||||
<env name="GOPATH" value="$GOPATH$" />
|
||||
<env name="PATH" value="$GoBinDirs$" />
|
||||
</envs>
|
||||
</TaskOptions>
|
||||
</component>
|
||||
</project>
|
@ -1,13 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="WEB_MODULE" version="4">
|
||||
<component name="Go">
|
||||
<buildTags>
|
||||
<option name="os" value="linux" />
|
||||
</buildTags>
|
||||
</component>
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
11
Makefile
11
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
|
||||
|
@ -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")
|
||||
|
2
main.go
2
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()
|
||||
|
@ -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)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user