Skip to content

Commit

Permalink
fix(ipv6): add JSON IPv6 suffix parameter
Browse files Browse the repository at this point in the history
- Remove `IPV6_PREFIX` environment variable (unneeded) and remove associated code
- Update all documentation for each provider supporting IPv6
- Build IPv6 as prefix:suffix when getting it from a public IP source for each record IPv6 suffix parameter
  • Loading branch information
qdm12 committed Jan 29, 2024
1 parent b771b5c commit 95f2c48
Show file tree
Hide file tree
Showing 98 changed files with 754 additions and 454 deletions.
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ ENV \
# Core
CONFIG= \
PERIOD=5m \
IPV6_PREFIX=/128 \
UPDATE_COOLDOWN_PERIOD=5m \
PUBLICIP_FETCHERS=all \
PUBLICIP_HTTP_PROVIDERS=all \
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ The program reads the configuration from a JSON object, either from a file or fr
docker run -d -p 8000:8000/tcp -v "$(pwd)"/data:/updater/data qmcgaw/ddns-updater
```

1. ⚠️ If you use IPv6, you might need to set `-e IPV6_PREFIX=/64` (`/64` is your prefix, depending on your ISP)
1. (Optional) You can also 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.

### Next steps
Expand Down Expand Up @@ -224,7 +223,6 @@ Note that:
| --- | --- | --- |
| `CONFIG` | | One line JSON object containing the entire config (takes precedence over config.json file) if specified |
| `PERIOD` | `5m` | Default period of IP address check, following [this format](https://golang.org/pkg/time/#ParseDuration) |
| `IPV6_PREFIX` | `/128` | IPv6 prefix used to mask your public IPv6 address and your record IPv6 address. Ranges from `/0` to `/128` depending on your ISP. |
| `PUBLICIP_FETCHERS` | `all` | Comma separated fetcher types to obtain the public IP address from `http` and `dns` |
| `PUBLICIP_HTTP_PROVIDERS` | `all` | Comma separated providers to obtain the public IP address (ipv4 or ipv6). See the [Public IP section](#public-ip) |
| `PUBLICIPV4_HTTP_PROVIDERS` | `all` | Comma separated providers to obtain the public IPv4 address only. See the [Public IP section](#public-ip) |
Expand Down
3 changes: 1 addition & 2 deletions cmd/updater/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,7 @@ func _main(ctx context.Context, reader *reader.Reader, args []string, logger log

updater := update.NewUpdater(db, client, shoutrrrClient, logger)
runner := update.NewRunner(db, updater, ipGetter, config.Update.Period,
ipv6PrefixToBits(config.IPv6.Prefix), config.Update.Cooldown, logger,
resolver, timeNow, hioClient)
config.Update.Cooldown, logger, resolver, timeNow, hioClient)

runnerHandler, runnerCtx, runnerDone := goshutdown.NewGoRoutineHandler("runner")
go runner.Run(runnerCtx, runnerDone)
Expand Down
4 changes: 3 additions & 1 deletion docs/aliyun.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"host": "@",
"access_key_id": "your access_key_id",
"access_secret": "your access_secret",
"ip_version": "ipv4"
"ip_version": "ipv4",
"ipv6_suffix": ""
}
]
}
Expand All @@ -29,5 +30,6 @@
### 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 indentifier 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
4 changes: 3 additions & 1 deletion docs/allinkl.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"host": "host",
"username": "dynXXXXXXX",
"password": "password",
"ip_version": "ipv4"
"ip_version": "ipv4",
"ipv6_suffix": ""
}
]
}
Expand All @@ -29,5 +30,6 @@
### 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 indentifier 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
4 changes: 3 additions & 1 deletion docs/cloudflare.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"host": "@",
"ttl": 600,
"token": "yourtoken",
"ip_version": "ipv4"
"ip_version": "ipv4",
"ipv6_suffix": ""
}
]
}
Expand All @@ -36,5 +37,6 @@ See [this issue comment for context](https://github.com/qdm12/ddns-updater/issue

- `"proxied"` can be set to `true` to use the proxy services of Cloudflare
- `"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 indentifier 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.

