diff --git a/README.md b/README.md index e69de29..31faacc 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,90 @@ +# DynDNS Updater + +A dynamic DNS updater service that automatically updates DNS records with your current IP address. + +## Configuration (config.json) + +The `config.json` file contains all settings for the updater. Here's a detailed explanation of each option: + +### Root Level Options + +#### `ip_lookup` (required) +Specifies the services used to discover your public IP addresses. + +```json +"ip_lookup": { + "ipv4": ["https://api.ipify.org", "..."], + "ipv6": ["https://api6.ipify.org", "..."] +} +``` + +- **`ipv4`** (array of URLs): List of services to query for your IPv4 address. Services are tried in random order until one succeeds. +- **`ipv6`** (array of URLs): List of services to query for your IPv6 address. Services are tried in random order until one succeeds. + +#### `domains` (required) +Dictionary containing the active domain configurations to update. Each key is a domain name, and each value is a domain configuration object (see below). + +```json +"domains": { + "example.com": { ... }, + "another.com": { ... } +} +``` + +#### `interval` (optional) +How frequently (in seconds) to check for IP changes and update domains. Defaults to `600` (10 minutes). + +```json +"interval": 300 +``` + +### Domain Configuration Format + +Each entry in the `domains` dictionary has the following structure: + +```json +"example.com": { + "modes": ["ipv4", "ipv6"], + "url": "https://api.example.com/update", + "method": "GET", + "params": { + "token": "your-token", + "domain": "${DOMAIN}", + "ip": "${IPV4}" + }, + "headers": { + "Authorization": "Bearer token-value" + } +} +``` + +#### Domain Options + +- **`modes`** (array, optional): Which IP versions to update. Options are `"ipv4"` and/or `"ipv6"`. Defaults to `["ipv4"]`. + +- **`url`** (string, required): The endpoint URL of your DNS service provider's update API. + +- **`method`** (string, optional): HTTP method to use for the update request. Defaults to `"GET"`. Other options: `"POST"`, `"PUT"`, etc. + +- **`params`** (object, optional): Query parameters (for GET/HEAD requests) or request body parameters to send with the update request. Supports variable substitution. + +- **`headers`** (object, optional): HTTP headers to include in the request. Supports variable substitution. Use for authentication headers like `Authorization` or `X-API-Key`. + +#### Variable Substitution + +These variables are automatically replaced in `params` and `headers` values: + +- `${DOMAIN}`: The domain name being updated +- `${IPV4}`: Your current IPv4 address +- `${IPV6}`: Your current IPv6 address + +## Setup + +1. Create or edit `config.json` with: + - Configure `ip_lookup` with services to detect your public IPs + - Add your domain configurations to the `domains` section + - Replace placeholder values with your actual API tokens and credentials + - Specify which IP versions to update in `modes` for each domain + - (Optional) Adjust `interval` if needed + +2. Run the updater to start keeping your DNS records current