feat(custom): add custom provider

- Sends HTTP GET request to url given with ip information
- Configurable ipv4 and ipv6 query parameter keys
- Configurable response success detection with a regex
- Treat non status OK 200 responses as failures
This commit is contained in:
Quentin McGaw
2024-01-19 19:54:43 +00:00
parent 12c46e7635
commit 0c561d4378
6 changed files with 206 additions and 0 deletions

40
docs/custom.md Normal file
View File

@@ -0,0 +1,40 @@
# Custom provider
The custom provider allows to configure a URL with a few additional parameters to update your records.
For now it sends an HTTP GET request to the URL given with some additional parameters.
Feel free to open issues to extend its configuration options.
## Configuration
### Example
```json
{
"settings": [
{
"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",
"success_regex": "good",
"ip_version": "ipv4"
}
]
}
```
### Compulsory parameters
- `"domain"` is the domain name to update
- `"host"` is the host to update, which can be `"@"` (root), `"*"` or a subdomain
- `"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.
- `"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
- `"ip_version"` can be `ipv4` (A records) or `ipv6` (AAAA records), defaults to `ipv4 or ipv6`