Special thanks to @Starttoaster for helping out with the [documentation](https://gist.github.com/Starttoaster/07d568c2a99ad7631dd776688c988326) and testing.
4 changes: 3 additions & 1 deletion docs/custom.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ Feel free to open issues to extend its configuration options.
"ipv4key": "ipv4",
"ipv6key": "ipv6",
"success_regex": "good",
"ip_version": "ipv4"
"ip_version": "ipv4",
"ipv6_suffix": ""
}
]
}
Expand All @@ -38,3 +39,4 @@ Feel free to open issues to extend its configuration options.
### 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 indentifier 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.
4 changes: 3 additions & 1 deletion docs/dd24.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"domain": "domain.com",
"host": "@",
"password": "password",
"ip_version": "ipv4"
"ip_version": "ipv4",
"ipv6_suffix": ""
}
]
}
Expand All @@ -27,3 +28,4 @@
### 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 indentifier 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.
4 changes: 3 additions & 1 deletion docs/ddnss.de.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"username": "user",
"password": "password",
"dual_stack": false,
"ip_version": "ipv4"
"ip_version": "ipv4",
"ipv6_suffix": ""
}
]
}
Expand All @@ -34,5 +35,6 @@
- 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`.
- `"ipv6_suffix"` is the IPv6 interface indentifier 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
2 changes: 2 additions & 0 deletions docs/desec.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"host": "host",
"token": "token",
"ip_version": "ipv4",
"ipv6_suffix": "",
"provider_ip": false
}
]
Expand All @@ -28,6 +29,7 @@
### 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 indentifier 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
Expand Down
4 changes: 3 additions & 1 deletion docs/digitalocean.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"domain": "domain.com",
"host": "@",
"token": "yourtoken",
"ip_version": "ipv4"
"ip_version": "ipv4",
"ipv6_suffix": ""
}
]
}
Expand All @@ -27,5 +28,6 @@
### 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 indentifier 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
4 changes: 3 additions & 1 deletion docs/dnsomatic.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"username": "username",
"password": "password",
"provider_ip": true,
"ip_version": "ipv4"
"ip_version": "ipv4",
"ipv6_suffix": ""
}
]
}
Expand All @@ -31,5 +32,6 @@
### 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 indentifier 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
4 changes: 3 additions & 1 deletion docs/dnspod.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"domain": "domain.com",
"host": "@",
"token": "yourtoken",
"ip_version": "ipv4"
"ip_version": "ipv4",
"ipv6_suffix": ""
}
]
}
Expand All @@ -27,5 +28,6 @@
### 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 indentifier 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
4 changes: 3 additions & 1 deletion docs/dondominio.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"name": "something",
"username": "username",
"key": "key",
"ip_version": "ipv4"
"ip_version": "ipv4",
"ipv6_suffix": ""
}
]
}
Expand All @@ -31,6 +32,7 @@
### 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 indentifier 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

Expand Down
4 changes: 3 additions & 1 deletion docs/dreamhost.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"domain": "domain.com",
"host": "@",
"key": "key",
"ip_version": "ipv4"
"ip_version": "ipv4",
"ipv6_suffix": ""
}
]
}
Expand All @@ -27,5 +28,6 @@

- `"host"` is your host and can be a subdomain or `"@"`. It defaults to `"@"`.
- `"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 indentifier 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
2 changes: 2 additions & 0 deletions docs/duckdns.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"host": "host",
"token": "token",
"ip_version": "ipv4",
"ipv6_suffix": "",
"provider_ip": true
}
]
Expand All @@ -26,6 +27,7 @@
### 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 indentifier 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
Expand Down
4 changes: 3 additions & 1 deletion docs/dyndns.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"host": "@",
"username": "username",
"client_key": "client_key",
"ip_version": "ipv4"
"ip_version": "ipv4",
"ipv6_suffix": ""
}
]
}
Expand All @@ -29,5 +30,6 @@
### 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 indentifier 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
2 changes: 2 additions & 0 deletions docs/dynu.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"username": "username",
"password": "password",
"ip_version": "ipv4",
"ipv6_suffix": "",
"provider_ip": true
}
]
Expand All @@ -31,6 +32,7 @@
### 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 indentifier 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)

Expand Down
2 changes: 2 additions & 0 deletions docs/dynv6.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"host": "@",
"token": "token",
"ip_version": "ipv4",
"ipv6_suffix": "",
"provider_ip": true
}
]
Expand All @@ -28,6 +29,7 @@
### 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 indentifier 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
2 changes: 2 additions & 0 deletions docs/easydns.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"username": "username",
"token": "token",
"ip_version": "ipv4",
"ipv6_suffix": "",
"provider_ip": true
}
]
Expand All @@ -30,6 +31,7 @@
### 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 indentifier 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
4 changes: 3 additions & 1 deletion docs/freedns.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"domain": "domain.com",
"host": "host",
"token": "token",
"ip_version": "ipv4"
"ip_version": "ipv4",
"ipv6_suffix": ""
}
]
}
Expand All @@ -27,6 +28,7 @@
### 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 indentifier 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

Expand Down
4 changes: 3 additions & 1 deletion docs/gandi.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ This provider uses Gandi v5 API
"host": "@",
"personal_access_token": "token",
"ttl": 3600,
"ip_version": "ipv4"
"ip_version": "ipv4",
"ipv6_suffix": ""
}
]
}
Expand All @@ -30,6 +31,7 @@ This provider uses Gandi v5 API
### 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 indentifier 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"` default is `3600`

## Domain setup
Expand Down
4 changes: 3 additions & 1 deletion docs/gcp.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
},
"domain": "domain.com",
"host": "@",
"ip_version": "ipv4"
"ip_version": "ipv4",
"ipv6_suffix": ""
}
]
}
Expand All @@ -35,3 +36,4 @@
### 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 indentifier 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.
4 changes: 3 additions & 1 deletion docs/godaddy.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"host": "@",
"key": "key",
"secret": "secret",
"ip_version": "ipv4"
"ip_version": "ipv4",
"ipv6_suffix": ""
}
]
}
Expand All @@ -29,6 +30,7 @@
### 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 indentifier 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

Expand Down
Loading

0 comments on commit 95f2c48

Please sign in to comment.