Rename module
This commit is contained in:
parent
4abd68e9f0
commit
a175f5d569
18
.pre-commit-config.yaml
Normal file
18
.pre-commit-config.yaml
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
repos:
|
||||||
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||||
|
rev: v4.2.0
|
||||||
|
hooks:
|
||||||
|
- id: trailing-whitespace
|
||||||
|
args: [--markdown-linebreak-ext=.gitignore]
|
||||||
|
- id: end-of-file-fixer
|
||||||
|
- id: check-yaml
|
||||||
|
- repo: https://github.com/tekwizely/pre-commit-golang
|
||||||
|
rev: v1.0.0-beta.5
|
||||||
|
hooks:
|
||||||
|
- id: go-mod-tidy
|
||||||
|
- id: go-imports
|
||||||
|
args: [-w]
|
||||||
|
- repo: https://github.com/golangci/golangci-lint
|
||||||
|
rev: v1.46.2
|
||||||
|
hooks:
|
||||||
|
- id: golangci-lint
|
@ -9,12 +9,11 @@ WORKDIR /app
|
|||||||
|
|
||||||
COPY go.mod ./
|
COPY go.mod ./
|
||||||
COPY go.sum ./
|
COPY go.sum ./
|
||||||
COPY go-external-ip ./
|
|
||||||
RUN go mod download
|
RUN go mod download
|
||||||
|
|
||||||
COPY . ./
|
COPY . ./
|
||||||
|
|
||||||
RUN go build ./cmd/cloud-dyndns-client
|
RUN go build ./cmd/godyn
|
||||||
|
|
||||||
##
|
##
|
||||||
## Deploy
|
## Deploy
|
||||||
@ -24,8 +23,8 @@ FROM gcr.io/distroless/base-debian10
|
|||||||
|
|
||||||
WORKDIR /
|
WORKDIR /
|
||||||
|
|
||||||
COPY --from=build /app/cloud-dyndns-client /cloud-dyndns-client
|
COPY --from=build /app/godyn /godyn
|
||||||
|
|
||||||
USER nonroot:nonroot
|
USER nonroot:nonroot
|
||||||
|
|
||||||
ENTRYPOINT ["/cloud-dyndns-client"]
|
ENTRYPOINT ["/godyn"]
|
||||||
|
@ -30,9 +30,9 @@ import (
|
|||||||
|
|
||||||
"golang.org/x/sync/errgroup"
|
"golang.org/x/sync/errgroup"
|
||||||
|
|
||||||
"github.com/lordwelch/godyn/pkg/backend"
|
"git.narnian.us/lordwelch/godyn/pkg/backend"
|
||||||
"github.com/lordwelch/godyn/pkg/backend/gcp"
|
"git.narnian.us/lordwelch/godyn/pkg/backend/gcp"
|
||||||
"github.com/lordwelch/godyn/pkg/sync"
|
"git.narnian.us/lordwelch/godyn/pkg/sync"
|
||||||
)
|
)
|
||||||
|
|
||||||
// VERSION is the current version of the application.
|
// VERSION is the current version of the application.
|
||||||
@ -213,12 +213,15 @@ func main() {
|
|||||||
log.Printf("Updating IPv4 to %v", ip)
|
log.Printf("Updating IPv4 to %v", ip)
|
||||||
for _, r := range records {
|
for _, r := range records {
|
||||||
if r.Record.Type() == "A" {
|
if r.Record.Type() == "A" {
|
||||||
syncer.UpdateRecord(
|
err := syncer.UpdateRecord(
|
||||||
r.Record.Name(),
|
r.Record.Name(),
|
||||||
r.Record.Type(),
|
r.Record.Type(),
|
||||||
r.Record.Ttl(),
|
r.Record.Ttl(),
|
||||||
[]string{ip},
|
[]string{ip},
|
||||||
)
|
)
|
||||||
|
if err != nil {
|
||||||
|
log.Println(err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case ip := <-ip6c:
|
case ip := <-ip6c:
|
||||||
@ -232,7 +235,7 @@ func main() {
|
|||||||
[]string{ip},
|
[]string{ip},
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintln(os.Stderr, err)
|
log.Println(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -249,7 +252,7 @@ func main() {
|
|||||||
// shutdown the http server.
|
// shutdown the http server.
|
||||||
mux := http.NewServeMux()
|
mux := http.NewServeMux()
|
||||||
mux.HandleFunc("/_status/healthz", func(w http.ResponseWriter, r *http.Request) {
|
mux.HandleFunc("/_status/healthz", func(w http.ResponseWriter, r *http.Request) {
|
||||||
w.Write([]byte("OK"))
|
_, _ = w.Write([]byte("OK"))
|
||||||
})
|
})
|
||||||
|
|
||||||
srv := &http.Server{
|
srv := &http.Server{
|
20
go.mod
20
go.mod
@ -1,6 +1,6 @@
|
|||||||
module github.com/lordwelch/godyn
|
module git.narnian.us/lordwelch/godyn
|
||||||
|
|
||||||
go 1.16
|
go 1.18
|
||||||
|
|
||||||
require (
|
require (
|
||||||
git.narnian.us/lordwelch/externalip v1.0.0
|
git.narnian.us/lordwelch/externalip v1.0.0
|
||||||
@ -8,3 +8,19 @@ require (
|
|||||||
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac
|
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac
|
||||||
google.golang.org/api v0.52.0
|
google.golang.org/api v0.52.0
|
||||||
)
|
)
|
||||||
|
|
||||||
|
require (
|
||||||
|
cloud.google.com/go v0.88.0 // indirect
|
||||||
|
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect
|
||||||
|
github.com/golang/protobuf v1.5.2 // indirect
|
||||||
|
github.com/googleapis/gax-go/v2 v2.0.5 // indirect
|
||||||
|
go.opencensus.io v0.23.0 // indirect
|
||||||
|
golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420 // indirect
|
||||||
|
golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914 // indirect
|
||||||
|
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c // indirect
|
||||||
|
golang.org/x/text v0.3.6 // indirect
|
||||||
|
google.golang.org/appengine v1.6.7 // indirect
|
||||||
|
google.golang.org/genproto v0.0.0-20210722135532-667f2b7c528f // indirect
|
||||||
|
google.golang.org/grpc v1.39.0 // indirect
|
||||||
|
google.golang.org/protobuf v1.27.1 // indirect
|
||||||
|
)
|
||||||
|
@ -23,7 +23,7 @@ import (
|
|||||||
"golang.org/x/time/rate"
|
"golang.org/x/time/rate"
|
||||||
dns "google.golang.org/api/dns/v1"
|
dns "google.golang.org/api/dns/v1"
|
||||||
|
|
||||||
"github.com/lordwelch/godyn/pkg/backend"
|
"git.narnian.us/lordwelch/godyn/pkg/backend"
|
||||||
)
|
)
|
||||||
|
|
||||||
type cloudDNSRecord struct {
|
type cloudDNSRecord struct {
|
||||||
|
@ -30,12 +30,6 @@ const (
|
|||||||
IP6 IPType = 6
|
IP6 IPType = 6
|
||||||
)
|
)
|
||||||
|
|
||||||
var webCheck = []string{
|
|
||||||
"http://checkip.dyndns.org/",
|
|
||||||
"http://ipdetect.dnspark.com/",
|
|
||||||
"http://dns.loopia.se/checkip/checkip.php",
|
|
||||||
}
|
|
||||||
|
|
||||||
// IPAddressPoller is a poller used to check the value
|
// IPAddressPoller is a poller used to check the value
|
||||||
// of the current public internet IP address.
|
// of the current public internet IP address.
|
||||||
type IPAddressPoller struct {
|
type IPAddressPoller struct {
|
||||||
|
@ -23,7 +23,7 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/lordwelch/godyn/pkg/backend"
|
"git.narnian.us/lordwelch/godyn/pkg/backend"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Record struct {
|
type Record struct {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user