Compare commits
No commits in common. "master" and "7f5782cde59f2ea29dd28237c34f7a4bf55ea562" have entirely different histories.
master
...
7f5782cde5
79
.drone.yml
Normal file
79
.drone.yml
Normal file
@ -0,0 +1,79 @@
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: amd64
|
||||
|
||||
steps:
|
||||
- name: build-linux-amd64
|
||||
image: docker.io/volkerraschek/build-image:latest
|
||||
commands:
|
||||
- make
|
||||
when:
|
||||
event:
|
||||
- push
|
||||
- pull_request
|
||||
- tag
|
||||
|
||||
- name: build-image-latest
|
||||
image: docker.io/volkerraschek/build-image:latest
|
||||
commands:
|
||||
- make CONTAINER_RUNTIME=docker container-image/build
|
||||
volumes:
|
||||
- name: docker_socket
|
||||
path: /var/run/docker.sock
|
||||
when:
|
||||
branch:
|
||||
- master
|
||||
|
||||
- name: push-image-latest
|
||||
image: docker.io/volkerraschek/build-image:latest
|
||||
commands:
|
||||
- make CONTAINER_RUNTIME=docker container-image/push
|
||||
environment:
|
||||
CONTAINER_IMAGE_REGISTRY_PASSWORD:
|
||||
from_secret: container_image_registry_password
|
||||
volumes:
|
||||
- name: docker_socket
|
||||
path: /var/run/docker.sock
|
||||
when:
|
||||
repo:
|
||||
- volker.raschek/dyndns-client
|
||||
branch:
|
||||
- master
|
||||
|
||||
- name: push-latest-commit
|
||||
environment:
|
||||
GIT_PUSH_SSH_KEY:
|
||||
from_secret:
|
||||
github_ssh_key
|
||||
image: appleboy/drone-git-push:0.2.0-linux-amd64
|
||||
settings:
|
||||
remote: git@github.com:volker-raschek/dyndns-client.git
|
||||
force: true
|
||||
when:
|
||||
repo:
|
||||
- volker.raschek/dyndns-client
|
||||
branch:
|
||||
- master
|
||||
event:
|
||||
- push
|
||||
|
||||
- name: notify
|
||||
image: drillster/drone-email
|
||||
environment:
|
||||
PLUGIN_HOST:
|
||||
from_secret: smtp_host
|
||||
PLUGIN_USERNAME:
|
||||
from_secret: smtp_username
|
||||
PLUGIN_PASSWORD:
|
||||
from_secret: smtp_password
|
||||
PLUGIN_FROM:
|
||||
from_secret: smtp_mail_address
|
||||
when:
|
||||
status:
|
||||
- changed
|
||||
- failure
|
||||
|
||||
volumes:
|
||||
- name: docker_socket
|
||||
host:
|
||||
path: /var/run/docker.sock
|
@ -1,24 +0,0 @@
|
||||
name: Golang Tests
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [ "opened", "reopened", "synchronize" ]
|
||||
push:
|
||||
branches: [ '**' ]
|
||||
tags-ignore: [ '**' ]
|
||||
|
||||
jobs:
|
||||
unittest:
|
||||
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 }}
|
||||
- env:
|
||||
GOPROXY: ${{ vars.GOPROXY }}
|
||||
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
|
@ -1,19 +0,0 @@
|
||||
name: Markdown linter
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [ "opened", "reopened", "synchronize" ]
|
||||
push:
|
||||
branches: [ '**' ]
|
||||
tags-ignore: [ '**' ]
|
||||
workflow_dispatch: {}
|
||||
|
||||
jobs:
|
||||
markdown-lint:
|
||||
runs-on:
|
||||
- ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4.2.2
|
||||
- uses: DavidAnson/markdownlint-cli2-action@v20.0.0
|
||||
with:
|
||||
globs: '**/*.md'
|
@ -1,52 +0,0 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags: [ '**' ]
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
release:
|
||||
runs-on:
|
||||
- ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4.2.2
|
||||
- uses: docker/setup-qemu-action@v3.6.0
|
||||
- uses: actions/setup-go@v5.5.0
|
||||
with:
|
||||
go-version: stable
|
||||
- uses: docker/login-action@v3.4.0
|
||||
with:
|
||||
registry: git.cryptic.systems
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GIT_CRYPTIC_SYSTEMS_PACKAGE_REGISTRY_TOKEN }}
|
||||
- env:
|
||||
GITEA_TOKEN: ${{ secrets.GIT_CRYPTIC_SYSTEMS_PACKAGE_REGISTRY_TOKEN }}
|
||||
GONOSUMDB: ${{ vars.GONOSUMDB }}
|
||||
GOPROXY: ${{ vars.GOPROXY }}
|
||||
uses: goreleaser/goreleaser-action@v6.3.0
|
||||
with:
|
||||
version: "~> v2"
|
||||
args: release --clean
|
||||
|
||||
sync-to-hub-docker-io:
|
||||
needs:
|
||||
- release
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Copy images to docker.io
|
||||
run: |
|
||||
TAG=$(echo ${{ github.ref_name }} | sed 's/v//gm')
|
||||
|
||||
apt-get update --yes
|
||||
apt-get install --yes skopeo
|
||||
skopeo copy \
|
||||
--all \
|
||||
--dest-password ${{ secrets.DOCKER_IO_PASSWORD }} \
|
||||
--dest-username ${{ secrets.DOCKER_IO_USERNAME }} \
|
||||
--src-password ${{ secrets.GIT_CRYPTIC_SYSTEMS_PACKAGE_REGISTRY_TOKEN }} \
|
||||
--src-username volker.raschek \
|
||||
docker://git.cryptic.systems/volker.raschek/dyndns-client:${TAG} \
|
||||
docker://docker.io/volkerraschek/dyndns-client:${TAG}
|
@ -1,20 +0,0 @@
|
||||
name: Update Docker Hub Description
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ 'master' ]
|
||||
paths: [ 'README.md' ]
|
||||
workflow_dispatch: {}
|
||||
|
||||
jobs:
|
||||
update-description-on-hub-docker-io:
|
||||
runs-on:
|
||||
- ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4.2.2
|
||||
- uses: peter-evans/dockerhub-description@v4.0.2
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_IO_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_IO_PASSWORD }}
|
||||
repository: volkerraschek/dyndns-client
|
||||
readme-filepath: README.md
|
175
.goreleaser.yaml
175
.goreleaser.yaml
@ -1,175 +0,0 @@
|
||||
project_name: dyndns-client
|
||||
|
||||
archives:
|
||||
- formats: [ "tar.xz" ]
|
||||
files:
|
||||
- README.md
|
||||
- LICENSE
|
||||
|
||||
before:
|
||||
hooks:
|
||||
- go mod tidy
|
||||
|
||||
builds:
|
||||
- main: main.go
|
||||
binary: >-
|
||||
{{ .ProjectName }}-
|
||||
{{- .Version }}-
|
||||
{{- .Os }}-
|
||||
{{- if eq .Arch "amd64" }}amd64
|
||||
{{- else if eq .Arch "amd64_v1" }}amd64
|
||||
{{- else }}{{ .Arch }}{{ end }}
|
||||
{{- if .Arm }}-{{ .Arm }}{{ end }}
|
||||
env:
|
||||
- CGO_ENABLED=0
|
||||
- GONOSUMDB={{ .Env.GONOSUMDB }}
|
||||
- GOPROXY={{ .Env.GOPROXY }}
|
||||
goos:
|
||||
- linux
|
||||
goarch:
|
||||
- amd64
|
||||
- arm
|
||||
- arm64
|
||||
- riscv64
|
||||
goarm:
|
||||
- "6"
|
||||
- "7"
|
||||
flags:
|
||||
- -trimpath
|
||||
ldflags:
|
||||
- -s -w -X 'main.version={{ trimprefix .Tag "v" }}'
|
||||
|
||||
changelog:
|
||||
filters:
|
||||
exclude:
|
||||
- '^chore'
|
||||
- '^docs'
|
||||
- '^test'
|
||||
- Merge pull request
|
||||
- Merge branch
|
||||
- go mod tidy
|
||||
format: "{{.SHA}}: {{.Message}} (@{{.AuthorUsername}})"
|
||||
groups:
|
||||
- title: Features
|
||||
regexp: '^.*?feat(\([[:word:]]+\))??!?:.+$'
|
||||
order: 0
|
||||
- title: "Bug fixes"
|
||||
regexp: '^.*?fix(\([[:word:]]+\))??!?:.+$'
|
||||
order: 1
|
||||
- title: Others
|
||||
order: 999
|
||||
sort: asc
|
||||
use: git
|
||||
|
||||
dockers:
|
||||
- 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/amd64
|
||||
- --pull
|
||||
dockerfile: Dockerfile
|
||||
goarch: amd64
|
||||
goos: linux
|
||||
image_templates:
|
||||
- 'git.cryptic.systems/volker.raschek/{{ .ProjectName }}:{{ trimprefix .Tag "v" }}-amd64'
|
||||
skip_push: false
|
||||
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/arm/v6
|
||||
- --pull
|
||||
dockerfile: Dockerfile
|
||||
goarch: arm
|
||||
goarm: "6"
|
||||
goos: linux
|
||||
image_templates:
|
||||
- 'git.cryptic.systems/volker.raschek/{{ .ProjectName }}:{{ trimprefix .Tag "v" }}-arm-v6'
|
||||
skip_push: false
|
||||
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/arm/v7
|
||||
- --pull
|
||||
dockerfile: Dockerfile
|
||||
goarch: arm
|
||||
goarm: "7"
|
||||
goos: linux
|
||||
image_templates:
|
||||
- 'git.cryptic.systems/volker.raschek/{{ .ProjectName }}:{{ trimprefix .Tag "v" }}-arm-v7'
|
||||
skip_push: false
|
||||
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/arm64
|
||||
- --pull
|
||||
dockerfile: Dockerfile
|
||||
goarch: arm64
|
||||
goos: linux
|
||||
image_templates:
|
||||
- 'git.cryptic.systems/volker.raschek/{{ .ProjectName }}:{{ trimprefix .Tag "v" }}-arm64'
|
||||
skip_push: false
|
||||
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:
|
||||
- name_template: 'git.cryptic.systems/volker.raschek/{{ .ProjectName }}:{{ trimprefix .Tag "v" }}'
|
||||
image_templates:
|
||||
- 'git.cryptic.systems/volker.raschek/{{ .ProjectName }}:{{ trimprefix .Tag "v" }}-amd64'
|
||||
- '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" }}-arm64'
|
||||
- 'git.cryptic.systems/volker.raschek/{{ .ProjectName }}:{{ trimprefix .Tag "v" }}-riscv64'
|
||||
|
||||
gitea_urls:
|
||||
api: https://git.cryptic.systems/api/v1
|
||||
download: https://git.cryptic.systems
|
||||
|
||||
version: 2
|
27
Dockerfile
Normal file
27
Dockerfile
Normal file
@ -0,0 +1,27 @@
|
||||
ARG BASE_IMAGE
|
||||
ARG BUILD_IMAGE
|
||||
|
||||
# BUILD
|
||||
# ===========================================
|
||||
FROM ${BUILD_IMAGE} AS build
|
||||
ADD . /workspace
|
||||
|
||||
ARG EXECUTABLE
|
||||
ARG GONOPROXY
|
||||
ARG GONOSUMDB
|
||||
ARG GOPRIVATE
|
||||
ARG GOPROXY
|
||||
ARG GOSUMDB
|
||||
ARG VERSION
|
||||
|
||||
RUN make bin/linux/amd64/${EXECUTABLE}
|
||||
|
||||
# TARGET CONTAINER
|
||||
# ===========================================
|
||||
FROM ${BASE_IMAGE}
|
||||
|
||||
ARG EXECUTABLE
|
||||
|
||||
RUN apk add --update bind-tools
|
||||
COPY --from=build /workspace/bin/linux/amd64/${EXECUTABLE} /usr/bin/${EXECUTABLE}
|
||||
ENTRYPOINT [ "/usr/bin/dyndns-client" ]
|
210
Makefile
210
Makefile
@ -1,114 +1,148 @@
|
||||
dcmergeEXECUTABLE=dyndns-client
|
||||
VERSION?=$(shell git describe --abbrev=0)+hash.$(shell git rev-parse --short HEAD)
|
||||
# VERSION
|
||||
VERSION ?= $(shell git describe --abbrev=0)+hash.$(shell git rev-parse --short HEAD)
|
||||
|
||||
# Destination directory and prefix to place the compiled binaries, documentaions
|
||||
# and other files.
|
||||
DESTDIR?=
|
||||
PREFIX?=/usr/local
|
||||
|
||||
DESTDIR ?=
|
||||
PREFIX ?= /usr/local
|
||||
EXECUTABLE := dyndns-client
|
||||
|
||||
# CONTAINER_RUNTIME
|
||||
# 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)
|
||||
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
|
||||
# BUILD_IMAGE
|
||||
BUILD_IMAGE_REGISTRY_HOST := docker.io
|
||||
BUILD_IMAGE_NAMESPACE := volkerraschek
|
||||
BUILD_IMAGE_REPOSITORY := build-image
|
||||
BUILD_IMAGE_VERSION := latest
|
||||
BUILD_IMAGE_FULLY_QUALIFIED := ${BUILD_IMAGE_REGISTRY_HOST}/${BUILD_IMAGE_NAMESPACE}/${BUILD_IMAGE_REPOSITORY}:${BUILD_IMAGE_VERSION:v%=%}
|
||||
|
||||
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}
|
||||
# BASE_IMAGE
|
||||
BASE_IMAGE_REGISTRY_HOST := docker.io
|
||||
BASE_IMAGE_NAMESPACE := library
|
||||
BASE_IMAGE_REPOSITORY := alpine
|
||||
BASE_IMAGE_VERSION := 3.12.0
|
||||
BASE_IMAGE_FULLY_QUALIFIED := ${BASE_IMAGE_REGISTRY_HOST}/${BASE_IMAGE_NAMESPACE}/${BASE_IMAGE_REPOSITORY}:${BASE_IMAGE_VERSION:v%=%}
|
||||
|
||||
# BIN
|
||||
# CONTAINER_IMAGE
|
||||
CONTAINER_IMAGE_REGISTRY_HOST := docker.io
|
||||
CONTAINER_IMAGE_REGISTRY_USER := volkerraschek
|
||||
CONTAINER_IMAGE_NAMESPACE := ${CONTAINER_IMAGE_REGISTRY_USER}
|
||||
CONTAINER_IMAGE_REPOSITORY := ${EXECUTABLE}
|
||||
CONTAINER_IMAGE_VERSION := latest
|
||||
CONTAINER_IMAGE_FULLY_QUALIFIED := ${CONTAINER_IMAGE_REGISTRY_HOST}/${CONTAINER_IMAGE_NAMESPACE}/${CONTAINER_IMAGE_REPOSITORY}:${CONTAINER_IMAGE_VERSION:v%=%}
|
||||
CONTAINER_IMAGE_UNQUALIFIED := ${CONTAINER_IMAGE_NAMESPACE}/${CONTAINER_IMAGE_REPOSITORY}:${CONTAINER_IMAGE_VERSION:v%=%}
|
||||
|
||||
# BINARIES
|
||||
# ==============================================================================
|
||||
dyndns-client:
|
||||
${EXECUTABLE}: clean bin/tmp/${EXECUTABLE}
|
||||
|
||||
bin/linux/amd64/$(EXECUTABLE):
|
||||
CGO_ENABLED=0 \
|
||||
GONOPROXY=$(shell go env GONOPROXY) \
|
||||
GONOSUMDB=$(shell go env GONOSUMDB) \
|
||||
GOPRIVATE=$(shell go env GOPRIVATE) \
|
||||
GOPROXY=$(shell go env GOPROXY) \
|
||||
go build -ldflags "-X 'main.version=${VERSION}'" -o ${@} main.go
|
||||
GOSUMDB=$(shell go env GOSUMDB) \
|
||||
GOOS=linux \
|
||||
GOARCH=amd64 \
|
||||
go build -ldflags "-X main.version=${VERSION:v%=%}" -o ${@}
|
||||
|
||||
bin/tmp/${EXECUTABLE}:
|
||||
CGO_ENABLED=0 \
|
||||
GONOPROXY=$(shell go env GONOPROXY) \
|
||||
GONOSUMDB=$(shell go env GONOSUMDB) \
|
||||
GOPRIVATE=$(shell go env GOPRIVATE) \
|
||||
GOPROXY=$(shell go env GOPROXY) \
|
||||
GOSUMDB=$(shell go env GOSUMDB) \
|
||||
go build -ldflags "-X main.version=${VERSION:v%=%}" -o ${@}
|
||||
|
||||
# TEST
|
||||
# ==============================================================================
|
||||
PHONY+=test
|
||||
test: clean bin/tmp/${EXECUTABLE}
|
||||
go test -v ./pkg/...
|
||||
|
||||
# CLEAN
|
||||
# ==============================================================================
|
||||
PHONY+=clean
|
||||
clean:
|
||||
rm --force --recursive dyndns-client
|
||||
rm --force ${EXECUTABLE} || true
|
||||
rm --force --recursive bin || true
|
||||
|
||||
# TESTS
|
||||
# CONTAINER IMAGE
|
||||
# ==============================================================================
|
||||
PHONY+=test/unit
|
||||
test/unit:
|
||||
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 --mode 0755 ${EXECUTABLE} ${DESTDIR}${PREFIX}/bin/${EXECUTABLE}
|
||||
|
||||
install --directory ${DESTDIR}${PREFIX}/share/licenses/${EXECUTABLE}
|
||||
install --mode 0644 LICENSE ${DESTDIR}${PREFIX}/share/licenses/${EXECUTABLE}/LICENSE
|
||||
|
||||
# UNINSTALL
|
||||
# ==============================================================================
|
||||
PHONY+=uninstall
|
||||
uninstall:
|
||||
-rm --force --recursive \
|
||||
${DESTDIR}/etc/bash_completion.d/${EXECUTABLE} \
|
||||
${DESTDIR}${PREFIX}/bin/${EXECUTABLE} \
|
||||
${DESTDIR}${PREFIX}/share/licenses/${EXECUTABLE}
|
||||
|
||||
# BUILD CONTAINER IMAGE
|
||||
# ==============================================================================
|
||||
PHONY+=container-image/build
|
||||
container-image/build:
|
||||
${CONTAINER_RUNTIME} build \
|
||||
--build-arg VERSION=${VERSION} \
|
||||
--file Dockerfile \
|
||||
--build-arg BASE_IMAGE=${BASE_IMAGE_FULLY_QUALIFIED} \
|
||||
--build-arg BUILD_IMAGE=${BUILD_IMAGE_FULLY_QUALIFIED} \
|
||||
--build-arg EXECUTABLE=${EXECUTABLE} \
|
||||
--build-arg GONOPROXY=$(shell go env GONOPROXY) \
|
||||
--build-arg GONOSUMDB=$(shell go env GONOSUMDB) \
|
||||
--build-arg GOPRIVATE=$(shell go env GOPRIVATE) \
|
||||
--build-arg GOPROXY=$(shell go env GOPROXY) \
|
||||
--build-arg GOSUMDB=$(shell go env GOSUMDB) \
|
||||
--build-arg VERSION=${VERSION:v%=%} \
|
||||
--no-cache \
|
||||
--pull \
|
||||
--tag ${DYNDNS_CLIENT_IMAGE_FULLY_QUALIFIED} \
|
||||
--tag ${CONTAINER_IMAGE_FULLY_QUALIFIED} \
|
||||
--tag ${CONTAINER_IMAGE_UNQUALIFIED} \
|
||||
.
|
||||
|
||||
# DELETE CONTAINER IMAGE
|
||||
# ==============================================================================
|
||||
PHONY:=container-image/delete
|
||||
container-image/delete:
|
||||
- ${CONTAINER_RUNTIME} image rm ${DYNDNS_CLIENT_IMAGE_FULLY_QUALIFIED}
|
||||
container-image/push: container-image/build
|
||||
${CONTAINER_RUNTIME} login ${CONTAINER_IMAGE_REGISTRY_HOST} --username ${CONTAINER_IMAGE_REGISTRY_USER} --password ${CONTAINER_IMAGE_REGISTRY_PASSWORD}
|
||||
${CONTAINER_RUNTIME} push ${CONTAINER_IMAGE_FULLY_QUALIFIED}
|
||||
|
||||
# PUSH CONTAINER IMAGE
|
||||
# CONTAINER RUN - TEST
|
||||
# ==============================================================================
|
||||
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+=container-run/test
|
||||
container-run/test:
|
||||
$(MAKE) container-run COMMAND=${@:container-run/%=%}
|
||||
|
||||
# CONTAINER RUN - CLEAN
|
||||
# ==============================================================================
|
||||
PHONY+=container-run/clean
|
||||
container-run/clean:
|
||||
$(MAKE) container-run COMMAND=${@:container-run/%=%}
|
||||
|
||||
# CONTAINER RUN - COMMAND
|
||||
# ==============================================================================
|
||||
PHONY+=container-run
|
||||
container-run:
|
||||
${CONTAINER_RUNTIME} run \
|
||||
--env GONOPROXY=$(shell go env GONOPROXY) \
|
||||
--env GONOSUMDB=$(shell go env GONOSUMDB) \
|
||||
--env GOPRIVATE=$(shell go env GOPRIVATE) \
|
||||
--env GOPROXY=$(shell go env GOPROXY) \
|
||||
--env GOSUMDB=$(shell go env GOSUMDB) \
|
||||
--env EPOCH=${EPOCH} \
|
||||
--env VERSION=${VERSION:v%=%} \
|
||||
--env RELEASE=${RELEASE} \
|
||||
--rm \
|
||||
--volume $(shell pwd):/workspace \
|
||||
${BUILD_IMAGE_FULLY_QUALIFIED} \
|
||||
make ${COMMAND} \
|
||||
|
||||
# UN/INSTALL
|
||||
# ==============================================================================
|
||||
PHONY+=install
|
||||
install: bin/tmp/${EXECUTABLE}
|
||||
install --directory ${DESTDIR}${PREFIX}/bin
|
||||
install --mode 755 bin/tmp/${EXECUTABLE} ${DESTDIR}${PREFIX}/bin/${EXECUTABLE}
|
||||
|
||||
install --directory ${DESTDIR}/usr/lib/systemd/system
|
||||
install --mode 644 systemd/${EXECUTABLE}.service ${DESTDIR}/usr/lib/systemd/system
|
||||
install --mode 644 systemd/${EXECUTABLE}-docker.service ${DESTDIR}/usr/lib/systemd/system
|
||||
|
||||
install --directory ${DESTDIR}/usr/share/licenses/${EXECUTABLE}
|
||||
install --mode 644 LICENSE ${DESTDIR}/usr/share/licenses/${EXECUTABLE}/LICENSE
|
||||
|
||||
PHONY+=uninstall
|
||||
uninstall:
|
||||
-rm --recursive --force \
|
||||
${DESTDIR}${PREFIX}/bin/${EXECUTABLE} \
|
||||
${DESTDIR}/usr/lib/systemd/system/${EXECUTABLE}.service \
|
||||
${DESTDIR}/usr/lib/systemd/system/${EXECUTABLE}-docker.service \
|
||||
${DESTDIR}/usr/share/licenses/${EXECUTABLE}/LICENSE
|
||||
|
||||
# PHONY
|
||||
# ==============================================================================
|
||||
# Declare the contents of the PHONY variable as phony. We keep that information
|
||||
# in a variable so we can use it in if_changed.
|
||||
.PHONY: ${PHONY}
|
||||
.PHONY: ${PHONY}
|
||||
|
@ -1,5 +1,7 @@
|
||||
# dyndns-client
|
||||
|
||||
[](https://drone.cryptic.systems/dyndns-client/dyndns-client)
|
||||
|
||||
dyndns-client is a Daemon to listen on interface notifications produced by the linux
|
||||
kernel of a client machine to update one or more DNS zones.
|
||||
|
||||
@ -38,4 +40,4 @@ required.
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
```
|
16
go.mod
16
go.mod
@ -1,14 +1,12 @@
|
||||
module git.cryptic.systems/volker.raschek/dyndns-client
|
||||
|
||||
go 1.20
|
||||
go 1.16
|
||||
|
||||
require (
|
||||
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2
|
||||
github.com/sirupsen/logrus v1.9.3
|
||||
github.com/vishvananda/netlink v1.3.1
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/vishvananda/netns v0.0.5 // indirect
|
||||
golang.org/x/sys v0.10.0 // indirect
|
||||
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d
|
||||
github.com/sirupsen/logrus v1.8.1
|
||||
github.com/stretchr/testify v1.6.1 // indirect
|
||||
github.com/vishvananda/netlink v1.1.0
|
||||
github.com/vishvananda/netns v0.0.0-20200520041808-52d707b772fe // indirect
|
||||
golang.org/x/sys v0.0.0-20200602225109-6fdc65e7d980 // indirect
|
||||
)
|
||||
|
31
go.sum
31
go.sum
@ -1,23 +1,26 @@
|
||||
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so=
|
||||
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw=
|
||||
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d h1:Byv0BzEl3/e6D5CLfI0j/7hiIEtvGVFPCZ7Ei2oq8iQ=
|
||||
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
|
||||
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
|
||||
github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE=
|
||||
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
|
||||
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/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/vishvananda/netlink v1.3.1 h1:3AEMt62VKqz90r0tmNhog0r/PpWKmrEShJU0wJW6bV0=
|
||||
github.com/vishvananda/netlink v1.3.1/go.mod h1:ARtKouGSTGchR8aMwmkzC0qiNPrrWO5JS/XMVl45+b4=
|
||||
github.com/vishvananda/netns v0.0.5 h1:DfiHV+j8bA32MFM7bfEunvT8IAqQ/NzSJHtcmW5zdEY=
|
||||
github.com/vishvananda/netns v0.0.5/go.mod h1:SpkAiCQRtJ6TvvxPnOSyH3BMl6unz3xZlaprSwhNNJM=
|
||||
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.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA=
|
||||
golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
|
||||
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/vishvananda/netlink v1.1.0 h1:1iyaYNBLmP6L0220aDnYQpo1QEV4t4hJ+xEEhhJH8j0=
|
||||
github.com/vishvananda/netlink v1.1.0/go.mod h1:cTgwzPIzzgDAYoQrMm0EdrjRUBkTqKYppBueQtXaqoE=
|
||||
github.com/vishvananda/netns v0.0.0-20191106174202-0a2b9b5464df/go.mod h1:JP3t17pCcGlemwknint6hfoeCVQrEMVwxRLRjXpq+BU=
|
||||
github.com/vishvananda/netns v0.0.0-20200520041808-52d707b772fe h1:mjAZxE1nh8yvuwhGHpdDqdhtNu2dgbpk93TwoXuk5so=
|
||||
github.com/vishvananda/netns v0.0.0-20200520041808-52d707b772fe/go.mod h1:DD4vA1DwXk04H54A1oHXtwZmA0grkVMdPxx/VGLCah0=
|
||||
golang.org/x/sys v0.0.0-20190606203320-7fc4e5ec1444/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200217220822-9197077df867/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200602225109-6fdc65e7d980 h1:OjiUf46hAmXblsZdnoSXsEUSKU8r1UEzcL5RVZ4gO9Y=
|
||||
golang.org/x/sys v0.0.0-20200602225109-6fdc65e7d980/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
|
9
main.go
9
main.go
@ -1,7 +1,6 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"os"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
@ -11,11 +10,11 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
version string
|
||||
configPath string
|
||||
version string
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
||||
switch os.Getenv("DYNDNS_CLIENT_LOGGER_LEVEL") {
|
||||
case "DEBUG", "debug":
|
||||
log.SetLevel(log.DebugLevel)
|
||||
@ -42,11 +41,9 @@ func main() {
|
||||
})
|
||||
}
|
||||
|
||||
flag.StringVar(&configPath, "config", "/etc/dyndns-client/config.json", "Path to json config")
|
||||
|
||||
log.Infof("version %v", version)
|
||||
|
||||
cnf, err := config.Read(configPath)
|
||||
cnf, err := config.Read("/etc/dyndns-client/config.json")
|
||||
if err != nil {
|
||||
log.Fatal(err.Error())
|
||||
}
|
||||
|
@ -37,9 +37,9 @@ func GetDefaultConfiguration() (*types.Config, error) {
|
||||
|
||||
// Read config from a file
|
||||
func Read(cnfFile string) (*types.Config, error) {
|
||||
|
||||
// Load burned in configuration if config not available
|
||||
if _, err := os.Stat(cnfFile); os.IsNotExist(err) {
|
||||
// #nosec G301
|
||||
if err := os.MkdirAll(filepath.Dir(cnfFile), 0755); err != nil {
|
||||
return nil, fmt.Errorf("failed to create directory: %w", err)
|
||||
}
|
||||
@ -58,12 +58,11 @@ func Read(cnfFile string) (*types.Config, error) {
|
||||
return cnf, nil
|
||||
}
|
||||
|
||||
// #nosec G304
|
||||
f, err := os.Open(cnfFile)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to open file: %w", err)
|
||||
}
|
||||
defer func() { _ = f.Close() }()
|
||||
defer f.Close()
|
||||
|
||||
cnf := new(types.Config)
|
||||
jsonDecoder := json.NewDecoder(f)
|
||||
@ -99,19 +98,17 @@ func Read(cnfFile string) (*types.Config, error) {
|
||||
// Write config into a file
|
||||
func Write(cnf *types.Config, cnfFile string) error {
|
||||
if _, err := os.Stat(filepath.Dir(cnfFile)); os.IsNotExist(err) {
|
||||
// #nosec G301
|
||||
err := os.MkdirAll(filepath.Dir(cnfFile), 0755)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// #nosec G304
|
||||
f, err := os.Create(cnfFile)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create file %v: %v", cnfFile, err)
|
||||
}
|
||||
defer func() { _ = f.Close() }()
|
||||
defer f.Close()
|
||||
|
||||
jsonEncoder := json.NewEncoder(f)
|
||||
jsonEncoder.SetIndent("", " ")
|
||||
@ -152,7 +149,7 @@ func getOutboundIP() net.IP {
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
defer func() { _ = conn.Close() }()
|
||||
defer conn.Close()
|
||||
localAddr := conn.LocalAddr().(*net.UDPAddr)
|
||||
return localAddr.IP
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ func Start(cnf *types.Config) {
|
||||
for {
|
||||
interfaces, err := netlink.LinkList()
|
||||
if err != nil {
|
||||
log.Fatalf("%v", err.Error())
|
||||
log.Fatal("%v", err.Error())
|
||||
}
|
||||
|
||||
select {
|
||||
@ -99,7 +99,7 @@ func Start(cnf *types.Config) {
|
||||
interfaceLogger.Error(err.Error())
|
||||
}
|
||||
} else {
|
||||
err = removeIPRecords(daemonCtx, interfaceLogger, updaters, cnf.Zones, recordType)
|
||||
err = removeIPRecords(daemonCtx, interfaceLogger, updaters, cnf.Zones, recordType, update.LinkAddress.IP)
|
||||
if err != nil {
|
||||
interfaceLogger.Error(err.Error())
|
||||
}
|
||||
@ -146,6 +146,7 @@ func searchInterfaceByIndex(index int, interfaces []netlink.Link) (netlink.Link,
|
||||
}
|
||||
|
||||
func addIPRecords(ctx context.Context, logEntry *log.Entry, updaters map[string]updater.Updater, zones map[string]*types.Zone, recordType string, ip net.IP) error {
|
||||
|
||||
var (
|
||||
errorChannel = make(chan error, len(zones))
|
||||
wg = new(sync.WaitGroup)
|
||||
@ -165,6 +166,7 @@ func addIPRecords(ctx context.Context, logEntry *log.Entry, updaters map[string]
|
||||
wg.Add(1)
|
||||
|
||||
go func(ctx context.Context, zoneName string, hostname string, recordType string, ip net.IP, wg *sync.WaitGroup) {
|
||||
|
||||
zoneLogger := logEntry.WithFields(log.Fields{
|
||||
"zone": zoneName,
|
||||
"hostname": hostname,
|
||||
@ -184,6 +186,7 @@ func addIPRecords(ctx context.Context, logEntry *log.Entry, updaters map[string]
|
||||
}
|
||||
|
||||
zoneLogger.Info("dns-record successfully updated")
|
||||
|
||||
}(ctx, zoneName, hostname, recordType, ip, wg)
|
||||
}
|
||||
|
||||
@ -200,6 +203,7 @@ func addIPRecords(ctx context.Context, logEntry *log.Entry, updaters map[string]
|
||||
}
|
||||
|
||||
func pruneRecords(ctx context.Context, updaters map[string]updater.Updater, zones map[string]*types.Zone) error {
|
||||
|
||||
var (
|
||||
errorChannel = make(chan error, len(zones))
|
||||
wg = new(sync.WaitGroup)
|
||||
@ -246,7 +250,8 @@ func pruneRecords(ctx context.Context, updaters map[string]updater.Updater, zone
|
||||
return nil
|
||||
}
|
||||
|
||||
func removeIPRecords(ctx context.Context, logEntry *log.Entry, updaters map[string]updater.Updater, zones map[string]*types.Zone, recordType string) error {
|
||||
func removeIPRecords(ctx context.Context, logEntry *log.Entry, updaters map[string]updater.Updater, zones map[string]*types.Zone, recordType string, ip net.IP) error {
|
||||
|
||||
var (
|
||||
errorChannel = make(chan error, len(zones))
|
||||
wg = new(sync.WaitGroup)
|
||||
@ -285,6 +290,7 @@ func removeIPRecords(ctx context.Context, logEntry *log.Entry, updaters map[stri
|
||||
}
|
||||
|
||||
zoneLogger.Info("dns-record successfully removed")
|
||||
|
||||
}(ctx, zoneName, hostname, recordType, wg)
|
||||
}
|
||||
|
||||
@ -303,6 +309,7 @@ func removeIPRecords(ctx context.Context, logEntry *log.Entry, updaters map[stri
|
||||
// verifyHostname returns a boolean if the hostname id valid. The hostname does
|
||||
// not contains any dot or local, localhost, localdomain.
|
||||
func verifyHostname(hostname string) bool {
|
||||
|
||||
if !validHostname.MatchString(hostname) {
|
||||
return false
|
||||
}
|
||||
|
@ -46,7 +46,6 @@ func (u *NSUpdate) execute(ctx context.Context, nsUpdateCmd string) error {
|
||||
|
||||
errBuffer := new(bytes.Buffer)
|
||||
|
||||
// #nosec G204
|
||||
cmd := exec.CommandContext(ctx, "nsupdate", "-y", fmt.Sprintf("%v:%v:%v", u.tsigKey.Algorithm, u.tsigKey.Name, u.tsigKey.Secret))
|
||||
// cmd.Stdout = os.Stdout
|
||||
cmd.Stderr = bufio.NewWriter(errBuffer)
|
||||
|
@ -1,21 +0,0 @@
|
||||
{
|
||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||
"extends": [
|
||||
"local>volker.raschek/renovate-config:default#master",
|
||||
"local>volker.raschek/renovate-config:container#master",
|
||||
"local>volker.raschek/renovate-config:actions#master",
|
||||
"local>volker.raschek/renovate-config:golang#master",
|
||||
"local>volker.raschek/renovate-config:regexp#master"
|
||||
],
|
||||
"packageRules": [
|
||||
{
|
||||
"enabled": false,
|
||||
"matchDatasources":[
|
||||
"go"
|
||||
],
|
||||
"matchPackageNames": [
|
||||
"^github\\.com/asaskevich/govalidator"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
13
systemd/dyndns-client-docker.service
Normal file
13
systemd/dyndns-client-docker.service
Normal file
@ -0,0 +1,13 @@
|
||||
[Unit]
|
||||
Description=dyndns-client
|
||||
Requires=docker.service network-online.target time-sync.target
|
||||
After=docker.service network-online.target time-sync.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStartPre=/usr/bin/docker pull docker.io/volkerraschek/dyndns-client:latest
|
||||
ExecStart=/usr/bin/docker run --name=dyndns-client --network=host --privileged --rm --volume /etc/dyndns-client:/etc/dyndns-client docker.io/volkerraschek/dyndns-client:latest
|
||||
ExecStop=/usr/bin/docker stop dyndns-client
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
Loading…
x
Reference in New Issue
Block a user