diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..989b368 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +.git +.github +example* diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 9915675..afb2fe4 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -1,4 +1,4 @@ -name: docker +name: build on: create: @@ -6,39 +6,37 @@ on: - v* jobs: - docker: + build: + # https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#standard-github-hosted-runners-for-public-repositories runs-on: ubuntu-latest + steps: - name: Checkout uses: actions/checkout@main - name: Get Version id: get_version - run: echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT shell: bash + run: echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 - name: Login Docker Hub - uses: docker/login-action@master + uses: docker/login-action@v3 with: username: ${{ secrets.DOCKER_HUB_USERNAME }} password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} - - name: Build and Push Docker - shell: bash - run: | - SERVICE_NAME=ddns - TARGET_PATH=build - DOCKER_REPO=gitsang - VERSION=${{ steps.get_version.outputs.VERSION }} - - mkdir -p ${TARGET_PATH} ${TARGET_PATH}/bin ${TARGET_PATH}/conf ${TARGET_PATH}/log - CGO_ENABLED=0 go build \ - -ldflags "-X ddns/pkg/config.Version=${VERSION}" \ - -o ${TARGET_PATH}/bin/${SERVICE_NAME} cmd/${SERVICE_NAME}.go - cp configs/template.yml ${TARGET_PATH}/conf - - docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v6/linux/arm/v7,linux/arm/v8 \ - -f Dockerfile --no-cache \ - --build-arg DOCKER_PACKAGE_PATH=${TARGET_PATH} \ - -t ${DOCKER_REPO}/${SERVICE_NAME}:${VERSION} \ - --push . \ No newline at end of file + - name: Build and Push + uses: docker/build-push-action@v6 + with: + context: . + file: Dockerfile + push: true + tags: 'gitsang/ddns:latest, gitsang/ddns:${{ steps.get_version.outputs.VERSION }}' + platforms: linux/amd64, linux/arm64, linux/arm/v7 + build-args: VERSION=${{ steps.get_version.outputs.VERSION }} diff --git a/.gitignore b/.gitignore index 31e9447..a4e4a65 100644 --- a/.gitignore +++ b/.gitignore @@ -1,22 +1,2 @@ -# Binaries for programs and plugins -*.exe -*.exe~ -*.dll -*.so -*.dylib - -# make target -/bin -/target -/build -/ddns -*.tar.gz - -# Test binary, built with `go test -c` -*.test - -# Output of the go coverage tool, specifically when used with LiteIDE -*.out - -# Dependency directories (remove the comment below to include it) -# vendor/ +# dist +/dist diff --git a/Dockerfile b/Dockerfile index eaa1a09..a4ecab0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,16 +1,24 @@ -FROM ubuntu +FROM golang:1.22-bookworm AS builder -ARG DOCKER_PACKAGE_PATH -ENV DOCKER_PACKAGE_PATH ${DOCKER_PACKAGE_PATH} +ARG VERSION=latest -ENV SERVICE_NAME=ddns -ENV SERVICE_HOME=/opt/${SERVICE_NAME} -ENV PATH=$PATH:${SERVICE_HOME}/bin +ENV GO111MODULE=on + +RUN apt update \ + && apt install -y --no-install-recommends git \ + && rm -rf /var/lib/apt/lists/* \ + && go install github.com/gitsang/ddns@${VERSION} + +FROM debian:bookworm AS dist + +LABEL maintainer="sang " + +RUN apt update \ + && apt install -y --no-install-recommends apt-transport-https ca-certificates curl \ + && rm -rf /var/lib/apt/lists/* -COPY ${DOCKER_PACKAGE_PATH} ${SERVICE_HOME} -RUN apt update -RUN apt install -y --no-install-recommends ca-certificates curl RUN update-ca-certificates -WORKDIR ${SERVICE_HOME}/bin -ENTRYPOINT [ "ddns" ] +COPY --from=builder /go/bin/ddns /usr/bin/ddns + +ENTRYPOINT [ "/usr/bin/ddns" ] diff --git a/LICENSE b/LICENSE index f3d3ebd..1f0e05f 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2021 sangria +Copyright (c) 2024 Sang Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/Makefile b/Makefile index 18b2cd0..e962a10 100644 --- a/Makefile +++ b/Makefile @@ -1,77 +1,127 @@ -.PHONY: default help build docker +# repo +NAME=ddns -SERVICE_NAME=ddns -TARGET_PATH=build -DOCKER_REPO=gitsang -VERSION=$(shell git describe --tags) +# version +VERSION=$(shell git describe --tags --always --dirty) +BUILD_DATE=$(shell date -u --iso-8601=seconds) -default: help +# system +SHELL := /usr/bin/env bash -help: ## show help +# go +GO := go +GOHOSTOS := $(shell $(GO) env GOHOSTOS) +GOPATH := $(shell $(GO) env GOPATH) +GO_VERSION := $(shell $(GO) version | awk '{print $$3}') +GOOS := $(if $(GOOS),$(GOOS),$(shell $(GO) env GOOS)) +GOARCH := $(if $(GOARCH),$(GOARCH),$(shell $(GO) env GOARCH)) +GO_MODULE := $(shell awk '/module/{print $$2}' go.mod) +GIT_COMMIT := $(shell git rev-parse HEAD) +DIST := dist/$(NAME)/$(GOOS)/$(GOARCH) - @echo -e "Usage: \n\tmake \033[36m[option]\033[0m" - @echo -e "Options:" - @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\t\033[36m%-20s\033[0m %s\n", $$1, $$2}' +# build +LD_FLAGS += -X "main.Version=$(VERSION)" +LD_FLAGS += -X "main.BuildDate=$(BUILD_DATE)" +LD_FLAGS += -X "main.GoVersion=$(GO_VERSION)" +LD_FLAGS += -X "main.GOOS=$(GOOS)" +LD_FLAGS += -X "main.GOARCH=$(GOARCH)" +LD_FLAGS += -X "main.GitCommit=$(shell git rev-parse HEAD)" +# docker +DOCKER = docker +DOCKER_REGISTRY = gitsang -LD_FLAGS=-ldflags "-X ddns/pkg/config.Version=$(VERSION)" -clean: ## clean build target +#------------------------------------------------------------------------------# +##@ Debug +#------------------------------------------------------------------------------# - rm -fr $(TARGET_PATH) - rm -f *.tar.gz -build: clean ## build target +.PHONY: test +## run tests +test: + $(GO) test -race ./... - mkdir -p $(TARGET_PATH) $(TARGET_PATH)/bin $(TARGET_PATH)/conf $(TARGET_PATH)/log - go build $(LD_FLAGS) -o $(TARGET_PATH)/bin/$(SERVICE_NAME) cmd/$(SERVICE_NAME).go - cp configs/template.yml $(TARGET_PATH)/conf - cp configs/ddns.service $(TARGET_PATH)/conf -download: ## download package +.PHONY: run +## run +run: + $(GO) run . \ + $(filter-out $@, $(MAKECMDGOALS)) - mkdir -p $(TARGET_PATH) $(TARGET_PATH)/bin $(TARGET_PATH)/conf $(TARGET_PATH)/log - wget -c https://github.com/gitsang/ddns/releases/download/v0.0.11/ddns -P $(TARGET_PATH)/bin/ - wget -c https://github.com/gitsang/ddns/releases/download/v0.0.11/template.yml -P $(TARGET_PATH)/conf/ - wget -c https://github.com/gitsang/ddns/releases/download/v0.0.11/ddns.service -P $(TARGET_PATH)/conf/ -tag: build ## make tgz package +#------------------------------------------------------------------------------# +##@ Build +#------------------------------------------------------------------------------# - cp -r $(TARGET_PATH) $(SERVICE_NAME) - tar zcvf $(SERVICE_NAME).$(VERSION).tar.gz $(SERVICE_NAME) - rm -fr $(SERVICE_NAME) -docker: build ## build docker +BUILD_DIRS := $(DIST) - docker build -f Dockerfile --no-cache \ - --build-arg DOCKER_PACKAGE_PATH=$(TARGET_PATH) \ - -t $(DOCKER_REPO)/$(SERVICE_NAME):$(VERSION) . - docker tag $(DOCKER_REPO)/$(SERVICE_NAME):$(VERSION) $(DOCKER_REPO)/$(SERVICE_NAME):latest -publish: docker ## publish docker to docker repo +$(BUILD_DIRS): + @mkdir -p $@ - docker push $(DOCKER_REPO)/$(SERVICE_NAME):$(VERSION) - docker push $(DOCKER_REPO)/$(SERVICE_NAME):latest -pull: ## pull latest published docker +.PHONY: build +## build +build: + $(GO) build -o $(DIST)/$(NAME) . - docker pull $(DOCKER_REPO)/$(SERVICE_NAME):latest -install: ## install by systemd +.PHONY: docker +DOCKERFILE ?= Dockerfile +## build docker +docker: $(BUILD_DIRS) + $(DOCKER) build \ + --no-cache \ + --build-arg VERSION=$(shell git rev-parse HEAD) \ + -t $(DOCKER_REGISTRY)/$(NAME):$(VERSION) \ + -f $(DOCKERFILE) . - cp $(TARGET_PATH)/bin/$(SERVICE_NAME) /usr/local/bin/ - cp configs/ddns.service /etc/systemd/system/ - cp configs/template.yml /usr/local/etc/ddns/ddns.yml - mkdir -p /var/log/ddns/ -docker-install: docker ## build docker and run +.PHONY: publish +## publish docker +publish: + $(DOCKER) push $(DOCKER_REGISTRY)/$(NAME):$(VERSION) - mkdir -p /data/ddns/conf /data/ddns/log - docker rm -f ddns - docker run -d \ - --name ddns \ - --restart always \ - --network host \ - -v /data/ddns/conf/ddns.yml:/opt/ddns/conf/ddns.yml \ - -v /data/ddns/log:/opt/ddns/log \ - $(DOCKER_REPO)/$(SERVICE_NAME):latest + + +#------------------------------------------------------------------------------# +##@ Clean +#------------------------------------------------------------------------------# + + +.PHONY: clean +## clean up git repo +clean: + git clean -xfd + rm -fr $(DIST) + + +#------------------------------------------------------------------------------# +##@ Help +#------------------------------------------------------------------------------# + + +## display help +help: + @awk 'BEGIN \ + { \ + FS = ":.*##"; \ + printf "\nUsage:\n make \033[36m\033[0m\n" \ + } \ + /^[0-9a-zA-Z\_\-]+:/ \ + { \ + helpMessage = match(lastLine, /^## (.*)/); \ + if (helpMessage) { \ + helpCommand = substr($$1, 0, index($$1, ":")-1); \ + helpMessage = substr(lastLine, RSTART + 2, RLENGTH); \ + printf " \033[36m%-24s\033[0m %s\n", helpCommand,helpMessage; \ + } \ + } { lastLine = $$0 } \ + /^##@/ \ + { \ + printf "\n\033[1m%s\033[0m\n", substr($$0, 5) \ + } ' $(MAKEFILE_LIST) + +.DEFAULT_GOAL := help diff --git a/README.md b/README.md index 3808595..c2c22a3 100644 --- a/README.md +++ b/README.md @@ -1,49 +1,22 @@ -# ddns +# DDNS ddns service -## run docker +## Run with Compose -```sh -mkdir -p /data/ddns/conf /data/ddns/log -docker rm -f ddns -docker run -d \ - --name ddns \ - --restart always \ - --network host \ - -v ./conf:/opt/ddns/conf \ - -v ./log:/opt/ddns/log \ - gitsang/ddns:latest -``` +Docker image from [https://hub.docker.com/r/gitsang/ddns](https://hub.docker.com/r/gitsang/ddns) -## config - -example of `./conf/ddns.yml` - -```yml -accesskeyid: -accesskeysecret: -domain: -updateintervalmin: 60 -ddnss: - - enable: false - type: "A" - rr: "template.home" - interface: "ens18" - prefix: "192.168" - - enable: false - type: "A" - rr: "*.template.home" - interface: "ens18" - prefix: "192.168" - - enable: false - type: "AAAA" - rr: "template6.home" - interface: "ens18" - prefix: "240e" - - enable: false - type: "AAAA" - rr: "*.template6.home" - interface: "ens18" - prefix: "240e" ``` +services: + ddns: + container_name: ddns + image: gitsang/ddns:latest + restart: always + network_mode: host + volumes: + - ./config.yaml:/etc/ddns/config.yaml + - /var/log/ddns:/var/log/ddns + command: -c /etc/ddns/config.yaml +``` + +Config file example see [./configs/example.yaml](./configs/example.yaml) diff --git a/configs/template.yml b/configs/example.yaml similarity index 100% rename from configs/template.yml rename to configs/example.yaml diff --git a/go.mod b/go.mod index 5890fc5..abe8947 100644 --- a/go.mod +++ b/go.mod @@ -7,13 +7,10 @@ require ( github.com/alibabacloud-go/darabonba-openapi v0.1.4 github.com/alibabacloud-go/tea v1.1.15 github.com/docker/go-units v0.5.0 - github.com/gitsang/golog v0.1.3 - github.com/jinzhu/configor v1.2.1 github.com/mcuadros/go-defaults v1.2.0 github.com/natefinch/lumberjack v2.0.0+incompatible github.com/spf13/cobra v1.8.1 github.com/spf13/viper v1.19.0 - go.uber.org/zap v1.27.0 gopkg.in/yaml.v3 v3.0.1 gotest.tools/v3 v3.5.1 ) @@ -49,5 +46,5 @@ require ( golang.org/x/sys v0.18.0 // indirect golang.org/x/text v0.14.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect - gopkg.in/yaml.v2 v2.2.8 // indirect + gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect ) diff --git a/go.sum b/go.sum index 902df61..c46c233 100644 --- a/go.sum +++ b/go.sum @@ -1,4 +1,3 @@ -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v1.0.0 h1:dtDWrepsVPfW9H/4y7dDgFc2MBUSeJhlaDtK13CxFlU= github.com/BurntSushi/toml v1.0.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/alibabacloud-go/alidns-20150109/v2 v2.0.1 h1:ZRIQVzRvb1HJA/kdGL8NSqVh3ZPK40gnr8iqALTBXoA= @@ -26,7 +25,6 @@ github.com/alibabacloud-go/tea-utils v1.3.9 h1:TtbzxS+BXrisA7wzbAMRtlU8A2eWLg0uf github.com/alibabacloud-go/tea-utils v1.3.9/go.mod h1:EI/o33aBfj3hETm4RLiAxF/ThQdSngxrpF8rKUDJjPE= github.com/aliyun/credentials-go v1.1.2 h1:qU1vwGIBb3UJ8BwunHDRFtAhS6jnQLnde/yk0+Ih2GY= github.com/aliyun/credentials-go v1.1.2/go.mod h1:ozcZaMR5kLM7pwtCMEpVmQ242suV6qTJya2bDq4X1Tw= -github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -38,8 +36,6 @@ github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHk github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= -github.com/gitsang/golog v0.1.3 h1:/XcRVSI2/xVmET0sGD1hTl4y7KZrX181UGCrSRxwmS0= -github.com/gitsang/golog v0.1.3/go.mod h1:Tdz1uw3pAyJkCDRyL+r4hwIacAGPnj3/vzmQEOWVnAM= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= @@ -49,13 +45,10 @@ github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= -github.com/jinzhu/configor v1.2.1 h1:OKk9dsR8i6HPOCZR8BcMtcEImAFjIhbJFZNyn5GCZko= -github.com/jinzhu/configor v1.2.1/go.mod h1:nX89/MOmDba7ZX7GCyU/VIaQ2Ar2aizBl2d3JLF/rDc= github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= @@ -81,7 +74,6 @@ github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWb github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= @@ -114,7 +106,6 @@ github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpE github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= @@ -126,77 +117,54 @@ github.com/tjfoc/gmsm v1.3.2 h1:7JVkAn5bvUJ7HtU08iW6UiD+UTmJTIToHCfeFzkcCxM= github.com/tjfoc/gmsm v1.3.2/go.mod h1:HaUcFuY0auTiaHB9MHFGCPx5IaLhTUd2atbCFBQXn9w= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.30/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= -go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= -go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= -go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= -go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.10.0 h1:S0h4aNzvfcFsC3dRF1jLoaov7oRaKqRGC/pUEJ2yvPQ= go.uber.org/multierr v1.10.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= -go.uber.org/zap v1.21.0/go.mod h1:wjWOCqI0f2ZZrJF/UufIOkiC8ii6tm1iqIsLo76RfJw= -go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= -go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191219195013-becbf705a915/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g= golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k= -golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs= golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200509044756-6aff5f38e54f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200509030707-2212a7e161a5/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/ini.v1 v1.56.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8= -gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= +gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc= +gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools/v3 v3.5.1 h1:EENdUnS3pdur5nybKYIh2Vfgc8IUNBjxDPSjtiJcOzU= diff --git a/cmd/logger.go b/logger.go similarity index 100% rename from cmd/logger.go rename to logger.go diff --git a/cmd/main.go b/main.go similarity index 100% rename from cmd/main.go rename to main.go diff --git a/script/deploy.sh b/script/deploy.sh deleted file mode 100755 index 419840b..0000000 --- a/script/deploy.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -VERSION=v0.0.10 -BIN_PATH=/usr/local/bin -SERVICE_PATH=/etc/systemd/system -CONF_PATH=/usr/local/etc/ddns -LOG_PATH=/var/log/ddns - -mkdir -p ${BIN_PATH} ${SERVICE_PATH} ${CONF_PATH} ${LOG_PATH} - -wget https://github.com/gitsang/ddns/releases/download/${VERSION}/ddns -O ${BIN_PATH}/ddns -wget https://github.com/gitsang/ddns/releases/download/${VERSION}/ddns.service -O ${SERVICE_PATH}/ddns.service -wget https://github.com/gitsang/ddns/releases/download/${VERSION}/ddns.yml -O ${CONF_PATH}/ddns.yml - -systemctl enable ddns.service -systemctl restart ddns.service