Compare commits

...

122 Commits

Author SHA1 Message Date
Quentin McGaw
40f8009e01 docs(readme): fix linting error 2026-01-17 08:17:30 +00:00
dependabot[bot]
f04b830420 chore(deps): bump peter-evans/dockerhub-description from 4 to 5 (#1085) 2026-01-14 17:11:17 +01:00
dependabot[bot]
3ab32f83c5 chore(deps): bump github/codeql-action from 3 to 4 (#1086) 2026-01-14 17:10:55 +01:00
Michael Kölle
61e282f959 docs(ionos): Add api-key structure clarification (#996) 2026-01-13 09:49:07 -08:00
jccint
f2adf3fc20 test(config): take into account the OS specific file separator (#985) 2026-01-13 09:42:53 -08:00
Mynacol
01d3cd1383 fix(njalla): add trailing slash to URL path (#978) 2026-01-13 09:40:50 -08:00
Jeroen
2455055d20 docs(readme): add missing link to Hetzner doc (#977) 2026-01-13 09:39:36 -08:00
dependabot[bot]
7e2b4f568f chore(deps): bump golang.org/x/net from 0.33.0 to 0.38.0 (#968) 2026-01-13 09:38:40 -08:00
dependabot[bot]
d898c654c9 chore(deps): bump github.com/go-chi/chi/v5 from 5.2.0 to 5.2.1 (#933) 2026-01-13 09:38:12 -08:00
dependabot[bot]
c70265a6d3 chore(deps): bump github.com/miekg/dns from 1.1.62 to 1.1.64 (#962) 2026-01-13 09:37:15 -08:00
Joris
487873ed57 fix(desec): only update specified ip version (#961) 2026-01-13 09:36:31 -08:00
Florian Traber
b148344096 docs(inwx): clarify DynDNS account requirement (#939) 2026-01-13 09:34:52 -08:00
dependabot[bot]
4c91ef0ef8 chore(deps): bump golang.org/x/oauth2 from 0.24.0 to 0.28.0 (#952) 2026-01-13 09:27:11 -08:00
Quentin McGaw
18a5493345 chore(ci): bump linter to v2.4.0 2026-01-13 17:24:15 +00:00
Quentin McGaw
de2e675ed2 chore(all): prefer using ghcr.io images 2026-01-13 17:16:04 +00:00
Quentin McGaw
177a9a2d76 chore(ci): bump xcputranslate to v0.9.0 2026-01-13 11:52:03 +00:00
Quentin McGaw
de142bbd30 chore(build): bump Go version from 1.23 to 1.25 2026-01-13 11:50:48 +00:00
Quentin McGaw
eed96495bd chore(dev): upgrade godevcontainer to v0.21
See [release notes](https://github.com/qdm12/godevcontainer/releases/tag/v0.21.0)

Notably:
- Go upgraded from 1.23 to 1.25
- golangci-lint upgraded to v2.4.0
- Alpine upgraded from 3.20 to 3.22
- Disable package comment requirement by gopls' staticcheck
- Pull container image from ghcr.io
2026-01-13 11:32:40 +00:00
Quentin McGaw
43891cf8a6 chore(ci): use Go version from go.mod in Github actions 2026-01-13 11:30:06 +00:00
Quentin McGaw
aa0b136a7b chore(build): bump Alpine from 3.20 to 3.22 2026-01-13 11:28:47 +00:00
Quentin McGaw
3dbdc339bc chore(log): log out <none> when no IP is given to ipsToString 2026-01-13 11:26:52 +00:00
Quentin McGaw
10cfe67060 docs(readme): fix invalid URLs
- remove no longer working dockeri.co badge
- remove outdated tokei badge link
- fix docker image tags link to use GitHub Packages
2026-01-13 11:24:59 +00:00
Jorge
212841c651 fix(dondominio): change key JSON paramater from apikey to password (#969)
Fix #923
2026-01-13 03:00:08 -08:00
Simon Marty
b2a446b8c1 docs(readme): fix outdated providers list (#1031) 2025-11-01 15:17:59 -04:00
jccint
cdaf05e4ab fix(ionos): use filepath/path for joining URL paths to avoid errors in Windows (#984) 2025-11-01 15:15:34 -04:00
Ehsan Shirvanian
95bcce2809 fix(route53): don't replace wildcard character * with any when sending update request (#1036)
Co-authored-by: Ehsan Shirvanian <ehsan@shirvanian.devm>
2025-10-07 16:27:43 +00:00
Justin K
3e63897769 updated the porkbun readme so that the example sk and example api_key had the correct prefix as to not confuse new users (#995) 2025-10-07 16:24:03 +00:00
Brian Shea
20ac110753 docs(namesilo): fix typo in namesilo.com (#888) 2024-12-24 21:57:00 +01:00
hyperring
78f30614b1 feat(providers): namesilo.com support (#866)
- Credits to @Zeustopher for writing most of the readme
2024-12-24 10:18:18 +01:00
Brian Shea
03154c35f8 feat(providers): add myaddr.tools (#885) 2024-12-24 09:51:51 +01:00
Quentin McGaw
be6679273f feat(custom): allow empty ipv4 and ipv6 keys
- Fix #875
2024-12-23 08:29:01 +00:00
dependabot[bot]
6b61b8c6b8 chore(deps): bump github.com/go-chi/chi/v5 from 5.1.0 to 5.2.0 (#881) 2024-12-22 19:08:58 +01:00
dependabot[bot]
b9227d5f9d chore(deps): bump github.com/stretchr/testify from 1.9.0 to 1.10.0 (#871) 2024-12-22 19:08:50 +01:00
dependabot[bot]
395686bb47 chore(deps): bump golang.org/x/net from 0.31.0 to 0.33.0 (#883) 2024-12-22 19:08:44 +01:00
dependabot[bot]
edb5cd85b1 chore(deps): bump github.com/breml/rootcerts from 0.2.18 to 0.2.19 (#870) 2024-12-22 19:08:32 +01:00
erri120
71191fa707 fix(log): use go-chi realip middleware (#874) 2024-12-03 16:54:01 +01:00
Quentin McGaw
89564b763b fix(update): fetch IPv6 AAAA records and not only IPv4 2024-11-21 22:25:14 +00:00
Quentin McGaw
6198b48a68 chore(update): use newer LookupNetIP resolver function to use netip.Addr directly 2024-11-21 22:06:44 +00:00
Quentin McGaw
9ba1633300 fix(update): do not update if public IP is part of multiple IPs found in records 2024-11-21 22:02:09 +00:00
Quentin McGaw
6c3490f5c5 fix(netcup): allow wildcard domains (#863) 2024-11-20 15:38:22 +01:00
dependabot[bot]
56370f9ef2 chore(deps): bump golang.org/x/mod from 0.21.0 to 0.22.0 (#854) 2024-11-19 13:36:53 +01:00
dependabot[bot]
8d66333415 chore(deps): bump golang.org/x/oauth2 from 0.23.0 to 0.24.0 (#855) 2024-11-19 13:36:34 +01:00
dependabot[bot]
a0b9ed5dcb chore(deps): bump golang.org/x/net from 0.30.0 to 0.31.0 (#857) 2024-11-19 13:18:42 +01:00
dependabot[bot]
b3a992c8f4 chore(deps): bump github.com/qdm12/gosettings from 0.4.4-rc1 to 0.4.4 (#859) 2024-11-19 13:18:33 +01:00
dependabot[bot]
c085cdae2c chore(deps): bump DavidAnson/markdownlint-cli2-action from 17 to 18 (#860) 2024-11-19 13:18:20 +01:00
Quentin McGaw
8b15e35575 docs(readme): specify duckdns and goip are handled differently for multiple domains 2024-11-19 10:44:36 +00:00
Quentin McGaw
e28b86f9c0 docs(goip): add multiple examples for the domain field 2024-11-19 10:44:12 +00:00
Quentin McGaw
a6f6f48df3 docs(duckdns): add multiple examples for the domain field 2024-11-19 10:43:58 +00:00
Quentin McGaw
c5041c27e2 docs(duckdns): fix domain documentation on eTLD being duckdns.org 2024-11-19 10:43:30 +00:00
Quentin McGaw
1138de5446 docs(goip): fix domain field documentation
- eTLD must be goip.de or goip.it, not eTLD+1
- remove old `domain` optional parameter documentation
2024-11-19 10:42:49 +00:00
Quentin McGaw
9a62043ff6 fix(aliyun): error context fixed when handling bad request errors 2024-11-12 13:19:30 +00:00
Quentin McGaw
c23da1518e fix(all): trim space and lower case all response plain bodies 2024-11-12 13:04:45 +00:00
Quentin McGaw
5c9d04eae4 fix(ovh): handling of invalid JSON error bodies 2024-11-12 12:50:06 +00:00
Quentin McGaw
80670048ed fix(noip): handle response body messages before checking status code 2024-11-12 12:34:11 +00:00
Quentin McGaw
d221522e02 fix(dondominio): build host with raw owner to support wildcards 2024-11-12 12:32:53 +00:00
Quentin McGaw
9caf1bef53 fix(gandi.net): leave ttl as it is if not user specified 2024-11-07 09:22:15 +00:00
Quentin McGaw
46e1edb8f2 fix(gandi.net): update API url fix #852 2024-11-07 09:18:49 +00:00
Fred Cox
bb231bc736 fix(gcp): prevent crash for missing record (#846) 2024-10-22 17:51:24 +02:00
Amr Essam
949dcd9a30 feat(provider): vultr.com (#829) 2024-10-20 19:45:34 +02:00
Quentin McGaw
bad113b290 hotfix(dev): pin godevcontainer image tag to v0.20-alpine 2024-10-20 16:19:53 +00:00
Quentin McGaw
691ed320fd chore(lint): add new linters fatcontext, intrange and mirror 2024-10-20 13:15:20 +00:00
Quentin McGaw
8b5da2c580 chore(lint): add canonicalheader linter and fix issues 2024-10-20 13:14:02 +00:00
Quentin McGaw
05d566c807 chore(all): format code using gofumpt 2024-10-20 13:12:33 +00:00
Quentin McGaw
4c7c794494 chore(lint): upgrade linter from v1.56.2 to v1.61.0 2024-10-20 13:10:31 +00:00
Quentin McGaw
777a5e224f chore(build): upgrade Go from 1.22 to 1.23 2024-10-20 13:03:44 +00:00
Quentin McGaw
2451609cdd chore(dev): pin godevcontainer image tag to v0.20.0 2024-10-20 13:01:40 +00:00
Quentin McGaw
75f342c9ee chore(dev): small readme fixes to devcontainer 2024-10-20 12:06:50 +00:00
niklasknoell
03f5d0b372 feat(providers): loopia.se (#842) 2024-10-20 13:53:26 +02:00
Quentin McGaw
5e4bd1611a docs(dev): improve devcontainer readme 2024-10-20 11:29:32 +00:00
Quentin McGaw
e177826ae8 chore(dev): update devcontainer readme 2024-10-20 11:29:29 +00:00
Quentin McGaw
6a683f5161 chore(provider): do not re-check the owner is not empty 2024-10-20 11:29:02 +00:00
Quentin McGaw
2f44cb2afd chore(dev): migrate docker-compose.yml settings to devcontainer.json
- works with codespaces
- does not need full paths for host home directory bind mounts
2024-10-20 10:44:56 +00:00
Quentin McGaw
8747f4bd01 chore(dev): change field source.organizeImports from true to "always" 2024-10-20 10:44:56 +00:00
dependabot[bot]
74077dffac chore(deps): bump golang.org/x/net from 0.29.0 to 0.30.0 (#833) 2024-10-12 19:47:57 +02:00
likeaninja5
118132f238 fix(porkbun): update API url (#837) 2024-10-12 19:46:46 +02:00
Jonas Jacobsen
94e008dc19 feat(provider): domene.shop (#810) 2024-10-09 08:19:35 +02:00
Benjamin Temple
4254600bcf Provider Porkbun: Delete Default Parked DNS Entry for *.domain.tld (#774)
* Provider Porkbun: Delete Default Parked DNS Entry for *.domain.tld

Description:

By default, Porkbun creates default ALIAS and CNAME domain records pointing to `pixie.porkbun.com` (Porkbun's parked domain website)

The current logic flow prior to this PR would look for an A or AAAA domain record, and if none exists, attempt to delete the ALIAS record for any subdomain.
This updates the logic flow to only look for a conflicting ALIAS record for the top level `domain.tld`, and a conflicting CNAME record for the `*.domain.tld`. Additionally, we verify that the content of this record matches `pixie.porkbun.com` and we only delete for the expected default values.
If the value does not match the expected `pixie.porkbun.com` we produce more helpful error messages.

Test-Plan:

Created a new domain.tld on Porkbun
Verified the default records were created:
`ALIAS domain.tld -> pixie.porkbun.com`
`CNAME *.domain.tld -> pixie.porkbun.com`
Started DDNS-Updater
Verified that both domain records were successfully deleted and updated

Reset the ALIAS domain record to point to `not-pixie.porkbun.com`
Reset the CNAME domain record to point to `not-pixie.porkbun.com`
Started DDNS-Updater
Verified that both domain records failed with the expected conflicting record error message.

![screenshot_2024-08-17-0210 20](https://github.com/user-attachments/assets/eb567401-ad4b-454d-a7aa-70ab1db1e3e9)

- add `deleteDefaultConflictingRecordsIfNeeded` method
- handle non conflicting errors from `deleteSingleMatchingRecord`
- simplify comments by linking to documentation
- improve error wrappings

---------

Co-authored-by: Quentin McGaw <quentin.mcgaw@gmail.com>
2024-10-07 21:46:12 -07:00
Quentin McGaw
e10d778e5f feat(health): possibility to run health server outside docker and to disable it in a container
- disable health server if the health listening address:port is empty
- default health listening address:port to the empty string
- Docker default health listening address:port to 127.0.0.1:9999
- Fix #824
2024-10-01 17:17:18 +00:00
Quentin McGaw
c16287e48a fix(unix): umask behavior for file creation
- remove bad calculation of "our own" umask
- remove umask "union effect"
- do not touch system umask unless `UMASK` is set
- set system umask only if `UMASK` is set
2024-09-19 14:21:55 +00:00
dependabot[bot]
0674864e54 chore(deps): bump github.com/miekg/dns from 1.1.61 to 1.1.62 (#815) 2024-09-17 22:55:03 +02:00
Quentin McGaw
039396b68c chore(deps): run go mod tidy and pin Go version to 1.22.0 2024-09-17 20:53:59 +00:00
Quentin McGaw
e46f2f2965 docs(readme): add v2.8 release to versioned docs links 2024-09-17 20:36:29 +00:00
Quentin McGaw
4ccd53da4d docs(readme): pin v2.7 docs links to v2.7.1 release 2024-09-17 20:35:57 +00:00
Quentin McGaw
4653a484ef docs(readme): do not pin docs version to bugfix release 2024-09-17 20:35:40 +00:00
Quentin McGaw
71139938f0 docs(porkbun): fix discrepancy in parameter fields, fix #816 2024-09-17 20:34:04 +00:00
Quentin McGaw
b3b4dad0a2 docs(readme): add AUR package name to features 2024-09-17 20:17:21 +00:00
dependabot[bot]
d5515cfb2c chore(deps): bump github.com/go-chi/chi/v5 from 5.0.12 to 5.1.0 (#755) 2024-09-17 10:23:23 +02:00
dependabot[bot]
ab22578c9e chore(deps): bump DavidAnson/markdownlint-cli2-action from 16 to 17 (#811) 2024-09-17 10:23:11 +02:00
Quentin McGaw
623cb536e1 fix(publicip/http): remove google provider which no longer works 2024-09-17 07:39:00 +00:00
dependabot[bot]
13035511bb chore(deps): bump golang.org/x/mod from 0.18.0 to 0.21.0 (#801) 2024-09-16 18:06:52 +02:00
dependabot[bot]
e019e371ea chore(deps): bump github.com/qdm12/gosplash from 0.1.0 to 0.2.0 (#783) 2024-09-16 18:06:11 +02:00
dependabot[bot]
c14324153c chore(deps): bump golang.org/x/oauth2 from 0.21.0 to 0.23.0 (#802) 2024-09-16 18:04:04 +02:00
dependabot[bot]
0c77340887 chore(deps): bump github.com/breml/rootcerts from 0.2.17 to 0.2.18 (#814) 2024-09-16 18:03:50 +02:00
Quentin McGaw
9787957b94 fix(ci): ignore duckdns.org for links check 2024-09-16 14:48:36 +00:00
Quentin McGaw
3a6262ef2c feat(files): configurable UMASK defaulting to system umask 2024-09-16 14:33:37 +00:00
Quentin McGaw
6b9ed56b18 chore(persistence/json): non embedded rw mutex 2024-09-16 13:34:59 +00:00
Quentin McGaw
8c1b3e556c chore(porkbun): refactor API code to use a generic httpPost function 2024-09-16 12:46:49 +00:00
Quentin McGaw
1627254667 docs(readme): remove outdated kanban board link 2024-09-16 12:36:44 +00:00
dependabot[bot]
a8edd5ccc3 chore(deps): bump docker/build-push-action from 5 to 6 (#747) 2024-09-16 07:54:36 +02:00
dependabot[bot]
4cdc052577 chore(deps): bump golang.org/x/net from 0.26.0 to 0.29.0 (#806) 2024-09-16 07:53:46 +02:00
Quentin McGaw
bc272e079e fix(config): upgrade qdm12/gosettings from v0.4.1 to v0.4.4-rc1 2024-08-28 14:13:56 +00:00
Quentin McGaw
c7dbbcbaa0 fix(dondominio): remove unneeded name field 2024-08-21 09:35:34 +00:00
Benjamin Temple
8f456977be fix(errors): 'agend' -> 'agent' typo in user agent banned error (#790) 2024-08-17 13:32:55 +02:00
Benjamin Temple
425da967a2 fix(porkbun): fix wildcard behavior (#773) 2024-08-07 17:44:09 +02:00
Benjamin Temple
1cd57d655e fix(porkbun): remove trailing '.' from alias delete request (#775) 2024-07-27 13:52:12 +02:00
Quentin McGaw
d04c67c7ab docs(ovh): link to page to retrieve consumer_key 2024-07-26 08:11:18 +00:00
Quentin McGaw
918df24488 change(all): deprecate provider_ip config field
- change should not affect any existing configurations
- change solves issues with dual stack updates (#767)
- was unneeded and adds unneeded complexity
2024-07-26 08:06:24 +00:00
Quentin McGaw
6d70ca078c chore(build): upgrade Alpine from 3.19 to 3.20 2024-07-26 07:36:14 +00:00
Quentin McGaw
9f0ca6ceaa hotfix(ionos): settings validation 2024-07-03 19:17:49 +00:00
Quentin McGaw
7ad0d8dc57 fix(noip): force useProviderIP to false for IPv6 2024-07-03 14:55:52 +00:00
Quentin McGaw
5b800cf278 docs(readme): instructions to build latest binary 2024-06-28 06:51:07 +00:00
Quentin McGaw
1d6053e528 chore(main): rename cmd/updater to cmd/ddns-updater 2024-06-28 06:49:19 +00:00
Quentin McGaw
c345a788e3 hotfix(duckdns): fix behavior for full domain strings 2024-06-27 17:03:05 +00:00
Quentin McGaw
158fed7c51 hotfix(goip): fix behavior for full domain strings 2024-06-27 16:53:13 +00:00
Quentin McGaw
07d7645d78 feat(config): read both owner and domain from domain
- retro-compatible change: keep using host/owner if set
- otherwise extract owner and eTLD+1 from domain field
- documentation updated to only use the `domain` field
2024-06-27 13:10:16 +00:00
Quentin McGaw
55d8c0d703 docs(readme): add readme and docs/ versioned links 2024-06-27 13:01:42 +00:00
Quentin McGaw
db07ed3759 chore(deps): drop dependency on github.com/chmike/domain 2024-06-27 09:18:28 +00:00
Quentin McGaw
dbd2f79760 chore(providers): move domain check to each provider validation 2024-06-27 08:37:04 +00:00
Quentin McGaw
da4791e2db chore(providers): separate settings validation in its own function 2024-06-27 08:26:36 +00:00
Quentin McGaw
32fafeca95 chore(all): rename host to owner
- Retro-compatible change, `host` field still works
- Documentation updated to use `owner` field
- Code updated to use owner variable name
2024-06-27 06:51:08 +00:00
Quentin McGaw
711b1acfc7 chore(models): remove unused DomainHost struct 2024-06-27 06:46:45 +00:00
Quentin McGaw
339f5001e1 docs(goip): fix documentation for the host field 2024-06-27 06:41:27 +00:00
235 changed files with 4668 additions and 2616 deletions

View File

@@ -1 +1 @@
FROM qmcgaw/godevcontainer
FROM qmcgaw/godevcontainer:v0.21-alpine

View File

@@ -2,7 +2,7 @@
Development container that can be used with VSCode.
It works on Linux, Windows and OSX.
It works on Linux, Windows (WSL2) and OSX.
## Requirements
@@ -13,49 +13,41 @@ It works on Linux, Windows and OSX.
## Setup
1. Create the following files on your host if you don't have them:
1. Create the following files and directory on your host if you don't have them:
```sh
touch ~/.gitconfig ~/.zsh_history
mkdir -p ~/.ssh
```
Note that the development container will create the empty directories `~/.docker`, `~/.ssh` and `~/.kube` if you don't have them.
1. **For Docker on OSX or Windows without WSL**: ensure your home directory `~` is accessible by Docker.
1. **For OSX hosts**: ensure the project directory and your home directory `~` are accessible by Docker.
1. Open the command palette in Visual Studio Code (CTRL+SHIFT+P).
1. Select `Dev Containers: Open Folder in Container...` and choose the project directory.
1. Select `Dev-Containers: Open Folder in Container...` and choose the project directory.
## Customization
### Customize the image
For any customization to take effect, you should "rebuild and reopen":
You can make changes to the [Dockerfile](Dockerfile) and then rebuild the image. For example, your Dockerfile could be:
1. Open the command palette in Visual Studio Code (CTRL+SHIFT+P)
2. Select `Dev-Containers: Rebuild Container`
```Dockerfile
FROM qmcgaw/godevcontainer
RUN apk add curl
```
Changes you can make are notably:
To rebuild the image, either:
- Changes to the Docker image in [Dockerfile](Dockerfile)
- Changes to VSCode **settings** and **extensions** in [devcontainer.json](devcontainer.json).
- Change the entrypoint script by adding a bind mount in [devcontainer.json](devcontainer.json) of a shell script to `/root/.welcome.sh` to replace the [current welcome script](https://github.com/qdm12/godevcontainer/blob/master/shell/.welcome.sh). For example:
- With VSCode through the command palette, select `Remote-Containers: Rebuild and reopen in container`
- With a terminal, go to this directory and `docker-compose build`
```json
// Welcome script
{
"source": "/yourpath/.welcome.sh",
"target": "/root/.welcome.sh",
"type": "bind"
},
```
### Customize VS code settings
You can customize **settings** and **extensions** in the [devcontainer.json](devcontainer.json) definition file.
### Entrypoint script
You can bind mount a shell script to `/root/.welcome.sh` to replace the [current welcome script](https://github.com/qdm12/basedevcontainer/blob/master/shell/.welcome.sh).
### Publish a port
To access a port from your host to your development container, publish a port in [docker-compose.yml](docker-compose.yml). You can also now do it directly with VSCode without restarting the container.
### Run other services
1. Modify [docker-compose.yml](docker-compose.yml) to launch other services at the same time as this development container, such as a test database:
- Change the `vscode` service container configuration either in [docker-compose.yml](docker-compose.yml) or in [devcontainer.json](devcontainer.json).
- Add other services in [docker-compose.yml](docker-compose.yml) to run together with the development VSCode service container. For example to add a test database:
```yml
database:
@@ -65,5 +57,4 @@ To access a port from your host to your development container, publish a port in
POSTGRES_PASSWORD: password
```
1. In [devcontainer.json](devcontainer.json), change the line `"runServices": ["vscode"],` to `"runServices": ["vscode", "database"],`.
1. In the VS code command palette, rebuild the container.
- More options are documented in the [devcontainer.json reference](https://containers.dev/implementors/json_reference/).

View File

@@ -1,16 +1,51 @@
{
// See https://containers.dev/implementors/json_reference/
// User defined settings
"containerEnv": {
"TZ": ""
},
// Fixed settings
"name": "ddns-dev",
"dockerComposeFile": [
"docker-compose.yml"
],
"service": "vscode",
"runServices": [
"vscode"
],
"shutdownAction": "stopCompose",
"postCreateCommand": "~/.windows.sh && go mod download && go mod tidy",
"dockerComposeFile": "docker-compose.yml",
"overrideCommand": true,
"service": "vscode",
"workspaceFolder": "/workspace",
// "overrideCommand": "",
"mounts": [
// Source code
{
"source": "../",
"target": "/workspace",
"type": "bind"
},
// Zsh commands history persistence
{
"source": "${localEnv:HOME}/.zsh_history",
"target": "/root/.zsh_history",
"type": "bind"
},
// Git configuration file
{
"source": "${localEnv:HOME}/.gitconfig",
"target": "/root/.gitconfig",
"type": "bind"
},
// SSH directory for Linux, OSX and WSL
// On Linux and OSX, a symlink /mnt/ssh <-> ~/.ssh is
// created in the container. On Windows, files are copied
// from /mnt/ssh to ~/.ssh to fix permissions.
{
"source": "${localEnv:HOME}/.ssh",
"target": "/mnt/ssh",
"type": "bind"
},
// Docker socket to access the host Docker server
{
"source": "/var/run/docker.sock",
"target": "/var/run/docker.sock",
"type": "bind"
}
],
"customizations": {
"vscode": {
"extensions": [
@@ -58,12 +93,16 @@
"go.lintOnSave": "package",
"[go]": {
"editor.codeActionsOnSave": {
"source.organizeImports": true
"source.organizeImports": "always"
}
},
"gopls": {
"formatting.gofumpt": true,
"usePlaceholders": false,
"staticcheck": true,
"ui.diagnostic.analyses": {
"ST1000": false
},
"vulncheck": "Imports"
},
"remote.extensionKind": {

View File

@@ -1,27 +1,3 @@
version: "3.7"
services:
vscode:
build: .
volumes:
- ../:/workspace
# Docker socket to access Docker server
- /var/run/docker.sock:/var/run/docker.sock
# SSH directory for Linux, OSX and WSL
# On Linux and OSX, a symlink /mnt/ssh <-> ~/.ssh is
# created in the container. On Windows, files are copied
# from /mnt/ssh to ~/.ssh to fix permissions.
- ~/.ssh:/mnt/ssh
# Shell history persistence
- ~/.zsh_history:/root/.zsh_history
# Git config
- ~/.gitconfig:/root/.gitconfig
environment:
- TZ=
cap_add:
# For debugging with dlv
- SYS_PTRACE
security_opt:
# For debugging with dlv
- seccomp:unconfined
entrypoint: [ "zsh", "-c", "while sleep 1000; do :; done" ]

View File

@@ -50,9 +50,9 @@ You might want to use an editor such as [Visual Studio Code](https://code.visual
- Test the code: `go test ./...`
- Lint the code `golangci-lint run`
- Build the program: `go build -o app cmd/updater/main.go`
- Build the Docker image (tests and lint included): `docker build -t qmcgaw/ddns-updater .`
- Run the Docker container: `docker run -it --rm -v /yourpath/data:/updater/data qmcgaw/ddns-updater`
- Build the program: `go build -o app cmd/ddns-updater/main.go`
- Build the Docker image (tests and lint included): `docker build -t ghcr.io/qdm12/ddns-updater .`
- Run the Docker container: `docker run -it --rm -v /yourpath/data:/updater/data ghcr.io/qdm12/ddns-updater`
## Add a new DNS provider
@@ -77,7 +77,7 @@ In more detailed steps:
```go
case constants.Example:
return example.New(data, domain, host, ipVersion, ipv6Suffix)
return example.New(data, domain, owner, ipVersion, ipv6Suffix)
```
1. Copy the file [`docs/example.md`](../docs/example.md) to `docs/yourprovider.md` and modify it to fit the configuration and domain setup of your DNS provider. There are a few `<!-- ... -->` comments indicating what to change, please **remove them** when done.

View File

@@ -75,12 +75,12 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "^1.22"
- uses: github/codeql-action/init@v3
go-version-file: go.mod
- uses: github/codeql-action/init@v4
with:
languages: go
- uses: github/codeql-action/autobuild@v3
- uses: github/codeql-action/analyze@v3
- uses: github/codeql-action/autobuild@v4
- uses: github/codeql-action/analyze@v4
publish:
if: |
@@ -141,7 +141,7 @@ jobs:
run: echo "::set-output name=value::$(git rev-parse --short HEAD)"
- name: Build and push final image
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/386,linux/arm64,linux/arm/v6,linux/arm/v7,linux/s390x,linux/ppc64le,linux/riscv64
labels: ${{ steps.meta.outputs.labels }}
@@ -155,7 +155,7 @@ jobs:
- if: github.event_name == 'release'
uses: actions/setup-go@v5
with:
go-version: 1.22
go-version-file: go.mod
- if: github.event_name == 'release'
uses: goreleaser/goreleaser-action@v6

View File

@@ -2,7 +2,7 @@ before:
hooks:
- go mod download
builds:
- main: ./cmd/updater/main.go
- main: ./cmd/ddns-updater/main.go
flags:
- -trimpath
env:

View File

@@ -26,6 +26,15 @@
},
{
"pattern": "https://github.com/qdm12/ddns-updater/pkgs/container/ddns-updater"
},
{
"pattern": "^https://www.duckdns.org/$"
},
{
"pattern": "^https://my.vultr.com/settings/#settingsapi$"
},
{
"pattern": "^https://www.namesilo.com"
}
],
"timeout": "20s",

View File

@@ -20,7 +20,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: DavidAnson/markdownlint-cli2-action@v16
- uses: DavidAnson/markdownlint-cli2-action@v18
with:
globs: "**.md"
config: .markdownlint.json
@@ -37,7 +37,7 @@ jobs:
use-quiet-mode: yes
config-file: .github/workflows/configs/mlc-config.json
- uses: peter-evans/dockerhub-description@v4
- uses: peter-evans/dockerhub-description@v5
if: github.repository == 'qdm12/ddns-updater' && github.event_name == 'push'
with:
username: qmcgaw

View File

@@ -1,43 +1,70 @@
linters-settings:
misspell:
locale: US
version: "2"
issues:
exclude-rules:
- path: _test\.go
linters:
- containedctx
- dupl
- goerr113
- text: Function `exitHealthchecksio` should pass the context parameter
linters:
- contextcheck
- source: "See https://"
linters:
- lll
formatters:
enable:
- gci
- gofumpt
- goimports
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$
linters:
settings:
misspell:
locale: US
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
rules:
- linters:
- containedctx
- dupl
- err113
path: _test\.go
- linters:
- contextcheck
text: Function `exitHealthchecksio` should pass the context parameter
- linters:
- lll
source: See https://
- linters:
- revive
text: "var-naming: avoid meaningless package names"
path: internal\/provider\/utils\/
paths:
- third_party$
- builtin$
- examples$
enable:
# - cyclop
- asasalint
- asciicheck
- bidichk
- bodyclose
- canonicalheader
- containedctx
- contextcheck
- copyloopvar
- decorder
- dogsled
- dupl
- dupword
- durationcheck
- err113
- errchkjson
- errname
- errorlint
- execinquery
- exhaustive
- exportloopref
- fatcontext
- forcetypeassert
- gci
- gocheckcompilerdirectives
- gochecknoglobals
- gochecknoinits
@@ -47,10 +74,7 @@ linters:
- gocritic
- gocyclo
- godot
- goerr113
- goheader
- goimports
- gomnd
- gomoddirectives
- goprintffuncname
- gosec
@@ -59,11 +83,14 @@ linters:
- importas
- inamedparam
- interfacebloat
- intrange
- ireturn
- lll
- maintidx
- makezero
- mirror
- misspell
- mnd
- musttag
- nakedret
- nestif
@@ -84,7 +111,6 @@ linters:
- sloglint
- sqlclosecheck
- tagalign
- tenv
- thelper
- tparallel
- unconvert

View File

@@ -1,13 +1,13 @@
ARG BUILDPLATFORM=linux/amd64
ARG ALPINE_VERSION=3.19
ARG GO_VERSION=1.22
ARG XCPUTRANSLATE_VERSION=v0.6.0
ARG GOLANGCI_LINT_VERSION=v1.56.2
ARG ALPINE_VERSION=3.22
ARG GO_VERSION=1.25
ARG XCPUTRANSLATE_VERSION=v0.9.0
ARG GOLANGCI_LINT_VERSION=v2.4.0
ARG MOCKGEN_VERSION=v1.6.0
FROM --platform=${BUILDPLATFORM} qmcgaw/xcputranslate:${XCPUTRANSLATE_VERSION} AS xcputranslate
FROM --platform=${BUILDPLATFORM} qmcgaw/binpot:golangci-lint-${GOLANGCI_LINT_VERSION} AS golangci-lint
FROM --platform=${BUILDPLATFORM} qmcgaw/binpot:mockgen-${MOCKGEN_VERSION} AS mockgen
FROM --platform=${BUILDPLATFORM} ghcr.io/qdm12/xcputranslate:${XCPUTRANSLATE_VERSION} AS xcputranslate
FROM --platform=${BUILDPLATFORM} ghcr.io/qdm12/binpot:golangci-lint-${GOLANGCI_LINT_VERSION} AS golangci-lint
FROM --platform=${BUILDPLATFORM} ghcr.io/qdm12/binpot:mockgen-${MOCKGEN_VERSION} AS mockgen
FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-alpine${ALPINE_VERSION} AS base
WORKDIR /tmp/gobuild
@@ -50,8 +50,7 @@ RUN git init && \
rm -rf .git/
FROM --platform=$BUILDPLATFORM base AS build
RUN mkdir -p /tmp/data && \
touch /tmp/isdocker
RUN mkdir -p /tmp/data
ARG VERSION=unknown
ARG CREATED="an unknown date"
ARG COMMIT=unknown
@@ -62,7 +61,7 @@ RUN GOARCH="$(xcputranslate translate -targetplatform ${TARGETPLATFORM} -field a
-X 'main.version=$VERSION' \
-X 'main.date=$CREATED' \
-X 'main.commit=$COMMIT' \
" -o app cmd/updater/main.go
" -o app cmd/ddns-updater/main.go
FROM scratch
EXPOSE 8000
@@ -73,7 +72,6 @@ USER ${UID}:${GID}
WORKDIR /updater
ENTRYPOINT ["/updater/ddns-updater"]
COPY --from=build --chown=${UID}:${GID} /tmp/data /updater/data
COPY --from=build --chown=${UID}:${GID} /tmp/isdocker /updater/isdocker
ENV \
# Core
CONFIG= \
@@ -103,6 +101,8 @@ ENV \
SHOUTRRR_ADDRESSES= \
SHOUTRRR_DEFAULT_TITLE="DDNS Updater" \
TZ= \
# UMASK left empty so it dynamically defaults to the OS current umask
UMASK= \
HEALTH_SERVER_ADDRESS=127.0.0.1:9999 \
HEALTH_HEALTHCHECKSIO_BASE_URL=https://hc-ping.com \
HEALTH_HEALTHCHECKSIO_UUID=

View File

@@ -6,10 +6,8 @@ Program to keep DNS A and/or AAAA records updated for multiple DNS providers
[![Build status](https://github.com/qdm12/ddns-updater/actions/workflows/build.yml/badge.svg)](https://github.com/qdm12/ddns-updater/actions/workflows/build.yml)
[![dockeri.co](https://dockeri.co/image/qmcgaw/ddns-updater)](https://hub.docker.com/r/qmcgaw/ddns-updater)
![Last release](https://img.shields.io/github/release/qdm12/ddns-updater?label=Last%20release)
![Last Docker tag](https://img.shields.io/docker/v/qmcgaw/ddns-updater?sort=semver&label=Last%20Docker%20tag)
![Last Docker tag](https://img.shields.io/github/v/release/qdm12/ddns-updater?sort=semver&label=Last%20Docker%20tag)
[![Last release size](https://img.shields.io/docker/image-size/qmcgaw/ddns-updater?sort=semver&label=Last%20released%20image)](https://hub.docker.com/r/qmcgaw/ddns-updater/tags?page=1&ordering=last_updated)
![GitHub last release date](https://img.shields.io/github/release-date/qdm12/ddns-updater?label=Last%20release%20date)
![Commits since release](https://img.shields.io/github/commits-since/qdm12/ddns-updater/latest?sort=semver)
@@ -22,7 +20,6 @@ Program to keep DNS A and/or AAAA records updated for multiple DNS providers
[![GitHub issues](https://img.shields.io/github/issues/qdm12/ddns-updater.svg)](https://github.com/qdm12/ddns-updater/issues)
[![GitHub closed issues](https://img.shields.io/github/issues-closed/qdm12/ddns-updater.svg)](https://github.com/qdm12/ddns-updater/issues?q=is%3Aissue+is%3Aclosed)
[![Lines of code](https://img.shields.io/tokei/lines/github/qdm12/ddns-updater)](https://github.com/qdm12/ddns-updater)
![Code size](https://img.shields.io/github/languages/code-size/qdm12/ddns-updater)
![GitHub repo size](https://img.shields.io/github/repo-size/qdm12/ddns-updater)
![Go version](https://img.shields.io/github/go-mod/go-version/qdm12/ddns-updater)
@@ -30,19 +27,33 @@ Program to keep DNS A and/or AAAA records updated for multiple DNS providers
[![MIT](https://img.shields.io/github/license/qdm12/ddns-updater)](LICENSE)
![Visitors count](https://visitor-badge.laobi.icu/badge?page_id=ddns-updater.readme)
## Versioned documentation
This readme and the [docs/](docs/) directory are **versioned** to match the program version:
| Version | Readme link | Docs link |
| --- | --- | --- |
| Latest | [README](https://github.com/qdm12/ddns-updater/blob/master/README.md) | [docs/](https://github.com/qdm12/ddns-updater/tree/master/docs) |
| `v2.8` | [README](https://github.com/qdm12/ddns-updater/blob/v2.8.0/README.md) | [docs/](https://github.com/qdm12/ddns-updater/blob/v2.8.0/docs) |
| `v2.7` | [README](https://github.com/qdm12/ddns-updater/blob/v2.7.1/README.md) | [docs/](https://github.com/qdm12/ddns-updater/blob/v2.7.1/docs) |
| `v2.6` | [README](https://github.com/qdm12/ddns-updater/blob/v2.6.1/README.md) | [docs/](https://github.com/qdm12/ddns-updater/blob/v2.6.1/docs) |
| `v2.5` | [README](https://github.com/qdm12/ddns-updater/blob/v2.5.0/README.md) | [docs/](https://github.com/qdm12/ddns-updater/blob/v2.5.0/docs) |
## Features
- Available as a Docker image [`qmcgaw/ddns-updater`](https://hub.docker.com/r/qmcgaw/ddns-updater) and [`ghcr.io/qdm12/ddns-updater`]((https://github.com/qdm12/ddns-updater/pkgs/container/ddns-updater))
- 🆕 Available as [zero-dependency binaries for Linux, Windows and MacOS](https://github.com/qdm12/ddns-updater/releases)
- Available as a Docker image [`ghcr.io/qdm12/ddns-updater`]((https://github.com/qdm12/ddns-updater/pkgs/container/ddns-updater)) and [`qmcgaw/ddns-updater`](https://hub.docker.com/r/qmcgaw/ddns-updater)
- Available as [zero-dependency binaries for Linux, Windows and MacOS](https://github.com/qdm12/ddns-updater/releases)
- 🆕 Available in the AUR as [`ddns-updater`](https://aur.archlinux.org/packages/ddns-updater) - see [#808](https://github.com/qdm12/ddns-updater/discussions/808)
- Updates periodically A records for different DNS providers:
- Aliyun
- AllInkl
- Changeip
- ChangeIP
- Cloudflare
- DD24
- DDNSS.de
- deSEC
- DigitalOcean
- Domeneshop
- DonDominio
- DNSOMatic
- DNSPod
@@ -50,6 +61,7 @@ Program to keep DNS A and/or AAAA records updated for multiple DNS providers
- DuckDNS
- DynDNS
- Dynu
- DynV6
- EasyDNS
- FreeDNS
- Gandi
@@ -62,9 +74,12 @@ Program to keep DNS A and/or AAAA records updated for multiple DNS providers
- INWX
- Ionos
- Linode
- Loopia
- LuaDNS
- Myaddr
- Name.com
- Namecheap
- NameSilo
- Netcup
- NoIP
- Now-DNS
@@ -78,6 +93,7 @@ Program to keep DNS A and/or AAAA records updated for multiple DNS providers
- Spdyn
- Strato.de
- Variomedia.de
- Vultr
- Zoneedit
- **Want more?** [Create an issue for it](https://github.com/qdm12/ddns-updater/issues/new/choose)!
- Web user interface (Desktop)
@@ -99,7 +115,7 @@ Program to keep DNS A and/or AAAA records updated for multiple DNS providers
### Binary programs
1. Download the pre-built program for your platform from the assets of a release in the [releases page](https://github.com/qdm12/ddns-updater/releases). Note this is only available from [release v2.6.0](https://github.com/qdm12/ddns-updater/releases/tag/v2.6.0).
1. Download the pre-built program for your platform from the assets of a release in the [releases page](https://github.com/qdm12/ddns-updater/releases). You can alternatively download, build and install the latest version of the program by installing [Go](https://golang.org/doc/install) and then run `go install github.com/qdm12/ddns-updater/cmd/ddns-updater@latest`.
1. For Linux and MacOS, make the program executable with `chmod +x ddns-updater`.
1. In the directory where the program is saved, create a directory `data`.
1. Write a JSON configuration in `data/config.json`, for example:
@@ -109,8 +125,7 @@ Program to keep DNS A and/or AAAA records updated for multiple DNS providers
"settings": [
{
"provider": "namecheap",
"domain": "example.com",
"host": "@",
"domain": "sub.example.com",
"password": "e5322165c1d74692bfa6d807100c0310"
}
]
@@ -154,8 +169,7 @@ Program to keep DNS A and/or AAAA records updated for multiple DNS providers
"settings": [
{
"provider": "namecheap",
"domain": "example.com",
"host": "@",
"domain": "sub.example.com",
"password": "e5322165c1d74692bfa6d807100c0310"
}
]
@@ -167,15 +181,15 @@ Program to keep DNS A and/or AAAA records updated for multiple DNS providers
1. Run the container with
```sh
docker run -d -p 8000:8000/tcp -v "$(pwd)"/data:/updater/data qmcgaw/ddns-updater
docker run -d -p 8000:8000/tcp -v "$(pwd)"/data:/updater/data ghcr.io/qdm12/ddns-updater
```
1. The following is **optional**.
- You can customize the program behavior using [environment variables](#environment-variables)
- You can use [docker-compose.yml](docker-compose.yml) with `docker-compose up -d`
- **Kubernetes**: check out the [k8s directory](k8s) for an installation guide and examples.
- Other [Docker image tags are available](https://hub.docker.com/repository/docker/qmcgaw/ddns-updater/tags)
- You can update the image with `docker pull qmcgaw/ddns-updater`
- Other [Docker image tags are available](https://github.com/qdm12/ddns-updater/pkgs/container/ddns-updater)
- You can update the image with `docker pull ghcr.io/qdm12/ddns-updater`
- You can set your JSON configuration as a single environment variable line (i.e. `{"settings": [{"provider": "namecheap", ...}]}`), which takes precedence over config.json. Note however that if you don't bind mount the `/updater/data` directory, there won't be a persistent database file `/updater/updates.json` but it will still work.
## Configuration
@@ -202,11 +216,11 @@ Check the documentation for your DNS provider:
- [Allinkl](docs/allinkl.md)
- [ChangeIP](docs/changeip.md)
- [Cloudflare](docs/cloudflare.md)
- [Custom](docs/custom.md)
- [DD24](docs/dd24.md)
- [DDNSS.de](docs/ddnss.de.md)
- [deSEC](docs/desec.md)
- [DigitalOcean](docs/digitalocean.md)
- [DD24](docs/dd24.md)
- [Domeneshop](docs/domeneshop.md)
- [DonDominio](docs/dondominio.md)
- [DNSOMatic](docs/dnsomatic.md)
- [DNSPod](docs/dnspod.md)
@@ -222,13 +236,17 @@ Check the documentation for your DNS provider:
- [GoDaddy](docs/godaddy.md)
- [GoIP.de](docs/goip.md)
- [He.net](docs/he.net.md)
- [Hetzner](docs/hetzner.md)
- [Infomaniak](docs/infomaniak.md)
- [INWX](docs/inwx.md)
- [Ionos](docs/ionos.md)
- [Linode](docs/linode.md)
- [Loopia](docs/loopia.md)
- [LuaDNS](docs/luadns.md)
- [Myaddr](docs/myaddr.md)
- [Name.com](docs/name.com.md)
- [Namecheap](docs/namecheap.md)
- [NameSilo](docs/namesilo.md)
- [Netcup](docs/netcup.md)
- [NoIP](docs/noip.md)
- [Now-DNS](docs/nowdns.md)
@@ -236,16 +254,20 @@ Check the documentation for your DNS provider:
- [OpenDNS](docs/opendns.md)
- [OVH](docs/ovh.md)
- [Porkbun](docs/porkbun.md)
- [Route53](docs/route53.md)
- [Selfhost.de](docs/selfhost.de.md)
- [Servercow.de](docs/servercow.md)
- [Spdyn](docs/spdyn.md)
- [Strato.de](docs/strato.md)
- [Variomedia.de](docs/variomedia.md)
- [Vultr](docs/vultr.md)
- [Zoneedit](docs/zoneedit.md)
- [Custom](docs/custom.md)
Note that:
- you can specify multiple hosts for the same domain using a comma separated list. For example with `"host": "@,subdomain1,subdomain2",`.
- you can specify multiple owners/hosts for the same domain using a comma separated list. For example with `"domain": "example.com,sub.example.com,sub2.example.com",`.
⚠️ this is a bit different for DuckDNS and GoIP, see their respective documentation.
### Environment variables
@@ -276,9 +298,10 @@ Note that:
| `RESOLVER_ADDRESS` | Your network DNS | A plaintext DNS address to use to resolve your domain names defined in your settings only. For example it can be `1.1.1.1:53`. This is useful for split dns, see [#389](https://github.com/qdm12/ddns-updater/issues/389) |
| `LOG_LEVEL` | `info` | Level of logging, `debug`, `info`, `warning` or `error` |
| `LOG_CALLER` | `hidden` | Show caller per log line, `hidden` or `short` |
| `SHOUTRRR_ADDRESSES` | | (optional) Comma separated list of [Shoutrrr addresses](https://containrrr.dev/shoutrrr/v0.8/services/overview/) (notification services) |
| `SHOUTRRR_ADDRESSES` | | (optional) Comma separated list of [Shoutrrr addresses](https://containrrr.dev/shoutrrr/v0.8/services/overview/) (notification services) |
| `SHOUTRRR_DEFAULT_TITLE` | `DDNS Updater` | Default title for Shoutrrr notifications |
| `TZ` | | Timezone to have accurate times, i.e. `America/Montreal` |
| `UMASK` | System current umask | Umask to set for the program in octal, i.e. `0022` |
#### Public IP
@@ -294,7 +317,6 @@ You can otherwise customize it with the following:
- `ipify` using [https://api64.ipify.org](https://api64.ipify.org)
- `ifconfig` using [https://ifconfig.io/ip](https://ifconfig.io/ip)
- `ipinfo` using [https://ipinfo.io/ip](https://ipinfo.io/ip)
- `google` using [https://domains.google.com/checkip](https://domains.google.com/checkip)
- `spdyn` using [https://checkip.spdyn.de](https://checkip.spdyn.de/)
- `ipleak` using [https://ipleak.net/json](https://ipleak.net/json)
- `icanhazip` using [https://icanhazip.com](https://icanhazip.com)
@@ -382,7 +404,7 @@ We could do an API call to get the record IP address every period, but that woul
You can build the image yourself with:
```sh
docker build -t qmcgaw/ddns-updater https://github.com/qdm12/ddns-updater.git
docker build -t ghcr.io/qdm12/ddns-updater https://github.com/qdm12/ddns-updater.git
```
You can use optional build arguments with `--build-arg KEY=VALUE` from the table below:
@@ -400,7 +422,6 @@ You can use optional build arguments with `--build-arg KEY=VALUE` from the table
- [Contribute with code](.github/CONTRIBUTING.md)
- [Github workflows to know what's building](https://github.com/qdm12/ddns-updater/actions)
- [List of issues and feature requests](https://github.com/qdm12/ddns-updater/issues)
- [Kanban board](https://github.com/qdm12/ddns-updater/projects/1)
## License

View File

@@ -26,6 +26,7 @@ import (
"github.com/qdm12/ddns-updater/internal/resolver"
"github.com/qdm12/ddns-updater/internal/server"
"github.com/qdm12/ddns-updater/internal/shoutrrr"
"github.com/qdm12/ddns-updater/internal/system"
"github.com/qdm12/ddns-updater/internal/update"
"github.com/qdm12/ddns-updater/pkg/publicip"
"github.com/qdm12/goservices"
@@ -45,7 +46,7 @@ func main() {
buildInfo := models.BuildInformation{
Version: version,
Commit: commit,
Date: date,
Created: date,
}
logger := log.New()
@@ -98,7 +99,8 @@ func main() {
}
func _main(ctx context.Context, reader *reader.Reader, args []string, logger log.LoggerInterface,
buildInfo models.BuildInformation, timeNow func() time.Time) (err error) {
buildInfo models.BuildInformation, timeNow func() time.Time,
) (err error) {
if len(args) > 1 {
switch args[1] {
case "version", "-version", "--version":
@@ -129,6 +131,10 @@ func _main(ctx context.Context, reader *reader.Reader, args []string, logger log
return err
}
if *config.Paths.Umask > 0 {
system.SetUmask(*config.Paths.Umask)
}
shoutrrrSettings := shoutrrr.Settings{
Addresses: config.Shoutrrr.Addresses,
DefaultTitle: config.Shoutrrr.DefaultTitle,
@@ -262,7 +268,7 @@ func _main(ctx context.Context, reader *reader.Reader, args []string, logger log
}
func printSplash(buildInfo models.BuildInformation) {
announcementExp, err := time.Parse(time.RFC3339, "2023-07-15T00:00:00Z")
announcementExp, err := time.Parse(time.RFC3339, "2024-10-15T00:00:00Z")
if err != nil {
panic(err)
}
@@ -272,8 +278,8 @@ func printSplash(buildInfo models.BuildInformation) {
Emails: []string{"quentin.mcgaw@gmail.com"},
Version: buildInfo.Version,
Commit: buildInfo.Commit,
BuildDate: buildInfo.Date,
Announcement: "Public IP dns provider GOOGLE, see https://github.com/qdm12/ddns-updater/issues/492",
Created: buildInfo.Created,
Announcement: "Public IP http provider GOOGLE is no longer working",
AnnounceExp: announcementExp,
// Sponsor information
PaypalUser: "qmcgaw",
@@ -285,7 +291,8 @@ func printSplash(buildInfo models.BuildInformation) {
}
func readConfig(reader *reader.Reader, logger log.LoggerInterface) (
config config.Config, err error) {
config config.Config, err error,
) {
err = config.Read(reader, logger)
if err != nil {
return config, fmt.Errorf("reading settings: %w", err)
@@ -315,14 +322,15 @@ func logProvidersCount(providersCount int, logger log.LeveledLogger) {
func readRecords(providers []provider.Provider, persistentDB *persistence.Database,
logger log.LoggerInterface, shoutrrrClient *shoutrrr.Client) (
records []recordslib.Record, err error) {
records []recordslib.Record, err error,
) {
records = make([]recordslib.Record, len(providers))
for i, provider := range providers {
logger.Info("Reading history from database: domain " +
provider.Domain() + " host " + provider.Host() +
provider.Domain() + " owner " + provider.Owner() +
" " + provider.IPVersion().String())
events, err := persistentDB.GetEvents(provider.Domain(),
provider.Host(), provider.IPVersion())
provider.Owner(), provider.IPVersion())
if err != nil {
shoutrrrClient.Notify(err.Error())
return nil, err
@@ -333,7 +341,8 @@ func readRecords(providers []provider.Provider, persistentDB *persistence.Databa
}
func exitHealthchecksio(hioClient *healthchecksio.Client,
logger log.LoggerInterface, state healthchecksio.State) {
logger log.LoggerInterface, state healthchecksio.State,
) {
const timeout = 3 * time.Second
ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()
@@ -346,8 +355,9 @@ func exitHealthchecksio(hioClient *healthchecksio.Client,
//nolint:ireturn
func createHealthServer(db health.AllSelecter, resolver health.LookupIPer,
logger log.LoggerInterface, serverAddress string) (
healthServer goservices.Service, err error) {
if !health.IsDocker() {
healthServer goservices.Service, err error,
) {
if serverAddress == "" {
return noop.New("healthcheck server"), nil
}
isHealthy := health.MakeIsHealthy(db, resolver)
@@ -359,7 +369,8 @@ func createHealthServer(db health.AllSelecter, resolver health.LookupIPer,
func createServer(ctx context.Context, config config.Server,
logger log.LoggerInterface, db server.Database,
updaterService server.UpdateForcer) (
service goservices.Service, err error) {
service goservices.Service, err error,
) {
if !*config.Enabled {
return noop.New("server"), nil
}

View File

@@ -3,7 +3,6 @@
{
"provider": "namecheap",
"domain": "example.com",
"host": "@",
"password": "e5322165c1d74692bfa6d807100c0310"
},
{
@@ -13,8 +12,7 @@
},
{
"provider": "godaddy",
"domain": "example.org",
"host": "subdomain",
"domain": "subdomain.example.org",
"key": "aaaaaaaaaaaaaaaa",
"secret": "aaaaaaaaaaaaaaaa"
},

View File

@@ -1,7 +1,7 @@
version: "3.7"
services:
ddns-updater:
image: qmcgaw/ddns-updater
image: ghcr.io/qdm12/ddns-updater
container_name: ddns-updater
network_mode: bridge
ports:

View File

@@ -10,7 +10,6 @@
{
"provider": "aliyun",
"domain": "domain.com",
"host": "@",
"access_key_id": "your access_key_id",
"access_secret": "your access_secret",
"ip_version": "ipv4",
@@ -22,8 +21,7 @@
### Compulsory parameters
- `"domain"`
- `"host"` is your host and can be a subdomain or `"@"`
- `"domain"` is the domain to update. It can be `example.com` (root domain) or `sub.example.com` (subdomain of `example.com`).
- `"access_key_id"`
- `"access_secret"`

View File

@@ -9,8 +9,7 @@
"settings": [
{
"provider": "allinkl",
"domain": "domain.com",
"host": "host",
"domain": "sub.domain.com",
"username": "dynXXXXXXX",
"password": "password",
"ip_version": "ipv4",
@@ -22,8 +21,7 @@
### Compulsory parameters
- `"domain"`
- `"host"` is your host (subdomain)
- `"domain"` is the domain to update. It can be `example.com` (root domain) or `sub.example.com` (subdomain of `example.com`).
- `"username"` username (usually starts with dyn followed by numbers)
- `"password"` password in plain text

View File

@@ -9,8 +9,7 @@
"settings": [
{
"provider": "changeip",
"domain": "domain.com",
"host": "host",
"domain": "sub.domain.com",
"username": "dynXXXXXXX",
"password": "password",
"ip_version": "ipv4",
@@ -22,8 +21,7 @@
### Compulsory parameters
- `"domain"`
- `"host"` is your host (subdomain)
- `"domain"` is the domain to update. It can be `example.com` (root domain) or `sub.example.com` (subdomain of `example.com`).
- `"username"`
- `"password"`

View File

@@ -11,7 +11,6 @@
"provider": "cloudflare",
"zone_identifier": "some id",
"domain": "domain.com",
"host": "@",
"ttl": 600,
"token": "yourtoken",
"ip_version": "ipv4",
@@ -24,8 +23,7 @@
### Compulsory parameters
- `"zone_identifier"` is the Zone ID of your site, from the domain overview page written as *Zone ID*
- `"domain"`
- `"host"` is your host and can be `"@"`, a subdomain or the wildcard `"*"`.
- `"domain"` is the domain to update. It can be `example.com` (root domain), `sub.example.com` (subdomain of `example.com`) or `*.example.com` for the wildcard.
See [this issue comment for context](https://github.com/qdm12/ddns-updater/issues/243#issuecomment-928313949). This is left as is for compatibility.
- `"ttl"` integer value for record TTL in seconds (specify 1 for automatic)
- One of the following ([how to find API keys](https://developers.cloudflare.com/fundamentals/api/get-started/)):

View File

@@ -15,7 +15,6 @@ Feel free to open issues to extend its configuration options.
{
"provider": "custom",
"domain": "example.com",
"host": "@",
"url": "https://example.com/update?domain=example.com&host=@&username=username&client_key=client_key",
"ipv4key": "ipv4",
"ipv6key": "ipv6",
@@ -29,11 +28,10 @@ Feel free to open issues to extend its configuration options.
### Compulsory parameters
- `"domain"` is the domain name to update
- `"host"` is the host to update, which can be `"@"` (root), `"*"` or a subdomain
- `"domain"` is the domain to update. It can be `example.com` (root domain), `sub.example.com` (subdomain of `example.com`) or `*.example.com` for the wildcard.
- `"url"` is the URL to update your records and should contain all the information EXCEPT the IP address to update
- `"ipv4key"` is the URL query parameter name for the IPv4 address, for example `ipv4` will be added to the URL with `&ipv4=1.2.3.4`.
- `"ipv6key"` is the URL query parameter name for the IPv6 address, for example `ipv6` will be added to the URL with `&ipv6=::aaff`. Even if you don't use IPv6, this must be set to something.
- `"ipv4key"` is the URL query parameter name for the IPv4 address, for example `ipv4` will be added to the URL with `&ipv4=1.2.3.4`. In the rare case you do not wish to send an IPv4 query parameter to the registrar API when updating your A (IPv4) record, leave it to `"ipv4key": ""`.
- `"ipv6key"` is the URL query parameter name for the IPv6 address, for example `ipv6` will be added to the URL with `&ipv6=::aaff`. In the rare case you do not wish to send an IPv6 query parameter to the registrar API when updating your AAAA (IPv6) record, leave it to `"ipv6key": ""`.
- `"success_regex"` is a regular expression to match the response from the server to determine if the update was successful. You can use [regex101.com](https://regex101.com/) to find the regular expression you want. For example `good` would match any response containing the word "good".
### Optional parameters

View File

@@ -10,7 +10,6 @@
{
"provider": "dd24",
"domain": "domain.com",
"host": "@",
"password": "password",
"ip_version": "ipv4",
"ipv6_suffix": ""
@@ -21,8 +20,7 @@
### Compulsory parameters
- `"domain"`
- `"host"` is your host and can be a subdomain or `"@"`
- `"domain"` is the domain to update. It can be `example.com` (root domain) or `sub.example.com` (subdomain of `example.com`).
- `"password"` is your password
### Optional parameters

View File

@@ -9,9 +9,7 @@
"settings": [
{
"provider": "ddnss",
"provider_ip": true,
"domain": "domain.com",
"host": "@",
"username": "user",
"password": "password",
"dual_stack": false,
@@ -24,14 +22,13 @@
### Compulsory parameters
- `"domain"`
- `"host"` is your host and can be a subdomain or `"@"`
- `"domain"` is the domain to update. It can be `example.com` (root domain) or `sub.example.com` (subdomain of `example.com`).
- `"username"`
- `"password"`
### Optional parameters
- `"dual_stack"` can be set to `true` **if you have turn on dual stack for your record** to update both IPv4 and IPv6 addresses. Note it is ignored if `"provider_ip": true`. More precisely:
- `"dual_stack"` can be set to `true` **if you have turn on dual stack for your record** to update both IPv4 and IPv6 addresses. More precisely:
- if it is `false`, the updates are done using the `ip` parameter and only one IP address can be set (ipv4 or ipv6, whichever is last sent).
- if it is `true`, the updates are done using the `ip` and `ip6` parameters, for IPv4 and IPv6 respectively, and both can be set on the same record
- `"ip_version"` can be `ipv4` (A records), or `ipv6` (AAAA records) or `ipv4 or ipv6` (update one of the two, depending on the public ip found). It defaults to `ipv4 or ipv6`.

View File

@@ -9,12 +9,10 @@
"settings": [
{
"provider": "desec",
"domain": "dedyn.io",
"host": "host",
"domain": "sub.dedyn.io",
"token": "token",
"ip_version": "ipv4",
"ipv6_suffix": "",
"provider_ip": false
"ipv6_suffix": ""
}
]
}
@@ -22,15 +20,13 @@
### Compulsory parameters
- `"domain"`
- `"host"` can be `@` for the root domain or a subdomain or a wildcard subdomain (`*`), defaults to `@`
- `"domain"` is the domain to update. It can be `example.com` (root domain), `sub.example.com` (subdomain of `example.com`) or `*.example.com` for the wildcard.
- `"token"` is your token that you can create [here](https://desec.io/tokens)
### Optional parameters
- `"ip_version"` can be `ipv4` (A records), or `ipv6` (AAAA records) or `ipv4 or ipv6` (update one of the two, depending on the public ip found). It defaults to `ipv4 or ipv6`.
- `"ipv6_suffix"` is the IPv6 interface identifier suffix to use. It can be for example `0:0:0:0:72ad:8fbb:a54e:bedd/64`. If left empty, it defaults to no suffix and the raw public IPv6 address obtained is used in the record updating.
- `"provider_ip"` can be set to `true` to let your DNS provider determine your IPv4 address (and/or IPv6 address) automatically when you send an update request, without sending the new IP address detected by the program in the request.
## Domain setup

View File

@@ -10,7 +10,6 @@
{
"provider": "digitalocean",
"domain": "domain.com",
"host": "@",
"token": "yourtoken",
"ip_version": "ipv4",
"ipv6_suffix": ""
@@ -21,8 +20,7 @@
### Compulsory parameters
- `"domain"`
- `"host"` is your host and can be a subdomain or `"@"` or `"*"`
- `"domain"` is the domain to update. It can be `example.com` (root domain), `sub.example.com` (subdomain of `example.com`) or `*.example.com` for the wildcard.
- `"token"` is your token that you can create [here](https://cloud.digitalocean.com/settings/applications)
### Optional parameters

View File

@@ -10,10 +10,8 @@
{
"provider": "dnsomatic",
"domain": "domain.com",
"host": "@",
"username": "username",
"password": "password",
"provider_ip": true,
"ip_version": "ipv4",
"ipv6_suffix": ""
}
@@ -23,11 +21,9 @@
### Compulsory parameters
- `"domain"`
- `"host"` is your host and can be a subdomain or `"@"` or `"*"`
- `"domain"` is the domain to update. It can be `example.com` (root domain), `sub.example.com` (subdomain of `example.com`) or `*.example.com` for the wildcard.
- `"username"`
- `"password"`
- `"provider_ip"`
### Optional parameters

View File

@@ -10,7 +10,6 @@
{
"provider": "dnspod",
"domain": "domain.com",
"host": "@",
"token": "yourtoken",
"ip_version": "ipv4",
"ipv6_suffix": ""
@@ -21,8 +20,7 @@
### Compulsory parameters
- `"domain"`
- `"host"` is your host and can be a subdomain or `"@"`
- `"domain"` is the domain to update. It can be `example.com` (root domain) or `sub.example.com` (subdomain of `example.com`).
- `"token"`
### Optional parameters

31
docs/domeneshop.md Normal file
View File

@@ -0,0 +1,31 @@
# Domeneshop.no
## Configuration
### Example
```json
{
"settings": [
{
"provider": "domeneshop",
"domain": "domain.com,seconddomain.com",
"token": "token",
"secret": "secret",
"ip_version": "ipv4",
"ipv6_suffix": ""
}
]
}
```
### Compulsory parameters
- `"domain"` is the domain to update. It can be `example.com` (root domain) or `sub.example.com` (subdomain of `example.com`)
- `"token"` See [api.domeneshop.no/docs/](https://api.domeneshop.no/docs/) for instructions on how to generate credentials.
- `"secret"`
### Optional parameters
- `"ip_version"` can be `ipv4` (A records), or `ipv6` (AAAA records) or `ipv4 or ipv6` (update one of the two, depending on the public ip found). It defaults to `ipv4 or ipv6`.
- `"ipv6_suffix"` is the IPv6 interface identifier suffix to use. It can be for example `0:0:0:0:72ad:8fbb:a54e:bedd/64`. If left empty, it defaults to no suffix and the raw public IPv6 address obtained is used in the record updating.

View File

@@ -10,8 +10,6 @@
{
"provider": "dondominio",
"domain": "domain.com",
"host": "@",
"name": "something",
"username": "username",
"key": "key",
"ip_version": "ipv4",
@@ -23,9 +21,7 @@
### Compulsory parameters
- `"domain"`
- `"host"` is the subdomain to update which can be `@`, `*` or a subdomain
- `"name"` is the name of the service/hosting
- `"domain"` is the domain to update. It can be `example.com` (root domain), `sub.example.com` (subdomain of `example.com`) or `*.example.com` for the wildcard.
- `"username"`
- `"password"`

View File

@@ -10,7 +10,6 @@
{
"provider": "dreamhost",
"domain": "domain.com",
"host": "@",
"key": "key",
"ip_version": "ipv4",
"ipv6_suffix": ""
@@ -26,7 +25,7 @@
### Optional parameters
- `"host"` is your host and can be a subdomain or `"@"`. It defaults to `"@"`.
- `"domain"` is the domain to update. It can be `example.com` (root domain) or `sub.example.com` (subdomain of `example.com`).
- `"ip_version"` can be `ipv4` (A records), or `ipv6` (AAAA records) or `ipv4 or ipv6` (update one of the two, depending on the public ip found). It defaults to `ipv4 or ipv6`.
- `"ipv6_suffix"` is the IPv6 interface identifier suffix to use. It can be for example `0:0:0:0:72ad:8fbb:a54e:bedd/64`. If left empty, it defaults to no suffix and the raw public IPv6 address obtained is used in the record updating.

View File

@@ -9,11 +9,10 @@
"settings": [
{
"provider": "duckdns",
"host": "host",
"domain": "sub.duckdns.org",
"token": "token",
"ip_version": "ipv4",
"ipv6_suffix": "",
"provider_ip": true
"ipv6_suffix": ""
}
]
}
@@ -21,14 +20,16 @@
### Compulsory parameters
- `"host"` is your host, for example `subdomain` for `subdomain.duckdns.org`
- `"domain"` is the domain to update. The [eTLD](https://developer.mozilla.org/en-US/docs/Glossary/eTLD) must be `duckdns.org`. For example:
- for the root owner/host `@`, it would be `mydomain.duckdns.org`
- for the owner/host `sub`, it would be `sub.mydomain.duckdns.org`
- for multiple domains, it can be `sub1.mydomain.duckdns.org,sub2.mydomain.duckdns.org` BUT it cannot be `a.duckdns.org,b.duckdns.org`, since the effective domains would be `a.duckdns.org` and `b.duckdns.org`
- `"token"`
### Optional parameters
- `"ip_version"` can be `ipv4` (A records), or `ipv6` (AAAA records) or `ipv4 or ipv6` (update one of the two, depending on the public ip found). It defaults to `ipv4 or ipv6`.
- `"ipv6_suffix"` is the IPv6 interface identifier suffix to use. It can be for example `0:0:0:0:72ad:8fbb:a54e:bedd/64`. If left empty, it defaults to no suffix and the raw public IPv6 address obtained is used in the record updating.
- `"provider_ip"` can be set to `true` to let your DNS provider determine your IPv4 address (**NOT** your IPv6 address) automatically when you send an update request, without sending the new IP address detected by the program in the request.
## Domain setup

View File

@@ -10,7 +10,6 @@
{
"provider": "dyn",
"domain": "domain.com",
"host": "@",
"username": "username",
"client_key": "client_key",
"ip_version": "ipv4",
@@ -22,8 +21,7 @@
### Compulsory parameters
- `"domain"`
- `"host"` is your host and can be a subdomain or `"@"` or `"*"`
- `"domain"` is the domain to update. It can be `example.com` (root domain), `sub.example.com` (subdomain of `example.com`) or `*.example.com` for the wildcard.
- `"username"`
- `"client_key"`

View File

@@ -10,13 +10,11 @@
{
"provider": "dynu",
"domain": "domain.com",
"host": "@",
"group": "group",
"username": "username",
"password": "password",
"ip_version": "ipv4",
"ipv6_suffix": "",
"provider_ip": true
"ipv6_suffix": ""
}
]
}
@@ -24,8 +22,7 @@
### Compulsory parameters
- `"domain"`
- `"host"` is your host and can be a subdomain or `"@"`
- `"domain"` is the domain to update. It can be `example.com` (root domain) or `sub.example.com` (subdomain of `example.com`).
- `"username"`
- `"password"` could be plain text or password in MD5 or SHA256 format (There's also an option for setting a password for IP Update only)
@@ -33,7 +30,6 @@
- `"ip_version"` can be `ipv4` (A records), or `ipv6` (AAAA records) or `ipv4 or ipv6` (update one of the two, depending on the public ip found). It defaults to `ipv4 or ipv6`.
- `"ipv6_suffix"` is the IPv6 interface identifier suffix to use. It can be for example `0:0:0:0:72ad:8fbb:a54e:bedd/64`. If left empty, it defaults to no suffix and the raw public IPv6 address obtained is used in the record updating.
- `"provider_ip"` can be set to `true` to let your DNS provider determine your IPv4 address (and/or IPv6 address) automatically when you send an update request, without sending the new IP address detected by the program in the request.
- `"group"` specify the Group for which you want to set the IP (will update any domains and subdomains in the same group)
## Domain setup

View File

@@ -10,11 +10,9 @@
{
"provider": "dynv6",
"domain": "domain.com",
"host": "@",
"token": "token",
"ip_version": "ipv4",
"ipv6_suffix": "",
"provider_ip": true
"ipv6_suffix": ""
}
]
}
@@ -22,14 +20,12 @@
### Compulsory parameters
- `"domain"`
- `"host"` is your host and can be a subdomain or `"@"`
- `"domain"` is the domain to update. It can be `example.com` (root domain) or `sub.example.com` (subdomain of `example.com`).
- `"token"` that you can obtain [here](https://dynv6.com/keys#token)
### Optional parameters
- `"ip_version"` can be `ipv4` (A records), or `ipv6` (AAAA records) or `ipv4 or ipv6` (update one of the two, depending on the public ip found). It defaults to `ipv4 or ipv6`.
- `"ipv6_suffix"` is the IPv6 interface identifier suffix to use. It can be for example `0:0:0:0:72ad:8fbb:a54e:bedd/64`. If left empty, it defaults to no suffix and the raw public IPv6 address obtained is used in the record updating.
- `"provider_ip"` can be set to `true` to let your DNS provider determine your IPv4 address (and/or IPv6 address) automatically when you send an update request, without sending the new IP address detected by the program in the request.
## Domain setup

View File

@@ -10,12 +10,10 @@
{
"provider": "easydns",
"domain": "domain.com",
"host": "@",
"username": "username",
"token": "token",
"ip_version": "ipv4",
"ipv6_suffix": "",
"provider_ip": true
"ipv6_suffix": ""
}
]
}
@@ -23,8 +21,7 @@
### Compulsory parameters
- `"domain"`
- `"host"` is your host and can be a subdomain or `"@"` or `"*"`
- `"domain"` is the domain to update. It can be `example.com` (root domain), `sub.example.com` (subdomain of `example.com`) or `*.example.com` for the wildcard.
- `"username"`
- `"token"`
@@ -32,6 +29,5 @@
- `"ip_version"` can be `ipv4` (A records), or `ipv6` (AAAA records) or `ipv4 or ipv6` (update one of the two, depending on the public ip found). It defaults to `ipv4 or ipv6`.
- `"ipv6_suffix"` is the IPv6 interface identifier suffix to use. It can be for example `0:0:0:0:72ad:8fbb:a54e:bedd/64`. If left empty, it defaults to no suffix and the raw public IPv6 address obtained is used in the record updating.
- `"provider_ip"` can be set to `true` to let your DNS provider determine your IPv4 address (and/or IPv6 address) automatically when you send an update request, without sending the new IP address detected by the program in the request.
## Domain setup

View File

@@ -12,7 +12,6 @@
{
"provider": "example",
"domain": "domain.com",
"host": "@",
"username": "username",
"password": "password",
"ip_version": "ipv4",
@@ -24,8 +23,7 @@
### Compulsory parameters
- `"domain"`
- `"host"` is your host and can be a subdomain or `"@"` or the wildcard `"*"`
- `"domain"` is the domain to update. It can be `example.com` (root domain), `sub.example.com` (subdomain of `example.com`) or `*.example.com` for the wildcard.
- `"username"`
- `"password"`

View File

@@ -9,8 +9,7 @@
"settings": [
{
"provider": "freedns",
"domain": "domain.com",
"host": "host",
"domain": "sub.domain.com",
"token": "token",
"ip_version": "ipv4",
"ipv6_suffix": ""
@@ -21,8 +20,7 @@
### Compulsory parameters
- `"domain"`
- `"host"` is your host (subdomain)
- `"domain"` is the domain to update. It can be `example.com` (root domain) or `sub.example.com` (subdomain of `example.com`).
- `"token"` is the randomized update token you use to update your record
### Optional parameters

View File

@@ -12,7 +12,6 @@ This provider uses Gandi v5 API
{
"provider": "gandi",
"domain": "domain.com",
"host": "@",
"personal_access_token": "token",
"ttl": 3600,
"ip_version": "ipv4",
@@ -24,8 +23,7 @@ This provider uses Gandi v5 API
### Compulsory parameters
- `"domain"`
- `"host"` which can be a subdomain, `@` or a wildcard `*`
- `"domain"` is the domain to update. It can be `example.com` (root domain), `sub.example.com` (subdomain of `example.com`) or `*.example.com` for the wildcard.
- `"personal_access_token"`
### Optional parameters

View File

@@ -17,7 +17,6 @@
// ...
},
"domain": "domain.com",
"host": "@",
"ip_version": "ipv4",
"ipv6_suffix": ""
}
@@ -30,8 +29,7 @@
- `"project"` is the id of your Google Cloud project
- `"zone"` is the zone, that your DNS record is located in
- `"credentials"` is the JSON credentials for your Google Cloud project. This is usually downloaded as a JSON file, which you can copy paste the content as the value of the `"credentials"` key. More information on how to get it is available [here](https://cloud.google.com/docs/authentication/getting-started). Please ensure your service account has all necessary permissions to create/update/list/get DNS records within your project.
- `"domain"` is the TLD of you DNS record (without a trailing dot)
- `"host"` is your host and can be a subdomain or `"@"` or `"*"`
- `"domain"` is the domain to update. It can be `example.com` (root domain), `sub.example.com` (subdomain of `example.com`) or `*.example.com` for the wildcard.
### Optional parameters

View File

@@ -10,7 +10,6 @@
{
"provider": "godaddy",
"domain": "domain.com",
"host": "@",
"key": "key",
"secret": "secret",
"ip_version": "ipv4",
@@ -22,8 +21,7 @@
### Compulsory parameters
- `"domain"`
- `"host"` is your host and can be a subdomain, `"@"` or `"*"` generally
- `"domain"` is the domain to update. It can be `example.com` (root domain), `sub.example.com` (subdomain of `example.com`) or `*.example.com` for the wildcard.
- `"key"`
- `"secret"`

View File

@@ -9,11 +9,9 @@
"settings": [
{
"provider": "goip",
"domain": "goip.de",
"host": "mysubdomain",
"domain": "sub.mydomain.goip.de",
"username": "username",
"password": "password",
"provider_ip": true,
"ip_version": "",
"ipv6_suffix": ""
@@ -24,13 +22,15 @@
### Compulsory parameters
- `"host"` is the full FQDN of your ddns address. sample.goip.de or something.goip.it
- `"domain"` is the domain to update. For example, for the owner/host `sub`, it would be `sub.goip.de`. The [eTLD](https://developer.mozilla.org/en-US/docs/Glossary/eTLD) must be `goip.de` or `goip.it`.
- `"domain"` is the domain to update. The [eTLD](https://developer.mozilla.org/en-US/docs/Glossary/eTLD) must be `goip.de` or `goip.it`. For example:
- for the root owner/host `@`, it would be `mydomain.goip.de`
- for the owner/host `sub`, it would be `sub.mydomain.goip.de`
- for multiple domains, it can be `sub1.mydomain.goip.de,sub2.mydomain.goip.de` BUT it cannot be `a.goip.de,b.goip.de`, since the effective domains would be `a.goip.de` and `b.goip.de`
- `"username"` is your goip.de username listed under "Routers"
- `"password"` is your router account password
### Optional parameters
- `"domain"` is the domain name which can be `goip.de` or `goip.it`, and defaults to `goip.de` if left unset.
- `"provider_ip"` can be set to `true` to let your DNS provider determine your IPv4 address (and/or IPv6 address) automatically when you send an update request, without sending the new IP address detected by the program in the request. This is automatically disabled for an IPv6 public address since it is not supported.
- `"ip_version"` can be `ipv4` (A records), or `ipv6` (AAAA records) or `ipv4 or ipv6` (update one of the two, depending on the public ip found). It defaults to `ipv4`.
- `"ipv6_suffix"` is the IPv6 interface identifier suffix to use. It can be for example `0:0:0:0:72ad:8fbb:a54e:bedd/64`. If left empty, it defaults to no suffix and the raw public IPv6 address obtained is used in the record updating.

View File

@@ -10,9 +10,7 @@
{
"provider": "he",
"domain": "domain.com",
"host": "@",
"password": "password",
"provider_ip": true,
"ip_version": "ipv4",
"ipv6_suffix": ""
}
@@ -22,14 +20,12 @@
### Compulsory parameters
- `"domain"`
- `"host"` is your host and can be a subdomain or `"@"` or `"*"` (untested)
- `"domain"` is the domain to update. It can be `example.com` (root domain), `sub.example.com` (subdomain of `example.com`) or `*.example.com` for the wildcard. (untested)
- `"password"`
### Optional parameters
- `"ip_version"` can be `ipv4` (A records), or `ipv6` (AAAA records) or `ipv4 or ipv6` (update one of the two, depending on the public ip found). It defaults to `ipv4 or ipv6`.
- `"ipv6_suffix"` is the IPv6 interface identifier suffix to use. It can be for example `0:0:0:0:72ad:8fbb:a54e:bedd/64`. If left empty, it defaults to no suffix and the raw public IPv6 address obtained is used in the record updating.
- `"provider_ip"` can be set to `true` to let your DNS provider determine your IPv4 address (and/or IPv6 address) automatically when you send an update request, without sending the new IP address detected by the program in the request.
## Domain setup

View File

@@ -11,7 +11,6 @@
"provider": "hetzner",
"zone_identifier": "some id",
"domain": "domain.com",
"host": "@",
"ttl": 600,
"token": "yourtoken",
"ip_version": "ipv4",
@@ -24,8 +23,7 @@
### Compulsory parameters
- `"zone_identifier"` is the Zone ID of your site, from the domain overview page written as *Zone ID*
- `"domain"`
- `"host"` is your host and can be `"@"`, a subdomain or the wildcard `"*"`.
- `"domain"` is the domain to update. It can be `example.com` (root domain), `sub.example.com` (subdomain of `example.com`) or `*.example.com` for the wildcard.
- `"ttl"` optional integer value corresponding to a number of seconds
- One of the following ([how to find API keys](https://docs.hetzner.com/cloud/api/getting-started/generating-api-token)):
- API Token `"token"`, configured with DNS edit permissions for your DNS name's zone

View File

@@ -10,12 +10,10 @@
{
"provider": "infomaniak",
"domain": "domain.com",
"host": "@",
"username": "username",
"password": "password",
"ip_version": "ipv4",
"ipv6_suffix": "",
"provider_ip": true
"ipv6_suffix": ""
}
]
}
@@ -23,8 +21,7 @@
### Compulsory parameters
- `"domain"`
- `"host"` is your host and can be a subdomain or `"@"`
- `"domain"` is the domain to update. It can be `example.com` (root domain) or `sub.example.com` (subdomain of `example.com`).
- `"username"` for dyndns (**not** your infomaniak admin username!)
- `"password"` for dyndns (**not** your infomaniak admin password!)
@@ -32,7 +29,6 @@
- `"ip_version"` can be `ipv4` (A records), or `ipv6` (AAAA records) or `ipv4 or ipv6` (update one of the two, depending on the public ip found). It defaults to `ipv4 or ipv6`.
- `"ipv6_suffix"` is the IPv6 interface identifier suffix to use. It can be for example `0:0:0:0:72ad:8fbb:a54e:bedd/64`. If left empty, it defaults to no suffix and the raw public IPv6 address obtained is used in the record updating.
- `"provider_ip"` can be set to `true` to let your DNS provider determine your IPv4 address (and/or IPv6 address) automatically when you send an update request, without sending the new IP address detected by the program in the request.
## Domain setup

View File

@@ -2,6 +2,8 @@
## Configuration
You must configure a [DynDNS Account in INWX](https://www.inwx.com/en/offer/dyndns) and use the configured account and hostname.
### Example
```json
@@ -10,7 +12,6 @@
{
"provider": "inwx",
"domain": "domain.com",
"host": "@",
"username": "username",
"password": "password",
"ip_version": "ipv4",
@@ -22,8 +23,7 @@
### Compulsory parameters
- `"domain"`
- `"host"` is your host and can be a subdomain or `"@"`
- `"domain"` is the domain configured for the DynDNS Account. It can be `example.com` (root domain) or `sub.example.com` (subdomain of `example.com`).
- `"username"`
- `"password"`

View File

@@ -10,7 +10,6 @@
{
"provider": "ionos",
"domain": "domain.com",
"host": "@",
"api_key": "api_key",
"ip_version": "ipv4",
"ipv6_suffix": ""
@@ -21,9 +20,8 @@
### Compulsory parameters
- `"domain"`
- `"host"` is your host and can be a subdomain or `"@"` or `"*"`
- `"api_key"` is your API key, obtained from [creating an API key](https://www.ionos.com/help/domains/configuring-your-ip-address/set-up-dynamic-dns-with-company-name/#c181598)
- `"domain"` is the domain to update. It can be `example.com` (root domain), `sub.example.com` (subdomain of `example.com`) or `*.example.com` for the wildcard.
- `"api_key"` is your API key, consisting of two parts — a prefix and the key itself — and can be obtained by [creating an API key](https://www.ionos.com/help/domains/configuring-your-ip-address/set-up-dynamic-dns-with-company-name/#c181598). It must follow the format `<prefix>.<key>`.
### Optional parameters

View File

@@ -10,7 +10,6 @@
{
"provider": "linode",
"domain": "domain.com",
"host": "@",
"token": "token",
"ip_version": "ipv4",
"ipv6_suffix": ""
@@ -21,8 +20,7 @@
### Compulsory parameters
- `"domain"`
- `"host"` is your host and can be a subdomain or `"@"` or `"*"`
- `"domain"` is the domain to update. It can be `example.com` (root domain), `sub.example.com` (subdomain of `example.com`) or `*.example.com` for the wildcard.
- `"token"`
### Optional parameters

31
docs/loopia.md Normal file
View File

@@ -0,0 +1,31 @@
# Loopia
## Configuration
### Example
```json
{
"settings": [
{
"provider": "loopia",
"domain": "domain.com",
"username": "username",
"password": "password",
"ip_version": "ipv4",
"ipv6_suffix": ""
}
]
}
```
### Compulsory parameters
- `"domain"` is the domain to update. It can be `example.com` (root domain), `sub.example.com` (subdomain of `example.com`). It cannot be a wildcard domain.
- `"username"`
- `"password"`
### Optional parameters
- `"ip_version"` can be `ipv4` (A records), or `ipv6` (AAAA records) or `ipv4 or ipv6` (update one of the two, depending on the public ip found). It defaults to `ipv4 or ipv6`.
- `"ipv6_suffix"` is the IPv6 interface identifier suffix to use. It can be for example `0:0:0:0:72ad:8fbb:a54e:bedd/64`. If left empty, it defaults to no suffix and the raw public IPv6 address obtained is used in the record updating.

View File

@@ -10,7 +10,6 @@
{
"provider": "luadns",
"domain": "domain.com",
"host": "@",
"email": "email",
"token": "token",
"ip_version": "ipv4",
@@ -22,8 +21,7 @@
### Compulsory parameters
- `"domain"`
- `"host"` is your host and can be a subdomain or `"@"` or `"*"`
- `"domain"` is the domain to update. It can be `example.com` (root domain), `sub.example.com` (subdomain of `example.com`) or `*.example.com` for the wildcard.
- `"email"`
- `"token"`

33
docs/myaddr.md Normal file
View File

@@ -0,0 +1,33 @@
# [Myaddr](https://myaddr.tools/)
## Configuration
### Example
```json
{
"settings": [
{
"provider": "myaddr",
"domain": "your-name.myaddr.tools",
"key": "key",
"ip_version": "ipv4",
"ipv6_suffix": ""
}
]
}
```
### Compulsory parameters
- `"domain"` - the **single** domain to update; note the `key` below updates all records and subdomains for this domain. It should be `your-name.myaddr.tools`.
- `"key"` - the private key corresponding to the domain to update
### Optional parameters
- `"ip_version"` can be `ipv4` (A records), or `ipv6` (AAAA records) or `ipv4 or ipv6` (update one of the two, depending on the public ip found). It defaults to `ipv4 or ipv6`.
- `"ipv6_suffix"` is the IPv6 interface identifier suffix to use. It can be for example `0:0:0:0:72ad:8fbb:a54e:bedd/64`. If left empty, it defaults to no suffix and the raw public IPv6 address obtained is used in the record updating.
## Domain setup
Claim a subdomain at [myaddr.tools](https://myaddr.tools/)

View File

@@ -12,7 +12,6 @@
{
"provider": "name.com",
"domain": "domain.com",
"host": "@",
"username": "username",
"token": "token",
"ttl": 300,
@@ -25,8 +24,7 @@
### Compulsory parameters
- `"domain"`
- `"host"` is your host and can be a subdomain, `"@"` or `"*"` generally
- `"domain"` is the domain to update. It can be `example.com` (root domain), `sub.example.com` (subdomain of `example.com`) or `*.example.com` for the wildcard.
- `"username"` is your account username
- `"token"` which you can obtain from [www.name.com/account/settings/api](https://www.name.com/account/settings/api)

View File

@@ -10,9 +10,7 @@
{
"provider": "namecheap",
"domain": "domain.com",
"host": "@",
"password": "password",
"provider_ip": true
"password": "password"
}
]
}
@@ -20,14 +18,11 @@
### Compulsory parameters
- `"domain"`
- `"host"` is your host and can be a subdomain, `"@"` or `"*"` generally
- `"domain"` is the domain to update. It can be `example.com` (root domain), `sub.example.com` (subdomain of `example.com`) or `*.example.com` for the wildcard.
- `"password"`
### Optional parameters
- `"provider_ip"` can be set to `true` to let your DNS provider determine your IPv4 address (and/or IPv6 address) automatically when you send an update request, without sending the new IP address detected by the program in the request.
Note that Namecheap only supports ipv4 addresses for now.
## Domain setup

51
docs/namesilo.md Normal file
View File

@@ -0,0 +1,51 @@
# NameSilo
[![NameSilo Website](../readme/namesilo.jpg)](https://www.namesilo.com)
## Configuration
### Example
```json
{
"settings": [
{
"provider": "namesilo",
"domain": "sub.example.com",
"key": "71dZaE8c2Aa926Ca2E8c1",
"ttl": 7207,
"ip_version": "ipv4"
}
]
}
```
### Compulsory parameters
- `"domain"` is the domain to update. It can be `example.com` (root domain), `sub.example.com` (subdomain of `example.com`) or `*.example.com` for the wildcard.
- `"key"` is the NameSilo API Key obtained using the domain setup instructions below. For example: `71dZaE8c2Aa926Ca2E8c1`.
### Optional parameters
- `"ip_version"` can be `ipv4` (A records), or `ipv6` (AAAA records) or `ipv4 or ipv6` (update one of the two, depending on the public ip found). It defaults to `ipv4 or ipv6`.
- `"ipv6_suffix"` is the IPv6 interface identifier suffix to use. It can be for example `0:0:0:0:72ad:8fbb:a54e:bedd/64`. If left empty, it defaults to no suffix and the raw public IPv6 address obtained is used in the record updating.
- `"ttl"` is the record's Time to Live (TTL), which defaults to `7207` seconds. It must be numeric, less than `2592001`, and greater than or equal to `3600`. TTL values of `3603` or `7207` may be subject to NameSilo's [Automatic TTL Adjustments](https://www.namesilo.com/support/v2/articles/domain-manager/dns-manager#auto_ttl).
## Domain setup
1. Login to the [Namesilo API Manager](https://www.namesilo.com/account/api-manager) with your account credentials.
1. Generate an API key. The generated API key will look similar to `71dZaE8c2Aa926Ca2E8c1`.
- (do _not_ check the "Generate key for read-only access" box)
[![Before NameSilo API Key](../readme/namesilo1.jpg)](https://www.namesilo.com/account/api-manager)
[![After NameSilo API Key](../readme/namesilo2.jpg)](https://www.namesilo.com/account/api-manager)
## Testing
1. Go to the [NameSilo Domain Manager](https://www.namesilo.com/account_domains.php).
1. Choose "Manage DNS for this domain" (the globe icon) for the domain you wish to test.
[![Manage DNS for this domain](../readme/namesilo3.jpg)](https://www.namesilo.com/account_domains.php)
1. Change the IP address of the host to `127.0.0.1`.
1. Run the ddns-updater.
1. Refresh the Namesilo webpage to check the update occurred.

View File

@@ -14,7 +14,6 @@ Also keep in mind, that TTL, Expire, Retry and Refresh values of the given Domai
{
"provider": "netcup",
"domain": "domain.com",
"host": "host",
"api_key": "xxxxx",
"password": "yyyyy",
"customer_number": "111111",
@@ -27,8 +26,7 @@ Also keep in mind, that TTL, Expire, Retry and Refresh values of the given Domai
### Compulsory parameters
- `"domain"` is your domain
- `"host"` is your host (subdomain) or `"@"` for the root of the domain. It cannot be the wildcard.
- `"domain"` is the domain to update. It can be `example.com` (root domain) or `sub.example.com` (subdomain of `example.com`) or the wildcard `*.example.com`.
- `"api_key"` is your api key (generated in the [customercontrolpanel](https://www.customercontrolpanel.de))
- `"password"` is your api password (generated in the [customercontrolpanel](https://www.customercontrolpanel.de)). Netcup only allows one ApiPassword. This is not the account password. This password is used for all api keys.
- `"customer_number"` is your customer number (viewable in the [customercontrolpanel](https://www.customercontrolpanel.de) next to your name). As seen in the example above, provide the number as string value.

View File

@@ -10,11 +10,9 @@
{
"provider": "njalla",
"domain": "domain.com",
"host": "@",
"key": "key",
"ip_version": "ipv4",
"ipv6_suffix": "",
"provider_ip": true
"ipv6_suffix": ""
}
]
}
@@ -22,15 +20,13 @@
### Compulsory parameters
- `"domain"`
- `"host"` is your host and can be a subdomain or `"@"` or `"*"`
- `"domain"` is the domain to update. It can be `example.com` (root domain), `sub.example.com` (subdomain of `example.com`) or `*.example.com` for the wildcard.
- `"key"` is the key for your record
### Optional parameters
- `"ip_version"` can be `ipv4` (A records), or `ipv6` (AAAA records) or `ipv4 or ipv6` (update one of the two, depending on the public ip found). It defaults to `ipv4 or ipv6`.
- `"ipv6_suffix"` is the IPv6 interface identifier suffix to use. It can be for example `0:0:0:0:72ad:8fbb:a54e:bedd/64`. If left empty, it defaults to no suffix and the raw public IPv6 address obtained is used in the record updating.
- `"provider_ip"` can be set to `true` to let your DNS provider determine your IPv4 address (and/or IPv6 address) automatically when you send an update request, without sending the new IP address detected by the program in the request.
## Domain setup

View File

@@ -10,12 +10,10 @@
{
"provider": "noip",
"domain": "domain.com",
"host": "@",
"username": "username",
"password": "password",
"ip_version": "ipv4",
"ipv6_suffix": "",
"provider_ip": true
"ipv6_suffix": ""
}
]
}
@@ -23,8 +21,7 @@
### Compulsory parameters
- `"domain"`
- `"host"` is your host and can be a subdomain or `"@"`
- `"domain"` is the domain to update. It can be `example.com` (root domain) or `sub.example.com` (subdomain of `example.com`).
- `"username"`
- `"password"`
@@ -32,6 +29,5 @@
- `"ip_version"` can be `ipv4` (A records), or `ipv6` (AAAA records) or `ipv4 or ipv6` (update one of the two, depending on the public ip found). It defaults to `ipv4 or ipv6`.
- `"ipv6_suffix"` is the IPv6 interface identifier suffix to use. It can be for example `0:0:0:0:72ad:8fbb:a54e:bedd/64`. If left empty, it defaults to no suffix and the raw public IPv6 address obtained is used in the record updating.
- `"provider_ip"` can be set to `true` to let your DNS provider determine your IPv4 address (and/or IPv6 address) automatically when you send an update request, without sending the new IP address detected by the program in the request.
## Domain setup

View File

@@ -10,12 +10,10 @@
{
"provider": "opendns",
"domain": "domain.com",
"host": "@",
"username": "username",
"password": "password",
"ip_version": "ipv4",
"ipv6_suffix": "",
"provider_ip": true
"ipv6_suffix": ""
}
]
}
@@ -23,8 +21,7 @@
### Compulsory parameters
- `"domain"`
- `"host"` is your host and can be a subdomain or `"@"`
- `"domain"` is the domain to update. It can be `example.com` (root domain) or `sub.example.com` (subdomain of `example.com`).
- `"username"`
- `"password"`
@@ -32,6 +29,5 @@
- `"ip_version"` can be `ipv4` (A records), or `ipv6` (AAAA records) or `ipv4 or ipv6` (update one of the two, depending on the public ip found). It defaults to `ipv4 or ipv6`.
- `"ipv6_suffix"` is the IPv6 interface identifier suffix to use. It can be for example `0:0:0:0:72ad:8fbb:a54e:bedd/64`. If left empty, it defaults to no suffix and the raw public IPv6 address obtained is used in the record updating.
- `"provider_ip"` can be set to `true` to let your DNS provider determine your IPv4 address (and/or IPv6 address) automatically when you send an update request, without sending the new IP address detected by the program in the request.
## Domain setup

View File

@@ -10,12 +10,10 @@
{
"provider": "ovh",
"domain": "domain.com",
"host": "@",
"username": "username",
"password": "password",
"ip_version": "ipv4",
"ipv6_suffix": "",
"provider_ip": true
"ipv6_suffix": ""
}
]
}
@@ -23,8 +21,7 @@
### Compulsory parameters
- `"domain"`
- `"host"` is your host and can be a subdomain or `"@"`
- `"domain"` is the domain to update. It can be `example.com` (root domain) or `sub.example.com` (subdomain of `example.com`).
#### Using DynHost
@@ -36,7 +33,7 @@
- `"api_endpoint"` default value is `"ovh-eu"`
- `"app_key"` which you can create at [eu.api.ovh.com/createApp](https://eu.api.ovh.com/createApp/)
- `"app_secret"`
- `"consumer_key"`
- `"consumer_key"` which you can get at [www.ovh.com/auth/api/createToken](https://www.ovh.com/auth/api/createToken)
The ZoneDNS implementation allows you to update any record name including *.yourdomain.tld
@@ -44,7 +41,6 @@ The ZoneDNS implementation allows you to update any record name including *.your
- `"ip_version"` can be `ipv4` (A records), or `ipv6` (AAAA records) or `ipv4 or ipv6` (update one of the two, depending on the public ip found). It defaults to `ipv4 or ipv6`.
- `"ipv6_suffix"` is the IPv6 interface identifier suffix to use. It can be for example `0:0:0:0:72ad:8fbb:a54e:bedd/64`. If left empty, it defaults to no suffix and the raw public IPv6 address obtained is used in the record updating.
- `"provider_ip"` can be set to `true` to let your DNS provider determine your IPv4 address (and/or IPv6 address) automatically when you send an update request, without sending the new IP address detected by the program in the request.
- `"mode"` select between two modes, OVH's dynamic hosting service (`"dynamic"`) or OVH's API (`"api"`). Default is `"dynamic"`
## Domain setup

View File

@@ -10,9 +10,8 @@
{
"provider": "porkbun",
"domain": "domain.com",
"host": "@",
"api_key": "sk1_7d119e3f656b00ae042980302e1425a04163c476efec1833q3cb0w54fc6f5022",
"secret_api_key": "pk1_5299b57125c8f3cdf347d2fe0e713311ee3a1e11f11a14942b26472593e35368",
"api_key": "pk1_5299b57125c8f3cdf347d2fe0e713311ee3a1e11f11a14942b26472593e35368",
"secret_api_key": "sk1_7d119e3f656b00ae042980302e1425a04163c476efec1833q3cb0w54fc6f5022",
"ip_version": "ipv4",
"ipv6_suffix": ""
}
@@ -22,10 +21,9 @@
### Compulsory Parameters
- `"domain"`
- `"host"` is your host and can be a subdomain, `"*"` or `"@"`
- `"apikey"`
- `"secretapikey"`
- `"domain"` is the domain to update. It can be `example.com` (root domain), `sub.example.com` (subdomain of `example.com`) or `*.example.com` for the wildcard.
- `"api_key"`
- `"secret_api_key"`
- `"ttl"` optional integer value corresponding to a number of seconds
### Optional parameters
@@ -43,5 +41,12 @@
## Record creation
In case you don't have an A or AAAA record for your host and domain combination, it will be created by DDNS-Updater.
However, to do so, the corresponding ALIAS record, that is automatically created by Porkbun, is automatically deleted to allow this.
Porkbun creates default DNS entries for new domains, which can conflict with creating a root or wildcard A/AAAA record. Therefore, ddns-updater automatically removes any conflicting default record before creating records, as described in the table below:
| Record type | Owner | Record value | Situation requiring a removal |
| --- | --- | --- | --- |
| `ALIAS` | `@` | pixie.porkbun.com | Creating A or AAAA record for the root domain **or** wildcard domain |
| `CNAME` | `*` | pixie.porkbun.com | Creating A or AAAA record for the wildcard domain |
More details is in [this comment by @everydaycombat](https://github.com/qdm12/ddns-updater/issues/546#issuecomment-1773960193).

View File

@@ -10,7 +10,6 @@
{
"provider": "route53",
"domain": "domain.com",
"host": "@",
"ip_version": "ipv4",
"ipv6_suffix": "",
"access_key": "ffffffffffffffffffff",
@@ -24,8 +23,7 @@
### Compulsory parameters
- `"domain"`
- `"host"` is your host and can be a subdomain or `"@"` or the wildcard `"*"`
- `"domain"` is the domain to update. It can be `example.com` (root domain), `sub.example.com` (subdomain of `example.com`) or `*.example.com` for the wildcard.
- `"access_key"` is the `AWS_ACCESS_KEY`
- `"secret_key"` is the `AWS_SECRET_ACCESS_KEY`
- `"zone_id"` is identification of your hosted zone

View File

@@ -10,10 +10,8 @@
{
"provider": "selfhost.de",
"domain": "domain.com",
"host": "@",
"username": "username",
"password": "password",
"provider_ip": true,
"ip_version": "ipv4",
"ipv6_suffix": ""
}
@@ -23,8 +21,7 @@
### Compulsory parameters
- `"domain"`
- `"host"` is your host and can be a subdomain or `"@"`
- `"domain"` is the domain to update. It can be `example.com` (root domain) or `sub.example.com` (subdomain of `example.com`).
- `"username"` is your DynDNS username
- `"password"` is your DynDNS password
@@ -32,6 +29,5 @@
- `"ip_version"` can be `ipv4` (A records), or `ipv6` (AAAA records) or `ipv4 or ipv6` (update one of the two, depending on the public ip found). It defaults to `ipv4 or ipv6`.
- `"ipv6_suffix"` is the IPv6 interface identifier suffix to use. It can be for example `0:0:0:0:72ad:8fbb:a54e:bedd/64`. If left empty, it defaults to no suffix and the raw public IPv6 address obtained is used in the record updating.
- `"provider_ip"` can be set to `true` to let your DNS provider determine your IPv4 address (and/or IPv6 address) automatically when you send an update request, without sending the new IP address detected by the program in the request.
## Domain setup

View File

@@ -10,11 +10,9 @@
{
"provider": "servercow",
"domain": "domain.com",
"host": "",
"username": "servercow_username",
"password": "servercow_password",
"ttl": 600,
"provider_ip": true,
"ip_version": "ipv4",
"ipv6_suffix": ""
}
@@ -24,8 +22,7 @@
### Compulsory parameters
- `"domain"`
- `"host"` is your host and can be `""`, a subdomain or `"*"` generally
- `"domain"` is the domain to update. It can be `example.com` (root domain), `sub.example.com` (subdomain of `example.com`) or `*.example.com` for the wildcard.
- `"username"` is the username for your DNS API User
- `"password"` is the password for your DNS API User
@@ -34,7 +31,6 @@
- `"ttl"` can be set to an integer value for record TTL in seconds (if not set the default is 120)
- `"ip_version"` can be `ipv4` (A records), or `ipv6` (AAAA records) or `ipv4 or ipv6` (update one of the two, depending on the public ip found). It defaults to `ipv4 or ipv6`.
- `"ipv6_suffix"` is the IPv6 interface identifier suffix to use. It can be for example `0:0:0:0:72ad:8fbb:a54e:bedd/64`. If left empty, it defaults to no suffix and the raw public IPv6 address obtained is used in the record updating.
- `"provider_ip"` can be set to `true` to let your DNS provider determine your IPv4 address (and/or IPv6 address) automatically when you send an update request, without sending the new IP address detected by the program in the request.
## Domain setup

View File

@@ -10,13 +10,11 @@
{
"provider": "spdyn",
"domain": "domain.com",
"host": "@",
"user": "user",
"password": "password",
"token": "token",
"ip_version": "ipv4",
"ipv6_suffix": "",
"provider_ip": true
"ipv6_suffix": ""
}
]
}
@@ -24,8 +22,7 @@
### Compulsory parameters
- `"domain"`
- `"host"` is your host and can be a subdomain or `"@"`
- `"domain"` is the domain to update. It can be `example.com` (root domain) or `sub.example.com` (subdomain of `example.com`).
#### Using user and password
@@ -40,4 +37,3 @@
- `"ip_version"` can be `ipv4` (A records), or `ipv6` (AAAA records) or `ipv4 or ipv6` (update one of the two, depending on the public ip found). It defaults to `ipv4 or ipv6`.
- `"ipv6_suffix"` is the IPv6 interface identifier suffix to use. It can be for example `0:0:0:0:72ad:8fbb:a54e:bedd/64`. If left empty, it defaults to no suffix and the raw public IPv6 address obtained is used in the record updating.
- `"provider_ip"` can be set to `true` to let your DNS provider determine your IPv4 address (**not IPv6**)automatically when you send an update request, without sending the new IP address detected by the program in the request.

View File

@@ -10,11 +10,9 @@
{
"provider": "strato",
"domain": "domain.com",
"host": "@",
"password": "password",
"ip_version": "ipv4",
"ipv6_suffix": "",
"provider_ip": true
"ipv6_suffix": ""
}
]
}
@@ -22,15 +20,13 @@
### Compulsory parameters
- `"domain"`
- `"host"` is your host and can be a subdomain or `"@"`
- `"domain"` is the domain to update. It can be `example.com` (root domain) or `sub.example.com` (subdomain of `example.com`).
- `"password"` is your dyndns password
### Optional parameters
- `"ip_version"` can be `ipv4` (A records), or `ipv6` (AAAA records) or `ipv4 or ipv6` (update one of the two, depending on the public ip found). It defaults to `ipv4 or ipv6`.
- `"ipv6_suffix"` is the IPv6 interface identifier suffix to use. It can be for example `0:0:0:0:72ad:8fbb:a54e:bedd/64`. If left empty, it defaults to no suffix and the raw public IPv6 address obtained is used in the record updating.
- `"provider_ip"` can be set to `true` to let your DNS provider determine your IPv4 address (and/or IPv6 address) automatically when you send an update request, without sending the new IP address detected by the program in the request.
## Domain setup

View File

@@ -10,12 +10,10 @@
{
"provider": "variomedia",
"domain": "domain.com",
"host": "@",
"email": "email@domain.com",
"password": "password",
"ip_version": "ipv4",
"ipv6_suffix": "",
"provider_ip": true
"ipv6_suffix": ""
}
]
}
@@ -23,8 +21,7 @@
### Compulsory parameters
- `"domain"`
- `"host"` is your host and can be a subdomain or `"@"`
- `"domain"` is the domain to update. It can be `example.com` (root domain) or `sub.example.com` (subdomain of `example.com`).
- `"email"`
- `"password"` is your DNS settings password, not your account password ⚠️
@@ -32,7 +29,6 @@
- `"ip_version"` can be `ipv4` (A records), or `ipv6` (AAAA records) or `ipv4 or ipv6` (update one of the two, depending on the public ip found). It defaults to `ipv4 or ipv6`.
- `"ipv6_suffix"` is the IPv6 interface identifier suffix to use. It can be for example `0:0:0:0:72ad:8fbb:a54e:bedd/64`. If left empty, it defaults to no suffix and the raw public IPv6 address obtained is used in the record updating.
- `"provider_ip"` can be set to `true` to let your DNS provider determine your IPv4 address (and/or IPv6 address) automatically when you send an update request, without sending the new IP address detected by the program in the request.
## Domain setup

30
docs/vultr.md Normal file
View File

@@ -0,0 +1,30 @@
# Vultr
## Configuration
### Example
```json
{
"settings": [
{
"provider": "vultr",
"domain": "potato.example.com",
"apikey": "AAAAAAAAAAAAAAA",
"ttl": 300,
"ip_version": "ipv4"
}
]
}
```
### Compulsory parameters
- `"domain"` is the domain to update. It can be a root domain (i.e. `example.com`) or a subdomain (i.e. `potato.example.com`) or a wildcard (i.e. `*.example.com`). In case of a wildcard, it only works if there is no existing wildcard records of any record type.
- `"apikey"` is your API key which can be obtained from [my.vultr.com/settings/](https://my.vultr.com/settings/#settingsapi).
### Optional parameters
- `"ip_version"` can be `ipv4` (A records), or `ipv6` (AAAA records) or `ipv4 or ipv6` (update one of the two, depending on the public ip found). It defaults to `ipv4 or ipv6`.
- `"ipv6_suffix"` is the IPv6 interface identifier suffix to use. It can be for example `0:0:0:0:72ad:8fbb:a54e:bedd/64`. If left empty, it defaults to no suffix and the raw public IPv6 address obtained is used in the record updating.
- `"ttl"` is the record TTL which defaults to 900 seconds.

View File

@@ -16,12 +16,10 @@ set the environment variable as `PERIOD=11m` to check your public IP address and
{
"provider": "zoneedit",
"domain": "domain.com",
"host": "@",
"username": "username",
"token": "token",
"ip_version": "ipv4",
"ipv6_suffix": "",
"provider_ip": true
"ipv6_suffix": ""
}
]
}
@@ -29,8 +27,7 @@ set the environment variable as `PERIOD=11m` to check your public IP address and
### Compulsory parameters
- `"domain"`
- `"host"` is your host and can be a subdomain or `"@"` or `"*"`
- `"domain"` is the domain to update. It can be `example.com` (root domain), `sub.example.com` (subdomain of `example.com`) or `*.example.com` for the wildcard.
- `"username"`
- `"token"`
@@ -38,7 +35,6 @@ set the environment variable as `PERIOD=11m` to check your public IP address and
- `"ip_version"` can be `ipv4` (A records), or `ipv6` (AAAA records) or `ipv4 or ipv6` (update one of the two, depending on the public ip found). It defaults to `ipv4 or ipv6`.
- `"ipv6_suffix"` is the IPv6 interface identifier suffix to use. It can be for example `0:0:0:0:72ad:8fbb:a54e:bedd/64`. If left empty, it defaults to no suffix and the raw public IPv6 address obtained is used in the record updating.
- `"provider_ip"` can be set to `true` to let your DNS provider determine your IPv4 address (and/or IPv6 address) automatically when you send an update request, without sending the new IP address detected by the program in the request.
## Domain setup

29
go.mod
View File

@@ -1,22 +1,22 @@
module github.com/qdm12/ddns-updater
go 1.22
go 1.25.0
require (
github.com/breml/rootcerts v0.2.17
github.com/chmike/domain v1.0.1
github.com/breml/rootcerts v0.2.19
github.com/containrrr/shoutrrr v0.8.0
github.com/go-chi/chi/v5 v5.0.12
github.com/go-chi/chi/v5 v5.2.1
github.com/golang/mock v1.6.0
github.com/miekg/dns v1.1.61
github.com/miekg/dns v1.1.70
github.com/qdm12/goservices v0.1.0
github.com/qdm12/gosettings v0.4.1
github.com/qdm12/gosplash v0.1.0
github.com/qdm12/gotree v0.2.0
github.com/qdm12/gosettings v0.4.4
github.com/qdm12/gosplash v0.2.0
github.com/qdm12/gotree v0.3.0
github.com/qdm12/log v0.1.0
github.com/stretchr/testify v1.9.0
golang.org/x/mod v0.18.0
golang.org/x/oauth2 v0.21.0
github.com/stretchr/testify v1.10.0
golang.org/x/mod v0.31.0
golang.org/x/net v0.49.0
golang.org/x/oauth2 v0.28.0
)
require (
@@ -29,10 +29,9 @@ require (
github.com/mattn/go-isatty v0.0.17 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa // indirect
golang.org/x/net v0.26.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/sys v0.21.0 // indirect
golang.org/x/tools v0.22.0 // indirect
golang.org/x/sync v0.19.0 // indirect
golang.org/x/sys v0.40.0 // indirect
golang.org/x/tools v0.40.0 // indirect
google.golang.org/protobuf v1.34.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
kernel.org/pub/linux/libs/security/libcap/cap v1.2.69 // indirect

62
go.sum
View File

@@ -1,18 +1,15 @@
cloud.google.com/go/compute/metadata v0.3.0 h1:Tz+eQXMEqDIKRsmY3cHTL6FVaynIjX2QxYC4trgAKZc=
cloud.google.com/go/compute/metadata v0.3.0/go.mod h1:zFmK7XCadkQkj6TtorcaGlCW1hT1fIilQDwofLpJ20k=
github.com/breml/rootcerts v0.2.17 h1:0/M2BE2Apw0qEJCXDOkaiu7d5Sx5ObNfe1BkImJ4u1I=
github.com/breml/rootcerts v0.2.17/go.mod h1:S/PKh+4d1HUn4HQovEB8hPJZO6pUZYrIhmXBhsegfXw=
github.com/chmike/domain v1.0.1 h1:ug6h3a7LLAfAecBAysbCXWxP1Jo8iBKWNVDxcs1BNzA=
github.com/chmike/domain v1.0.1/go.mod h1:h558M2qGKpYRUxHHNyey6puvXkZBjvjmseOla/d1VGQ=
github.com/breml/rootcerts v0.2.19 h1:3D/qwAC1xoh82GmZ21mYzQ1NaLOICUVntIo+MRZYr4U=
github.com/breml/rootcerts v0.2.19/go.mod h1:S/PKh+4d1HUn4HQovEB8hPJZO6pUZYrIhmXBhsegfXw=
github.com/containrrr/shoutrrr v0.8.0 h1:mfG2ATzIS7NR2Ec6XL+xyoHzN97H8WPjir8aYzJUSec=
github.com/containrrr/shoutrrr v0.8.0/go.mod h1:ioyQAyu1LJY6sILuNyKaQaw+9Ttik5QePU8atnAdO2o=
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/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs=
github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw=
github.com/go-chi/chi/v5 v5.0.12 h1:9euLV5sTrTNTRUU9POmDUvfxyj6LAABLUcEWO+JJb4s=
github.com/go-chi/chi/v5 v5.0.12/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8=
github.com/go-chi/chi/v5 v5.2.1 h1:KOIHODQj58PmL80G2Eak4WdvUzjSJSm0vG72crDCqb8=
github.com/go-chi/chi/v5 v5.2.1/go.mod h1:L2yAIGWB3H+phAw1NxKwWM+7eUH/lU8pOMm5hHcoops=
github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ=
github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI=
@@ -32,8 +29,8 @@ github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovk
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng=
github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/miekg/dns v1.1.61 h1:nLxbwF3XxhwVSm8g9Dghm9MHPaUZuqhPiGL+675ZmEs=
github.com/miekg/dns v1.1.61/go.mod h1:mnAarhS3nWaW+NVP2wTkYVIZyHNJ098SJZUki3eykwQ=
github.com/miekg/dns v1.1.70 h1:DZ4u2AV35VJxdD9Fo9fIWm119BsQL5cZU1cQ9s0LkqA=
github.com/miekg/dns v1.1.70/go.mod h1:+EuEPhdHOsfk6Wk5TT2CzssZdqkmFhf8r+aVyDEToIs=
github.com/onsi/ginkgo/v2 v2.9.2 h1:BA2GMJOtfGAfagzYtrAlufIP0lq6QERkFmHLMLPwFSU=
github.com/onsi/ginkgo/v2 v2.9.2/go.mod h1:WHcJJG2dIlcCqVfBAwUCrJxSPFb6v4azBwgxeMeDuts=
github.com/onsi/gomega v1.27.6 h1:ENqfyGeS5AX/rlXDd/ETokDz93u0YufY1Pgxuy/PvWE=
@@ -42,55 +39,53 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/qdm12/goservices v0.1.0 h1:9sODefm/yuIGS7ynCkEnNlMTAYn9GzPhtcK4F69JWvc=
github.com/qdm12/goservices v0.1.0/go.mod h1:/JOFsAnHFiSjyoXxa5FlfX903h20K5u/3rLzCjYVMck=
github.com/qdm12/gosettings v0.4.1 h1:c7+14jO1Y2kFXBCUfS2+QE2NgwTKfzcdJzGEFRItCI8=
github.com/qdm12/gosettings v0.4.1/go.mod h1:uItKwGXibJp2pQ0am6MBKilpjfvYTGiH+zXHd10jFj8=
github.com/qdm12/gosplash v0.1.0 h1:Sfl+zIjFZFP7b0iqf2l5UkmEY97XBnaKkH3FNY6Gf7g=
github.com/qdm12/gosplash v0.1.0/go.mod h1:+A3fWW4/rUeDXhY3ieBzwghKdnIPFJgD8K3qQkenJlw=
github.com/qdm12/gotree v0.2.0 h1:+58ltxkNLUyHtATFereAcOjBVfY6ETqRex8XK90Fb/c=
github.com/qdm12/gotree v0.2.0/go.mod h1:1SdFaqKZuI46U1apbXIf25pDMNnrPuYLEqMF/qL4lY4=
github.com/qdm12/gosettings v0.4.4 h1:SM6tOZDf6k8qbjWU8KWyBF4mWIixfsKCfh9DGRLHlj4=
github.com/qdm12/gosettings v0.4.4/go.mod h1:CPrt2YC4UsURTrslmhxocVhMCW03lIrqdH2hzIf5prg=
github.com/qdm12/gosplash v0.2.0 h1:DOxCEizbW6ZG+FgpH2oK1atT6bM8MHL9GZ2ywSS4zZY=
github.com/qdm12/gosplash v0.2.0/go.mod h1:k+1PzhO0th9cpX4q2Nneu4xTsndXqrM/x7NTIYmJ4jo=
github.com/qdm12/gotree v0.3.0 h1:Q9f4C571EFK7ZEsPkEL2oGZX7I+ZhVxhh1ZSydW+5yI=
github.com/qdm12/gotree v0.3.0/go.mod h1:iz06uXmRR4Aq9v6tX7mosXStO/yGHxRA1hbyD0UVeYw=
github.com/qdm12/log v0.1.0 h1:jYBd/xscHYpblzZAd2kjZp2YmuYHjAAfbTViJWxoPTw=
github.com/qdm12/log v0.1.0/go.mod h1:Vchi5M8uBvHfPNIblN4mjXn/oSbiWguQIbsgF1zdQPI=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
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/exp v0.0.0-20231110203233-9a3e6036ecaa h1:FRnLl4eNAQl8hwxVVC17teOw8kdjVDVAiFMtgUdTSRQ=
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa/go.mod h1:zk2irFbV9DP96SEBUUAy67IdHUaZuSnrz1n472HUCLE=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.18.0 h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0=
golang.org/x/mod v0.18.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/mod v0.31.0 h1:HaW9xtz0+kOcWKwli0ZXy79Ix+UW/vOfmWI5QVd2tgI=
golang.org/x/mod v0.31.0/go.mod h1:43JraMp9cGx1Rx3AqioxrbrhNsLl2l/iNAvuBkrezpg=
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-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ=
golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE=
golang.org/x/oauth2 v0.21.0 h1:tsimM75w1tF/uws5rbeHzIWxEqElMehnc+iW793zsZs=
golang.org/x/oauth2 v0.21.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
golang.org/x/net v0.49.0 h1:eeHFmOGUTtaaPSGNmjBKpbng9MulQsJURQUAfUwY++o=
golang.org/x/net v0.49.0/go.mod h1:/ysNB2EvaqvesRkuLAyjI1ycPZlQHM3q01F02UY/MV8=
golang.org/x/oauth2 v0.28.0 h1:CrgCKl8PPAVtLnU3c+EDw6x11699EWlsDeWNWKdIOkc=
golang.org/x/oauth2 v0.28.0/go.mod h1:onh5ek6nERTohokkhCD/y2cV4Do3fxFHFuAejCkRWT8=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.19.0 h1:vV+1eWNmZ5geRlYjzm2adRgW2/mcpevXNg50YZtPCE4=
golang.org/x/sync v0.19.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
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-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.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws=
golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.40.0 h1:DBZZqJ2Rkml6QMQsZywtnjnnGvHza6BTfYFWY9kjEWQ=
golang.org/x/sys v0.40.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
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.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4=
golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI=
golang.org/x/text v0.33.0 h1:B3njUFyqtHDUI5jMn1YIr5B0IE2U0qck04r6d4KPAxE=
golang.org/x/text v0.33.0/go.mod h1:LuMebE6+rBincTi9+xWTY8TztLzKHc/9C1uBCG27+q8=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.22.0 h1:gqSGLZqv+AI9lIQzniJ0nZDRG5GBPsSi+DRNHWNz6yA=
golang.org/x/tools v0.22.0/go.mod h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c=
golang.org/x/tools v0.40.0 h1:yLkxfA+Qnul4cs9QA3KnlFu0lVmd8JJfoq+E41uSutA=
golang.org/x/tools v0.40.0/go.mod h1:Ik/tzLRlbscWpqqMRjyWYDisX8bG13FrdXp3o4Sr9lc=
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-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
@@ -98,7 +93,6 @@ google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFW
google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/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=
kernel.org/pub/linux/libs/security/libcap/cap v1.2.69 h1:N0m3tKYbkRMmDobh/47ngz+AWeV7PcfXMDi8xu3Vrag=

View File

@@ -20,7 +20,8 @@ type Service struct {
}
func New(backupPeriod time.Duration,
dataDir, outputDir string, logger Logger) *Service {
dataDir, outputDir string, logger Logger,
) *Service {
return &Service{
logger: logger,
backupPeriod: backupPeriod,
@@ -56,7 +57,8 @@ func (s *Service) Start(ctx context.Context) (runError <-chan error, startErr er
func run(ready chan<- struct{}, runError chan<- error, stopCh <-chan struct{},
done chan<- struct{}, outputDir, dataDir string, backupPeriod time.Duration,
logger Logger) {
logger Logger,
) {
defer close(done)
if backupPeriod == 0 {

View File

@@ -12,21 +12,26 @@ import (
)
type Health struct {
// ServerAddress is the listening address:port of the
// health server, which defaults to the empty string,
// meaning the server will not run.
ServerAddress *string
HealthchecksioBaseURL string
HealthchecksioUUID *string
}
func (h *Health) SetDefaults() {
h.ServerAddress = gosettings.DefaultPointer(h.ServerAddress, "127.0.0.1:9999")
h.ServerAddress = gosettings.DefaultPointer(h.ServerAddress, "")
h.HealthchecksioBaseURL = gosettings.DefaultComparable(h.HealthchecksioBaseURL, "https://hc-ping.com")
h.HealthchecksioUUID = gosettings.DefaultPointer(h.HealthchecksioUUID, "")
}
func (h Health) Validate() (err error) {
err = validate.ListeningAddress(*h.ServerAddress, os.Getuid())
if err != nil {
return fmt.Errorf("server listening address: %w", err)
if *h.ServerAddress != "" {
err = validate.ListeningAddress(*h.ServerAddress, os.Getuid())
if err != nil {
return fmt.Errorf("server listening address: %w", err)
}
}
_, err = url.Parse(h.HealthchecksioBaseURL)
@@ -43,7 +48,11 @@ func (h Health) String() string {
func (h Health) toLinesNode() *gotree.Node {
node := gotree.New("Health")
node.Appendf("Server listening address: %s", *h.ServerAddress)
if *h.ServerAddress == "" {
node.Appendf("Server is disabled")
} else {
node.Appendf("Server listening address: %s", *h.ServerAddress)
}
if *h.HealthchecksioUUID != "" {
node.Appendf("Healthchecks.io base URL: %s", h.HealthchecksioBaseURL)
node.Appendf("Healthchecks.io UUID: %s", *h.HealthchecksioUUID)

View File

@@ -1,7 +1,10 @@
package config
import (
"fmt"
"io/fs"
"path/filepath"
"strconv"
"github.com/qdm12/gosettings"
"github.com/qdm12/gosettings/reader"
@@ -11,12 +14,17 @@ import (
type Paths struct {
DataDir *string
Config *string
// Umask is the custom umask to use for the system, if different than zero.
// If it is set to zero, the system umask is unchanged.
// It cannot be nil in the internal state.
Umask *fs.FileMode
}
func (p *Paths) setDefaults() {
p.DataDir = gosettings.DefaultPointer(p.DataDir, "./data")
defaultConfig := filepath.Join(*p.DataDir, "config.json")
p.Config = gosettings.DefaultPointer(p.Config, defaultConfig)
p.Umask = gosettings.DefaultPointer(p.Umask, fs.FileMode(0))
}
func (p Paths) Validate() (err error) {
@@ -31,10 +39,35 @@ func (p Paths) toLinesNode() *gotree.Node {
node := gotree.New("Paths")
node.Appendf("Data directory: %s", *p.DataDir)
node.Appendf("Config file: %s", *p.Config)
umaskString := "system default"
if *p.Umask != 0 {
umaskString = p.Umask.String()
}
node.Appendf("Umask: %s", umaskString)
return node
}
func (p *Paths) read(reader *reader.Reader) {
func (p *Paths) read(reader *reader.Reader) (err error) {
p.DataDir = reader.Get("DATADIR")
p.Config = reader.Get("CONFIG_FILEPATH")
umaskString := reader.String("UMASK")
if umaskString != "" {
umask, err := parseUmask(umaskString)
if err != nil {
return fmt.Errorf("parse umask: %w", err)
}
p.Umask = &umask
}
return nil
}
func parseUmask(s string) (umask fs.FileMode, err error) {
const base, bitSize = 8, 32
umaskUint64, err := strconv.ParseUint(s, base, bitSize)
if err != nil {
return 0, err
}
return fs.FileMode(umaskUint64), nil
}

View File

@@ -0,0 +1,46 @@
package config
import (
"io/fs"
"testing"
"github.com/stretchr/testify/assert"
)
func Test_parseUmask(t *testing.T) {
t.Parallel()
testCases := map[string]struct {
s string
umask fs.FileMode
errMessage string
}{
"invalid": {
s: "a",
errMessage: `strconv.ParseUint: parsing "a": invalid syntax`,
},
"704": {
s: "704",
umask: 0o704,
},
"0704": {
s: "0704",
umask: 0o0704,
},
}
for name, testCase := range testCases {
t.Run(name, func(t *testing.T) {
t.Parallel()
umask, err := parseUmask(testCase.s)
if testCase.errMessage != "" {
assert.EqualError(t, err, testCase.errMessage)
} else {
assert.NoError(t, err)
}
assert.Equal(t, testCase.umask, umask)
})
}
}

View File

@@ -70,28 +70,28 @@ func (p *PubIP) toLinesNode() (node *gotree.Node) {
node.Appendf("HTTP enabled: %s", gosettings.BoolToYesNo(p.HTTPEnabled))
if *p.HTTPEnabled {
childNode := node.Appendf("HTTP IP providers")
childNode := node.Append("HTTP IP providers")
for _, provider := range p.HTTPIPProviders {
childNode.Appendf(provider)
childNode.Append(provider)
}
childNode = node.Appendf("HTTP IPv4 providers")
childNode = node.Append("HTTP IPv4 providers")
for _, provider := range p.HTTPIPv4Providers {
childNode.Appendf(provider)
childNode.Append(provider)
}
childNode = node.Appendf("HTTP IPv6 providers")
childNode = node.Append("HTTP IPv6 providers")
for _, provider := range p.HTTPIPv6Providers {
childNode.Appendf(provider)
childNode.Append(provider)
}
}
node.Appendf("DNS enabled: %s", gosettings.BoolToYesNo(p.DNSEnabled))
if *p.DNSEnabled {
node.Appendf("DNS timeout: %s", p.DNSTimeout)
childNode := node.Appendf("DNS over TLS providers")
childNode := node.Append("DNS over TLS providers")
for _, provider := range p.DNSProviders {
childNode.Appendf(provider)
childNode.Append(provider)
}
}
@@ -111,7 +111,8 @@ func (p *PubIP) ToHTTPOptions() (options []http.Option) {
}
func stringsToHTTPProviders(providers []string, ipVersion ipversion.IPVersion) (
updatedProviders []http.Provider) {
updatedProviders []http.Provider,
) {
updatedProvidersSet := make(map[string]struct{}, len(providers))
for _, provider := range providers {
if provider != all {
@@ -158,9 +159,7 @@ func (p *PubIP) ToDNSPOptions() (options []dns.Option) {
}
}
var (
ErrNoPublicIPDNSProvider = errors.New("no public IP DNS provider specified")
)
var ErrNoPublicIPDNSProvider = errors.New("no public IP DNS provider specified")
func (p PubIP) validateDNSProviders() (err error) {
if len(p.DNSProviders) == 0 {
@@ -194,7 +193,8 @@ var (
)
func validateHTTPIPProviders(providerStrings []string,
version ipversion.IPVersion) (err error) {
version ipversion.IPVersion,
) (err error) {
if len(providerStrings) == 0 {
return fmt.Errorf("%w", ErrNoPublicIPHTTPProvider)
}
@@ -263,7 +263,12 @@ func (p *PubIP) read(r *reader.Reader, warner Warner) (err error) {
copy(httpIPProvidersTemp, p.HTTPIPProviders)
p.HTTPIPProviders = make([]string, 0, len(p.HTTPIPProviders))
for _, provider := range httpIPProvidersTemp {
if provider != "opendns" {
switch provider {
case "opendns": // no longer available, for a long time
case "google": // found no longer working on 2024.09.17
warner.Warnf("http provider google will be ignored " +
"since it is no longer supported by Google")
default:
p.HTTPIPProviders = append(p.HTTPIPProviders, provider)
}
}

View File

@@ -80,7 +80,8 @@ func (c Config) toLinesNode() *gotree.Node {
}
func (c *Config) Read(reader *reader.Reader,
warner Warner) (err error) {
warner Warner,
) (err error) {
err = c.Client.read(reader)
if err != nil {
return fmt.Errorf("reading client settings: %w", err)
@@ -107,7 +108,10 @@ func (c *Config) Read(reader *reader.Reader,
}
c.Health.Read(reader)
c.Paths.read(reader)
err = c.Paths.read(reader)
if err != nil {
return fmt.Errorf("reading paths settings: %w", err)
}
err = c.Backup.read(reader)
if err != nil {

View File

@@ -1,6 +1,7 @@
package config
import (
"path/filepath"
"testing"
"github.com/stretchr/testify/assert"
@@ -14,7 +15,7 @@ func Test_Settings_String(t *testing.T) {
s := defaultSettings.String()
const expected = `Settings summary:
expected := `Settings summary:
├── HTTP client
| └── Timeout: 20s
├── Update
@@ -37,10 +38,11 @@ func Test_Settings_String(t *testing.T) {
| ├── Listening address: :8000
| └── Root URL: /
├── Health
| └── Server listening address: 127.0.0.1:9999
| └── Server is disabled
├── Paths
| ├── Data directory: ./data
| ── Config file: data/config.json
| ── Config file: ` + filepath.Join("data", "config.json") + `
| └── Umask: system default
├── Backup: disabled
└── Logger
├── Level: INFO

View File

@@ -43,7 +43,7 @@ func (s Shoutrrr) ToLinesNode() *gotree.Node {
childNode := node.Appendf("Addresses")
for _, address := range s.Addresses {
childNode.Appendf(address)
childNode.Append(address)
}
return node

View File

@@ -7,5 +7,5 @@ import (
type PersistentDatabase interface {
Close() error
StoreNewIP(domain, host string, ip netip.Addr, t time.Time) (err error)
StoreNewIP(domain, owner string, ip netip.Addr, t time.Time) (err error)
}

View File

@@ -12,7 +12,7 @@ var ErrRecordNotFound = errors.New("record not found")
func (db *Database) Select(id uint) (record records.Record, err error) {
db.RLock()
defer db.RUnlock()
if int(id) > len(db.data)-1 {
if id > uint(len(db.data))-1 {
return record, fmt.Errorf("%w: for id %d", ErrRecordNotFound, id)
}
return db.data[id], nil

View File

@@ -9,7 +9,7 @@ import (
func (db *Database) Update(id uint, record records.Record) (err error) {
db.Lock()
defer db.Unlock()
if int(id) > len(db.data)-1 {
if id > uint(len(db.data))-1 {
return fmt.Errorf("%w: for id %d", ErrRecordNotFound, id)
}
currentCount := len(db.data[id].History)
@@ -19,7 +19,7 @@ func (db *Database) Update(id uint, record records.Record) (err error) {
if newCount > currentCount {
if err := db.persistentDB.StoreNewIP(
record.Provider.Domain(),
record.Provider.Host(),
record.Provider.Owner(),
record.History.GetCurrentIP(),
record.History.GetSuccessTime(),
); err != nil {

View File

@@ -7,9 +7,7 @@ import (
"net/http"
)
var (
ErrHTTPStatusCodeNotOK = errors.New("status code is not OK")
)
var ErrHTTPStatusCodeNotOK = errors.New("status code is not OK")
func CheckHTTP(ctx context.Context, client *http.Client) (err error) {
const url = "https://github.com"

View File

@@ -1,8 +0,0 @@
package health
import "os"
func IsDocker() (ok bool) {
_, err := os.Stat("isdocker")
return err == nil
}

View File

@@ -7,7 +7,8 @@ import (
)
func NewServer(address string, logger Logger, healthcheck func(context.Context) error) (
server *httpserver.Server, err error) {
server *httpserver.Server, err error,
) {
name := "health"
return httpserver.New(httpserver.Settings{
Handler: newHandler(healthcheck),

View File

@@ -23,9 +23,7 @@ type Client struct {
uuid string
}
var (
ErrStatusCode = errors.New("bad status code")
)
var ErrStatusCode = errors.New("bad status code")
type State string

View File

@@ -3,7 +3,7 @@ package models
type BuildInformation struct {
Version string `json:"version"`
Commit string `json:"commit"`
Date string `json:"buildDate"`
Created string `json:"buildDate"`
}
func (b BuildInformation) VersionString() string {

View File

@@ -23,7 +23,7 @@ func (h History) GetPreviousIPs() (previousIPs []netip.Addr) {
return nil
}
previousIPs = make([]netip.Addr, len(h)-1)
mostRecentPreviousIPIndex := len(h) - 2 //nolint:gomnd
mostRecentPreviousIPIndex := len(h) - 2 //nolint:mnd
for i := range previousIPs {
previousIPs[i] = h[mostRecentPreviousIPIndex-i].IP
}

View File

@@ -44,7 +44,6 @@ func Test_GetPreviousIPs(t *testing.T) {
},
}
for name, testCase := range testCases {
testCase := testCase
t.Run(name, func(t *testing.T) {
t.Parallel()
previousIPs := testCase.h.GetPreviousIPs()
@@ -73,7 +72,6 @@ func Test_GetDurationSinceSuccess(t *testing.T) {
},
}
for name, tc := range tests {
tc := tc
t.Run(name, func(t *testing.T) {
t.Parallel()
now, _ := time.Parse("2006-01-02", "2000-01-01")

View File

@@ -10,7 +10,7 @@ type HTMLData struct {
// It is exported so that the HTML template engine can render it.
type HTMLRow struct {
Domain string
Host string
Owner string
Provider string
IPVersion string
Status string

View File

@@ -1,6 +0,0 @@
package models
type DomainHost struct {
Domain string
Host string
}

View File

@@ -10,29 +10,34 @@ import (
"os"
"strings"
"github.com/chmike/domain"
"github.com/qdm12/ddns-updater/internal/models"
"github.com/qdm12/ddns-updater/internal/provider"
"github.com/qdm12/ddns-updater/internal/provider/constants"
"github.com/qdm12/ddns-updater/internal/provider/utils"
"github.com/qdm12/ddns-updater/pkg/publicip/ipversion"
"golang.org/x/net/publicsuffix"
)
type commonSettings struct {
Provider string `json:"provider"`
Domain string `json:"domain"`
Host string `json:"host"`
Provider string `json:"provider"`
Domain string `json:"domain"`
// Host is kept for retro-compatibility and is replaced by Owner.
Host string `json:"host,omitempty"`
// Owner is kept for retro-compatibility and is determined from the
// Domain field.
Owner string `json:"owner,omitempty"`
IPVersion string `json:"ip_version"`
IPv6Suffix netip.Prefix `json:"ipv6_suffix,omitempty"`
// Retro values for warnings
IPMethod *string `json:"ip_method,omitempty"`
Delay *uint64 `json:"delay,omitempty"`
ProviderIP *bool `json:"provider_ip,omitempty"`
}
// JSONProviders obtain the update settings from the JSON content,
// first trying from the environment variable CONFIG and then from
// the file config.json.
func (r *Reader) JSONProviders(filePath string) (
providers []provider.Provider, warnings []string, err error) {
providers []provider.Provider, warnings []string, err error,
) {
providers, warnings, err = r.getProvidersFromEnv(filePath)
if providers != nil || warnings != nil || err != nil {
return providers, warnings, err
@@ -44,7 +49,8 @@ var errWriteConfigToFile = errors.New("cannot write configuration to file")
// getProvidersFromFile obtain the update settings from config.json.
func (r *Reader) getProvidersFromFile(filePath string) (
providers []provider.Provider, warnings []string, err error) {
providers []provider.Provider, warnings []string, err error,
) {
r.logger.Info("reading JSON config from file " + filePath)
bytes, err := r.readFile(filePath)
if err != nil {
@@ -54,9 +60,8 @@ func (r *Reader) getProvidersFromFile(filePath string) (
r.logger.Info("file not found, creating an empty settings file")
const mode = fs.FileMode(0600)
err = r.writeFile(filePath, []byte(`{}`), mode)
const filePerm = fs.FileMode(0o666)
err = r.writeFile(filePath, []byte(`{}`), filePerm)
if err != nil {
err = fmt.Errorf("%w: %w", errWriteConfigToFile, err)
}
@@ -70,7 +75,8 @@ func (r *Reader) getProvidersFromFile(filePath string) (
// getProvidersFromEnv obtain the update settings from the environment variable CONFIG.
// If the settings are valid, they are written to the filePath.
func (r *Reader) getProvidersFromEnv(filePath string) (
providers []provider.Provider, warnings []string, err error) {
providers []provider.Provider, warnings []string, err error,
) {
s := os.Getenv("CONFIG")
if s == "" {
return nil, nil, nil
@@ -90,8 +96,8 @@ func (r *Reader) getProvidersFromEnv(filePath string) (
if err != nil {
return providers, warnings, fmt.Errorf("%w: %w", errWriteConfigToFile, err)
}
const mode = fs.FileMode(0600)
err = r.writeFile(filePath, buffer.Bytes(), mode)
const filePerm = fs.FileMode(0o666)
err = r.writeFile(filePath, buffer.Bytes(), filePerm)
if err != nil {
return providers, warnings, fmt.Errorf("%w: %w", errWriteConfigToFile, err)
}
@@ -105,7 +111,8 @@ var (
)
func extractAllSettings(jsonBytes []byte) (
allProviders []provider.Provider, warnings []string, err error) {
allProviders []provider.Provider, warnings []string, err error,
) {
config := struct {
CommonSettings []commonSettings `json:"settings"`
}{}
@@ -141,43 +148,44 @@ func extractAllSettings(jsonBytes []byte) (
var (
ErrProviderNoLongerSupported = errors.New("provider no longer supported")
ErrDomainBlank = errors.New("domain cannot be blank for provider")
ErrProviderMultipleDomains = errors.New("provider does not support multiple domains")
)
func makeSettingsFromObject(common commonSettings, rawSettings json.RawMessage,
retroGlobalIPv6Suffix netip.Prefix) (
providers []provider.Provider, warnings []string, err error) {
providers []provider.Provider, warnings []string, err error,
) {
if common.Provider == "google" {
return nil, nil, fmt.Errorf("%w: %s", ErrProviderNoLongerSupported, common.Provider)
}
if common.Domain == "" && (common.Provider != "duckdns" && common.Provider != "goip") {
return nil, nil, fmt.Errorf("%w: for provider %s", ErrDomainBlank, common.Provider)
if common.Owner == "" { // retro compatibility
common.Owner = common.Host
}
if common.Domain != "" {
err = domain.Check(common.Domain)
var domain string
var owners []string
if common.Owner != "" { // retro compatibility
owners = strings.Split(common.Owner, ",")
domain = common.Domain // single domain only
domains := make([]string, len(owners))
for i, owner := range owners {
domains[i] = utils.BuildURLQueryHostname(owner, common.Domain)
}
warnings = append(warnings,
fmt.Sprintf("you can specify the owner %q directly in the domain field as %q",
common.Owner, strings.Join(domains, ",")))
} else { // extract owner(s) from domain(s)
domain, owners, err = extractFromDomainField(common.Domain)
if err != nil {
return nil, nil, fmt.Errorf("validating domain: %w", err)
return nil, nil, fmt.Errorf("extracting owners from domains: %w", err)
}
}
providerName := models.Provider(common.Provider)
if providerName == constants.DuckDNS { // only hosts, no domain
if common.Domain != "" { // retro compatibility
if common.Host == "" {
common.Host = strings.TrimSuffix(common.Domain, ".duckdns.org")
warnings = append(warnings,
fmt.Sprintf("DuckDNS record should have %q specified as host instead of %q as domain",
common.Host, common.Domain))
} else {
warnings = append(warnings,
fmt.Sprintf("ignoring domain %q because host %q is specified for DuckDNS record",
common.Domain, common.Host))
}
}
if common.Provider == string(constants.Myaddr) && len(owners) > 1 {
return nil, nil, fmt.Errorf("%w: %s for parent domain %q",
ErrProviderMultipleDomains, common.Provider, domain)
}
hosts := strings.Split(common.Host, ",")
if common.IPVersion == "" {
common.IPVersion = ipversion.IP4or6.String()
@@ -198,14 +206,49 @@ func makeSettingsFromObject(common commonSettings, rawSettings json.RawMessage,
ipv6Suffix, ipVersion))
}
providers = make([]provider.Provider, len(hosts))
for i, host := range hosts {
host = strings.TrimSpace(host)
providers[i], err = provider.New(providerName, rawSettings, common.Domain,
host, ipVersion, ipv6Suffix)
if common.ProviderIP != nil {
warning := fmt.Sprintf("for domain %s and ip version %s: "+
`the field "provider_ip" is deprecated and no longer used`,
domain, ipVersion)
warnings = append(warnings, warning)
}
providerName := models.Provider(common.Provider)
providers = make([]provider.Provider, len(owners))
for i, owner := range owners {
owner = strings.TrimSpace(owner)
providers[i], err = provider.New(providerName, rawSettings, domain,
owner, ipVersion, ipv6Suffix)
if err != nil {
return nil, warnings, err
}
}
return providers, warnings, nil
}
var ErrMultipleDomainsSpecified = errors.New("multiple domains specified")
func extractFromDomainField(domainField string) (domainRegistered string,
owners []string, err error,
) {
domains := strings.Split(domainField, ",")
owners = make([]string, len(domains))
for i, domain := range domains {
newDomainRegistered, err := publicsuffix.EffectiveTLDPlusOne(domain)
switch {
case err != nil:
return "", nil, fmt.Errorf("extracting effective TLD+1: %w", err)
case domainRegistered == "":
domainRegistered = newDomainRegistered
case domainRegistered != newDomainRegistered:
return "", nil, fmt.Errorf("%w: %q and %q",
ErrMultipleDomainsSpecified, domainRegistered, newDomainRegistered)
}
if domain == domainRegistered {
owners[i] = "@"
continue
}
owners[i] = strings.TrimSuffix(domain, "."+domainRegistered)
}
return domainRegistered, owners, nil
}

View File

@@ -0,0 +1,75 @@
package params
import (
"testing"
"github.com/stretchr/testify/assert"
)
func Test_extractFromDomainField(t *testing.T) {
t.Parallel()
testCases := map[string]struct {
domainField string
domainRegistered string
owners []string
errWrapped error
errMessage string
}{
"root_domain": {
domainField: "example.com",
domainRegistered: "example.com",
owners: []string{"@"},
},
"subdomain": {
domainField: "abc.example.com",
domainRegistered: "example.com",
owners: []string{"abc"},
},
"two_dots_tld": {
domainField: "abc.example.co.uk",
domainRegistered: "example.co.uk",
owners: []string{"abc"},
},
"wildcard": {
domainField: "*.example.com",
domainRegistered: "example.com",
owners: []string{"*"},
},
"multiple": {
domainField: "*.example.com,example.com",
domainRegistered: "example.com",
owners: []string{"*", "@"},
},
"different_domains": {
domainField: "*.example.com,abc.something.com",
errWrapped: ErrMultipleDomainsSpecified,
errMessage: "multiple domains specified: \"example.com\" and \"something.com\"",
},
"goip.de": {
domainField: "my.domain.goip.de",
domainRegistered: "domain.goip.de",
owners: []string{"my"},
},
"duckdns.org": {
domainField: "my.domain.duckdns.org",
domainRegistered: "domain.duckdns.org",
owners: []string{"my"},
},
}
for name, testCase := range testCases {
t.Run(name, func(t *testing.T) {
t.Parallel()
domainRegistered, owners, err := extractFromDomainField(testCase.domainField)
assert.ErrorIs(t, err, testCase.errWrapped)
if testCase.errWrapped != nil {
assert.EqualError(t, err, testCase.errMessage)
}
assert.Equal(t, testCase.domainRegistered, domainRegistered)
assert.Equal(t, testCase.owners, owners)
})
}
}

View File

@@ -18,9 +18,7 @@ func getRetroIPv6Suffix() (suffix netip.Prefix, err error) {
return makeIPv6Suffix(prefixBitsString)
}
var (
ErrIPv6PrefixFormat = errors.New("IPv6 prefix format is incorrect")
)
var ErrIPv6PrefixFormat = errors.New("IPv6 prefix format is incorrect")
func makeIPv6Suffix(prefixBitsString string) (suffix netip.Prefix, err error) {
prefixBitsString = strings.TrimPrefix(prefixBitsString, "/")

View File

@@ -46,7 +46,6 @@ func Test_makeIPv6Suffix(t *testing.T) {
}
for name, testCase := range testCases {
testCase := testCase
t.Run(name, func(t *testing.T) {
t.Parallel()

View File

@@ -4,7 +4,6 @@ import (
"encoding/json"
"errors"
"fmt"
"io/fs"
"os"
"path/filepath"
"sync"
@@ -16,12 +15,12 @@ import (
type Database struct {
data dataModel
filepath string
sync.RWMutex
mutex sync.RWMutex
}
func (db *Database) Close() error {
db.Lock() // ensure a write operation finishes
defer db.Unlock()
db.mutex.Lock() // ensure a write operation finishes
defer db.mutex.Unlock()
return nil
}
@@ -34,8 +33,8 @@ func NewDatabase(dataDir string) (*Database, error) {
if !errors.Is(err, os.ErrNotExist) {
return nil, fmt.Errorf("reading file: %w", err)
}
const perm fs.FileMode = 0700
err = os.MkdirAll(filepath.Dir(filePath), perm)
const dirPerm = os.FileMode(0o777)
err = os.MkdirAll(filepath.Dir(filePath), dirPerm)
if err != nil {
return nil, fmt.Errorf("creating data directory: %w", err)
}
@@ -64,6 +63,14 @@ func NewDatabase(dataDir string) (*Database, error) {
return nil, fmt.Errorf("closing database file: %w", err)
}
// Migration from older database using "host" instead of "owner".
for i := range data.Records {
if data.Records[i].Owner == "" {
data.Records[i].Owner = data.Records[i].Host
data.Records[i].Host = ""
}
}
err = checkData(data)
if err != nil {
return nil, fmt.Errorf("%s validation error: %w", filePath, err)
@@ -77,7 +84,7 @@ func NewDatabase(dataDir string) (*Database, error) {
var (
ErrDomainEmpty = errors.New("domain is empty")
ErrHostIsEmpty = errors.New("host is empty")
ErrOwnerNotSet = errors.New("owner is not set")
ErrIPRecordsMisordered = errors.New("IP records are not ordered correctly by time")
ErrIPEmpty = errors.New("IP is empty")
ErrIPTimeEmpty = errors.New("time of IP is empty")
@@ -89,16 +96,16 @@ func checkData(data dataModel) (err error) {
case record.Domain == "":
return fmt.Errorf("%w: for record %d of %d", ErrDomainEmpty,
i+1, len(data.Records))
case record.Host == "":
case record.Owner == "":
return fmt.Errorf("%w: for record %d of %d with domain %s",
ErrHostIsEmpty, i+1, len(data.Records), record.Domain)
ErrOwnerNotSet, i+1, len(data.Records), record.Domain)
}
err = checkHistoryEvents(record.Events)
if err != nil {
return fmt.Errorf("for record %d of %d with domain %s and host %s: "+
return fmt.Errorf("for record %d of %d with domain %s and owner %s: "+
"history events: %w", i+1, len(data.Records),
record.Domain, record.Host, err)
record.Domain, record.Owner, err)
}
}
return nil
@@ -126,8 +133,8 @@ func checkHistoryEvents(events []models.HistoryEvent) (err error) {
}
func (db *Database) write() error {
const createPerms fs.FileMode = 0600
file, err := os.OpenFile(db.filepath, os.O_TRUNC|os.O_CREATE|os.O_WRONLY, createPerms)
const filePerm = os.FileMode(0o666)
file, err := os.OpenFile(db.filepath, os.O_TRUNC|os.O_CREATE|os.O_WRONLY, filePerm)
if err != nil {
return fmt.Errorf("opening file: %w", err)
}

View File

@@ -11,8 +11,10 @@ type dataModel struct {
}
type record struct {
Domain string `json:"domain"`
Host string `json:"host"`
Domain string `json:"domain"`
// Host is kept for retro-compatibility and is replaced by Owner.
Host string `json:"host,omitempty"`
Owner string `json:"owner"`
Events []models.HistoryEvent `json:"ips"`
}

View File

@@ -9,14 +9,14 @@ import (
"github.com/qdm12/ddns-updater/pkg/publicip/ipversion"
)
// StoreNewIP stores a new IP address for a certain domain and host.
func (db *Database) StoreNewIP(domain, host string, ip netip.Addr, t time.Time) (err error) {
db.Lock()
defer db.Unlock()
// StoreNewIP stores a new IP address for a certain domain and owner.
func (db *Database) StoreNewIP(domain, owner string, ip netip.Addr, t time.Time) (err error) {
db.mutex.Lock()
defer db.mutex.Unlock()
targetIndex := -1
for i, record := range db.data.Records {
if record.Domain == domain && record.Host == host {
if record.Domain == domain && record.Owner == owner {
targetIndex = i
break
}
@@ -26,7 +26,7 @@ func (db *Database) StoreNewIP(domain, host string, ip netip.Addr, t time.Time)
if recordNotFound {
db.data.Records = append(db.data.Records, record{
Domain: domain,
Host: host,
Owner: owner,
})
targetIndex = len(db.data.Records) - 1
}
@@ -39,14 +39,15 @@ func (db *Database) StoreNewIP(domain, host string, ip netip.Addr, t time.Time)
return db.write()
}
// GetEvents gets all the IP addresses history for a certain domain, host and
// GetEvents gets all the IP addresses history for a certain domain, owner and
// IP version, in the order from oldest to newest.
func (db *Database) GetEvents(domain, host string,
ipVersion ipversion.IPVersion) (events []models.HistoryEvent, err error) {
db.RLock()
defer db.RUnlock()
func (db *Database) GetEvents(domain, owner string,
ipVersion ipversion.IPVersion,
) (events []models.HistoryEvent, err error) {
db.mutex.RLock()
defer db.mutex.RUnlock()
for _, record := range db.data.Records {
if record.Domain == domain && record.Host == host {
if record.Domain == domain && record.Owner == owner {
return filterEvents(record.Events, ipVersion), nil
}
}

View File

@@ -1,6 +0,0 @@
package constants
const (
A = "A"
AAAA = "AAAA"
)

View File

@@ -15,6 +15,7 @@ const (
DigitalOcean models.Provider = "digitalocean"
DNSOMatic models.Provider = "dnsomatic"
DNSPod models.Provider = "dnspod"
Domeneshop models.Provider = "domeneshop"
DonDominio models.Provider = "dondominio"
Dreamhost models.Provider = "dreamhost"
DuckDNS models.Provider = "duckdns"
@@ -34,9 +35,12 @@ const (
INWX models.Provider = "inwx"
Ionos models.Provider = "ionos"
Linode models.Provider = "linode"
Loopia models.Provider = "loopia"
LuaDNS models.Provider = "luadns"
Myaddr models.Provider = "myaddr"
Namecheap models.Provider = "namecheap"
NameCom models.Provider = "name.com"
NameSilo models.Provider = "namesilo"
Netcup models.Provider = "netcup"
Njalla models.Provider = "njalla"
NoIP models.Provider = "noip"
@@ -50,6 +54,7 @@ const (
Spdyn models.Provider = "spdyn"
Strato models.Provider = "strato"
Variomedia models.Provider = "variomedia"
Vultr models.Provider = "vultr"
Zoneedit models.Provider = "zoneedit"
)
@@ -65,6 +70,7 @@ func ProviderChoices() []models.Provider {
DigitalOcean,
DNSOMatic,
DNSPod,
Domeneshop,
DonDominio,
Dreamhost,
DuckDNS,
@@ -84,9 +90,12 @@ func ProviderChoices() []models.Provider {
INWX,
Ionos,
Linode,
Loopia,
LuaDNS,
Myaddr,
Namecheap,
NameCom,
NameSilo,
Njalla,
NoIP,
NowDNS,
@@ -98,6 +107,7 @@ func ProviderChoices() []models.Provider {
Spdyn,
Strato,
Variomedia,
Vultr,
Zoneedit,
}
}

View File

@@ -0,0 +1,8 @@
package constants
const (
A = "A"
AAAA = "AAAA"
CNAME = "CNAME"
ALIAS = "ALIAS"
)

View File

@@ -7,7 +7,7 @@ var (
ErrAuth = errors.New("bad authentication")
ErrBadRequest = errors.New("bad request sent")
ErrBannedAbuse = errors.New("banned due to abuse")
ErrBannedUserAgent = errors.New("user agend is banned")
ErrBannedUserAgent = errors.New("user agent is banned")
ErrConflictingRecord = errors.New("conflicting record")
ErrDNSServerSide = errors.New("server side DNS error")
ErrDomainDisabled = errors.New("record disabled")

View File

@@ -18,14 +18,9 @@ var (
ErrEmailNotValid = errors.New("email address is not valid")
ErrGCPProjectNotSet = errors.New("GCP project is not set")
ErrDomainNotValid = errors.New("domain is not valid")
ErrHostNotSet = errors.New("host is not set")
ErrHostOnlySubdomain = errors.New("host can only be a subdomain")
ErrHostWildcard = errors.New(`host cannot be a "*"`)
ErrIPv4KeyNotSet = errors.New("IPv4 key is not set")
ErrIPv6KeyNotSet = errors.New("IPv6 key is not set")
ErrOwnerWildcard = errors.New(`owner cannot be "*"`)
ErrKeyNotSet = errors.New("key is not set")
ErrKeyNotValid = errors.New("key is not valid")
ErrNameNotSet = errors.New("name is not set")
ErrPasswordNotSet = errors.New("password is not set")
ErrPasswordNotValid = errors.New("password is not valid")
ErrSecretKeyNotSet = errors.New("secret key is not set")
@@ -35,6 +30,7 @@ var (
ErrTokenNotValid = errors.New("token is not valid")
ErrTTLNotSet = errors.New("TTL is not set")
ErrTTLTooLow = errors.New("TTL is too low")
ErrTTLTooHigh = errors.New("TTL is too high")
ErrURLNotHTTPS = errors.New("url is not https")
ErrURLNotSet = errors.New("url is not set")
ErrUsernameNotSet = errors.New("username is not set")

Some files were not shown because too many files have changed in this diff Show More