You've already forked dyndns-client
Compare commits
1 Commits
master
...
923855147e
Author | SHA1 | Date | |
---|---|---|---|
923855147e
|
@ -6,19 +6,17 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches: [ '**' ]
|
branches: [ '**' ]
|
||||||
tags-ignore: [ '**' ]
|
tags-ignore: [ '**' ]
|
||||||
|
workflow_dispatch: {}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
unittest:
|
unittest:
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on:
|
||||||
strategy:
|
- ubuntu-latest
|
||||||
matrix:
|
|
||||||
go: [ stable ]
|
|
||||||
os: [ ubuntu-latest-amd64, ubuntu-latest-arm64 ]
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4.2.2
|
- uses: actions/checkout@v4.2.2
|
||||||
- uses: actions/setup-go@v5.5.0
|
- uses: actions/setup-go@v5.5.0
|
||||||
with:
|
with:
|
||||||
go-version: ${{ matrix.go }}
|
go-version: stable
|
||||||
- env:
|
- env:
|
||||||
GOPROXY: ${{ vars.GOPROXY }}
|
GOPROXY: ${{ vars.GOPROXY }}
|
||||||
run: make test/unit
|
run: make test/unit
|
||||||
|
@ -1,27 +0,0 @@
|
|||||||
name: Golang CI lint
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
types: [ "opened", "reopened", "synchronize" ]
|
|
||||||
push:
|
|
||||||
branches: [ '**' ]
|
|
||||||
tags-ignore: [ '**' ]
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
golangci:
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
go: [ stable ]
|
|
||||||
os: [ ubuntu-latest-amd64, ubuntu-latest-arm64 ]
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4.2.2
|
|
||||||
- uses: actions/setup-go@v5.5.0
|
|
||||||
with:
|
|
||||||
go-version: ${{ matrix.go }}
|
|
||||||
- uses: golangci/golangci-lint-action@v8.0.0
|
|
||||||
with:
|
|
||||||
version: v2.1
|
|
@ -14,6 +14,6 @@ jobs:
|
|||||||
- ubuntu-latest
|
- ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4.2.2
|
- uses: actions/checkout@v4.2.2
|
||||||
- uses: DavidAnson/markdownlint-cli2-action@v20.0.0
|
- uses: DavidAnson/markdownlint-cli2-action@v19.1.0
|
||||||
with:
|
with:
|
||||||
globs: '**/*.md'
|
globs: '**/*.md'
|
28
.golangci.yml
Normal file
28
.golangci.yml
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
issues:
|
||||||
|
exclude-dirs:
|
||||||
|
- it
|
||||||
|
|
||||||
|
run:
|
||||||
|
timeout: 10m
|
||||||
|
tests: true
|
||||||
|
|
||||||
|
linters:
|
||||||
|
disable-all: true
|
||||||
|
enable:
|
||||||
|
# Default
|
||||||
|
- errcheck
|
||||||
|
- gosimple
|
||||||
|
- govet
|
||||||
|
- ineffassign
|
||||||
|
- staticcheck
|
||||||
|
- typecheck
|
||||||
|
- unused
|
||||||
|
|
||||||
|
# Additionally linters
|
||||||
|
- bodyclose
|
||||||
|
- misspell
|
||||||
|
- nilerr
|
||||||
|
- rowserrcheck
|
||||||
|
- sqlclosecheck
|
||||||
|
- unparam
|
||||||
|
- whitespace
|
@ -30,7 +30,6 @@ builds:
|
|||||||
- amd64
|
- amd64
|
||||||
- arm
|
- arm
|
||||||
- arm64
|
- arm64
|
||||||
- riscv64
|
|
||||||
goarm:
|
goarm:
|
||||||
- "6"
|
- "6"
|
||||||
- "7"
|
- "7"
|
||||||
@ -140,25 +139,6 @@ dockers:
|
|||||||
skip_push: false
|
skip_push: false
|
||||||
use: buildx
|
use: buildx
|
||||||
|
|
||||||
- build_flag_templates:
|
|
||||||
- --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }}
|
|
||||||
- --label=org.opencontainers.image.description={{ .ProjectName }}
|
|
||||||
- --label=org.opencontainers.image.documentation={{ .ProjectName }}
|
|
||||||
- --label=org.opencontainers.image.revision={{ .FullCommit }}
|
|
||||||
- --label=org.opencontainers.image.source={{ .GitURL }}
|
|
||||||
- --label=org.opencontainers.image.title={{ .ProjectName }}
|
|
||||||
- --label=org.opencontainers.image.url=https://git.cryptic.systems/volker.raschek/{{ .ProjectName }}
|
|
||||||
- --label=org.opencontainers.image.version={{ trimprefix .Tag "v" }}
|
|
||||||
- --platform=linux/riscv64
|
|
||||||
- --pull
|
|
||||||
dockerfile: Dockerfile
|
|
||||||
goarch: riscv64
|
|
||||||
goos: linux
|
|
||||||
image_templates:
|
|
||||||
- 'git.cryptic.systems/volker.raschek/{{ .ProjectName }}:{{ trimprefix .Tag "v" }}-riscv64'
|
|
||||||
skip_push: false
|
|
||||||
use: buildx
|
|
||||||
|
|
||||||
docker_manifests:
|
docker_manifests:
|
||||||
- name_template: 'git.cryptic.systems/volker.raschek/{{ .ProjectName }}:{{ trimprefix .Tag "v" }}'
|
- name_template: 'git.cryptic.systems/volker.raschek/{{ .ProjectName }}:{{ trimprefix .Tag "v" }}'
|
||||||
image_templates:
|
image_templates:
|
||||||
@ -166,7 +146,6 @@ docker_manifests:
|
|||||||
- 'git.cryptic.systems/volker.raschek/{{ .ProjectName }}:{{ trimprefix .Tag "v" }}-arm-v6'
|
- 'git.cryptic.systems/volker.raschek/{{ .ProjectName }}:{{ trimprefix .Tag "v" }}-arm-v6'
|
||||||
- 'git.cryptic.systems/volker.raschek/{{ .ProjectName }}:{{ trimprefix .Tag "v" }}-arm-v7'
|
- 'git.cryptic.systems/volker.raschek/{{ .ProjectName }}:{{ trimprefix .Tag "v" }}-arm-v7'
|
||||||
- 'git.cryptic.systems/volker.raschek/{{ .ProjectName }}:{{ trimprefix .Tag "v" }}-arm64'
|
- 'git.cryptic.systems/volker.raschek/{{ .ProjectName }}:{{ trimprefix .Tag "v" }}-arm64'
|
||||||
- 'git.cryptic.systems/volker.raschek/{{ .ProjectName }}:{{ trimprefix .Tag "v" }}-riscv64'
|
|
||||||
|
|
||||||
gitea_urls:
|
gitea_urls:
|
||||||
api: https://git.cryptic.systems/api/v1
|
api: https://git.cryptic.systems/api/v1
|
||||||
|
125
Makefile
125
Makefile
@ -1,114 +1,53 @@
|
|||||||
dcmergeEXECUTABLE=dyndns-client
|
# VERSION
|
||||||
VERSION?=$(shell git describe --abbrev=0)+hash.$(shell git rev-parse --short HEAD)
|
VERSION ?= $(shell git describe --abbrev=0)+hash.$(shell git rev-parse --short HEAD)
|
||||||
|
|
||||||
# Destination directory and prefix to place the compiled binaries, documentaions
|
DESTDIR ?=
|
||||||
# and other files.
|
PREFIX ?= /usr/local
|
||||||
DESTDIR?=
|
EXECUTABLE := dyndns-client
|
||||||
PREFIX?=/usr/local
|
|
||||||
|
|
||||||
# CONTAINER_RUNTIME
|
# BINARIES
|
||||||
# The CONTAINER_RUNTIME variable will be used to specified the path to a
|
|
||||||
# container runtime. This is needed to start and run a container image.
|
|
||||||
CONTAINER_RUNTIME?=$(shell which podman)
|
|
||||||
|
|
||||||
# DYNDNS_CLIENT_IMAGE_REGISTRY_NAME
|
|
||||||
# Defines the name of the new container to be built using several variables.
|
|
||||||
DYNDNS_CLIENT_IMAGE_REGISTRY_NAME:=git.cryptic.systems
|
|
||||||
DYNDNS_CLIENT_IMAGE_REGISTRY_USER:=volker.raschek
|
|
||||||
|
|
||||||
DYNDNS_CLIENT_IMAGE_NAMESPACE?=${DYNDNS_CLIENT_IMAGE_REGISTRY_USER}
|
|
||||||
DYNDNS_CLIENT_IMAGE_NAME:=${EXECUTABLE}
|
|
||||||
_IMAGE_VERSION?=latest
|
|
||||||
DYNDNS_CLIENT_IMAGE_FULLY_QUALIFIED=${DYNDNS_CLIENT_IMAGE_REGISTRY_NAME}/${DYNDNS_CLIENT_IMAGE_NAMESPACE}/${DYNDNS_CLIENT_IMAGE_NAME}:${DYNDNS_CLIENT_IMAGE_VERSION}
|
|
||||||
|
|
||||||
# BIN
|
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
dyndns-client:
|
all: ${EXECUTABLE}
|
||||||
|
|
||||||
|
${EXECUTABLE}:
|
||||||
CGO_ENABLED=0 \
|
CGO_ENABLED=0 \
|
||||||
|
GOPRIVATE=$(shell go env GOPRIVATE) \
|
||||||
GOPROXY=$(shell go env GOPROXY) \
|
GOPROXY=$(shell go env GOPROXY) \
|
||||||
go build -ldflags "-X 'main.version=${VERSION}'" -o ${@} main.go
|
go build -ldflags "-X main.version=${VERSION:v%=%}" -o ${@}
|
||||||
|
|
||||||
|
# TEST
|
||||||
|
# ==============================================================================
|
||||||
|
PHONY+=test/unit
|
||||||
|
test/unit: clean ${EXECUTABLE}
|
||||||
|
go test -v ./pkg/...
|
||||||
|
|
||||||
# CLEAN
|
# CLEAN
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
PHONY+=clean
|
PHONY+=clean
|
||||||
clean:
|
clean:
|
||||||
rm --force --recursive dyndns-client
|
rm --force ${EXECUTABLE} || true
|
||||||
|
rm --force --recursive bin || true
|
||||||
|
|
||||||
# TESTS
|
# UN/INSTALL
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
PHONY+=test/unit
|
PHONY+=install
|
||||||
test/unit:
|
install: ${EXECUTABLE}
|
||||||
CGO_ENABLED=0 \
|
|
||||||
GOPROXY=$(shell go env GOPROXY) \
|
|
||||||
go test -v -p 1 -coverprofile=coverage.txt -covermode=count -timeout 1200s ./pkg/...
|
|
||||||
|
|
||||||
PHONY+=test/integration
|
|
||||||
test/integration:
|
|
||||||
CGO_ENABLED=0 \
|
|
||||||
GOPROXY=$(shell go env GOPROXY) \
|
|
||||||
go test -v -p 1 -count=1 -timeout 1200s ./it/...
|
|
||||||
|
|
||||||
PHONY+=test/coverage
|
|
||||||
test/coverage: test/unit
|
|
||||||
CGO_ENABLED=0 \
|
|
||||||
GOPROXY=$(shell go env GOPROXY) \
|
|
||||||
go tool cover -html=coverage.txt
|
|
||||||
|
|
||||||
# GOLANGCI-LINT
|
|
||||||
# ==============================================================================
|
|
||||||
PHONY+=golangci-lint
|
|
||||||
golangci-lint:
|
|
||||||
golangci-lint run --concurrency=$(shell nproc)
|
|
||||||
|
|
||||||
# INSTALL
|
|
||||||
# ==============================================================================
|
|
||||||
PHONY+=uninstall
|
|
||||||
install: dyndns-client
|
|
||||||
install --directory ${DESTDIR}/etc/bash_completion.d
|
|
||||||
./dyndns-client completion bash > ${DESTDIR}/etc/bash_completion.d/${EXECUTABLE}
|
|
||||||
|
|
||||||
install --directory ${DESTDIR}${PREFIX}/bin
|
install --directory ${DESTDIR}${PREFIX}/bin
|
||||||
install --mode 0755 ${EXECUTABLE} ${DESTDIR}${PREFIX}/bin/${EXECUTABLE}
|
install --mode 755 ${EXECUTABLE} ${DESTDIR}${PREFIX}/bin/${EXECUTABLE}
|
||||||
|
|
||||||
install --directory ${DESTDIR}${PREFIX}/share/licenses/${EXECUTABLE}
|
install --directory ${DESTDIR}/usr/lib/systemd/system
|
||||||
install --mode 0644 LICENSE ${DESTDIR}${PREFIX}/share/licenses/${EXECUTABLE}/LICENSE
|
install --mode 644 systemd/${EXECUTABLE}.service ${DESTDIR}/usr/lib/systemd/system
|
||||||
|
|
||||||
|
install --directory ${DESTDIR}/usr/share/licenses/${EXECUTABLE}
|
||||||
|
install --mode 644 LICENSE ${DESTDIR}/usr/share/licenses/${EXECUTABLE}/LICENSE
|
||||||
|
|
||||||
# UNINSTALL
|
|
||||||
# ==============================================================================
|
|
||||||
PHONY+=uninstall
|
PHONY+=uninstall
|
||||||
uninstall:
|
uninstall:
|
||||||
-rm --force --recursive \
|
-rm --recursive --force \
|
||||||
${DESTDIR}/etc/bash_completion.d/${EXECUTABLE} \
|
|
||||||
${DESTDIR}${PREFIX}/bin/${EXECUTABLE} \
|
${DESTDIR}${PREFIX}/bin/${EXECUTABLE} \
|
||||||
${DESTDIR}${PREFIX}/share/licenses/${EXECUTABLE}
|
${DESTDIR}/usr/lib/systemd/system/${EXECUTABLE}.service \
|
||||||
|
${DESTDIR}/usr/share/licenses/${EXECUTABLE}/LICENSE
|
||||||
# BUILD CONTAINER IMAGE
|
|
||||||
# ==============================================================================
|
|
||||||
PHONY+=container-image/build
|
|
||||||
container-image/build:
|
|
||||||
${CONTAINER_RUNTIME} build \
|
|
||||||
--build-arg VERSION=${VERSION} \
|
|
||||||
--file Dockerfile \
|
|
||||||
--no-cache \
|
|
||||||
--pull \
|
|
||||||
--tag ${DYNDNS_CLIENT_IMAGE_FULLY_QUALIFIED} \
|
|
||||||
.
|
|
||||||
|
|
||||||
# DELETE CONTAINER IMAGE
|
|
||||||
# ==============================================================================
|
|
||||||
PHONY:=container-image/delete
|
|
||||||
container-image/delete:
|
|
||||||
- ${CONTAINER_RUNTIME} image rm ${DYNDNS_CLIENT_IMAGE_FULLY_QUALIFIED}
|
|
||||||
|
|
||||||
# PUSH CONTAINER IMAGE
|
|
||||||
# ==============================================================================
|
|
||||||
PHONY+=container-image/push
|
|
||||||
container-image/push:
|
|
||||||
echo ${DYNDNS_CLIENT_IMAGE_REGISTRY_PASSWORD} | ${CONTAINER_RUNTIME} login ${DYNDNS_CLIENT_IMAGE_REGISTRY_NAME} --username ${DYNDNS_CLIENT_IMAGE_REGISTRY_USER} --password-stdin
|
|
||||||
${CONTAINER_RUNTIME} push ${DYNDNS_CLIENT_IMAGE_FULLY_QUALIFIED}
|
|
||||||
|
|
||||||
# PHONY
|
# PHONY
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
# Declare the contents of the PHONY variable as phony. We keep that information
|
.PHONY: ${PHONY}
|
||||||
# in a variable so we can use it in if_changed.
|
|
||||||
.PHONY: ${PHONY}
|
|
||||||
|
6
go.mod
6
go.mod
@ -3,12 +3,12 @@ module git.cryptic.systems/volker.raschek/dyndns-client
|
|||||||
go 1.20
|
go 1.20
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2
|
github.com/asaskevich/govalidator/v11 v11.0.1
|
||||||
github.com/sirupsen/logrus v1.9.3
|
github.com/sirupsen/logrus v1.9.3
|
||||||
github.com/vishvananda/netlink v1.3.1
|
github.com/vishvananda/netlink v1.3.0
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/vishvananda/netns v0.0.5 // indirect
|
github.com/vishvananda/netns v0.0.4 // indirect
|
||||||
golang.org/x/sys v0.10.0 // indirect
|
golang.org/x/sys v0.10.0 // indirect
|
||||||
)
|
)
|
||||||
|
8
go.sum
8
go.sum
@ -10,10 +10,10 @@ github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVs
|
|||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
|
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
|
||||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
github.com/vishvananda/netlink v1.3.1 h1:3AEMt62VKqz90r0tmNhog0r/PpWKmrEShJU0wJW6bV0=
|
github.com/vishvananda/netlink v1.3.0 h1:X7l42GfcV4S6E4vHTsw48qbrV+9PVojNfIhZcwQdrZk=
|
||||||
github.com/vishvananda/netlink v1.3.1/go.mod h1:ARtKouGSTGchR8aMwmkzC0qiNPrrWO5JS/XMVl45+b4=
|
github.com/vishvananda/netlink v1.3.0/go.mod h1:i6NetklAujEcC6fK0JPjT8qSwWyO0HLn4UKG+hGqeJs=
|
||||||
github.com/vishvananda/netns v0.0.5 h1:DfiHV+j8bA32MFM7bfEunvT8IAqQ/NzSJHtcmW5zdEY=
|
github.com/vishvananda/netns v0.0.4 h1:Oeaw1EM2JMxD51g9uhtC0D7erkIjgmj8+JZc26m1YX8=
|
||||||
github.com/vishvananda/netns v0.0.5/go.mod h1:SpkAiCQRtJ6TvvxPnOSyH3BMl6unz3xZlaprSwhNNJM=
|
github.com/vishvananda/netns v0.0.4/go.mod h1:SpkAiCQRtJ6TvvxPnOSyH3BMl6unz3xZlaprSwhNNJM=
|
||||||
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA=
|
golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA=
|
||||||
|
@ -152,7 +152,7 @@ func getOutboundIP() net.IP {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
defer func() { _ = conn.Close() }()
|
defer conn.Close()
|
||||||
localAddr := conn.LocalAddr().(*net.UDPAddr)
|
localAddr := conn.LocalAddr().(*net.UDPAddr)
|
||||||
return localAddr.IP
|
return localAddr.IP
|
||||||
}
|
}
|
||||||
|
@ -6,16 +6,5 @@
|
|||||||
"local>volker.raschek/renovate-config:actions#master",
|
"local>volker.raschek/renovate-config:actions#master",
|
||||||
"local>volker.raschek/renovate-config:golang#master",
|
"local>volker.raschek/renovate-config:golang#master",
|
||||||
"local>volker.raschek/renovate-config:regexp#master"
|
"local>volker.raschek/renovate-config:regexp#master"
|
||||||
],
|
|
||||||
"packageRules": [
|
|
||||||
{
|
|
||||||
"enabled": false,
|
|
||||||
"matchDatasources":[
|
|
||||||
"go"
|
|
||||||
],
|
|
||||||
"matchPackageNames": [
|
|
||||||
"^github\\.com/asaskevich/govalidator"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user