|
| 1 | +# Multi-Provider Configuration Guide |
| 2 | + |
| 3 | +GoDNS now supports configuring multiple DNS providers simultaneously, allowing you to manage domains across different DNS services from a single GoDNS instance. |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +- **Multi-Provider Support**: Configure multiple DNS providers (Cloudflare, DNSPod, DigitalOcean, etc.) in one config file |
| 8 | +- **Per-Domain Provider**: Specify different providers for different domains |
| 9 | +- **Full Backward Compatibility**: Existing single-provider configurations continue to work unchanged |
| 10 | +- **Mixed Configuration**: Combine legacy global provider with new per-domain providers |
| 11 | +- **Provider-Specific Credentials**: Each provider can have its own authentication credentials |
| 12 | + |
| 13 | +## Configuration Options |
| 14 | + |
| 15 | +### Option 1: Multi-Provider Configuration |
| 16 | + |
| 17 | +Configure multiple providers with per-domain assignment: |
| 18 | + |
| 19 | +```json |
| 20 | +{ |
| 21 | + "providers": { |
| 22 | + "Cloudflare": { |
| 23 | + |
| 24 | + "password": "your-cloudflare-api-token" |
| 25 | + }, |
| 26 | + "DNSPod": { |
| 27 | + "login_token": "your-dnspod-token" |
| 28 | + }, |
| 29 | + "DigitalOcean": { |
| 30 | + "login_token": "your-digitalocean-api-token" |
| 31 | + } |
| 32 | + }, |
| 33 | + "domains": [ |
| 34 | + { |
| 35 | + "domain_name": "example.com", |
| 36 | + "sub_domains": ["www", "api"], |
| 37 | + "provider": "Cloudflare" |
| 38 | + }, |
| 39 | + { |
| 40 | + "domain_name": "mysite.net", |
| 41 | + "sub_domains": ["mail", "ftp"], |
| 42 | + "provider": "DNSPod" |
| 43 | + } |
| 44 | + ] |
| 45 | +} |
| 46 | +``` |
| 47 | + |
| 48 | +### Option 2: Legacy Single-Provider (Backward Compatible) |
| 49 | + |
| 50 | +Existing configurations continue to work unchanged: |
| 51 | + |
| 52 | +```json |
| 53 | +{ |
| 54 | + "provider": "DNSPod", |
| 55 | + "login_token": "your-dnspod-token", |
| 56 | + "domains": [ |
| 57 | + { |
| 58 | + "domain_name": "example.com", |
| 59 | + "sub_domains": ["www", "test"] |
| 60 | + } |
| 61 | + ] |
| 62 | +} |
| 63 | +``` |
| 64 | + |
| 65 | +### Option 3: Mixed Configuration |
| 66 | + |
| 67 | +Combine global provider with specific per-domain providers: |
| 68 | + |
| 69 | +```json |
| 70 | +{ |
| 71 | + "provider": "DNSPod", |
| 72 | + "login_token": "your-dnspod-token", |
| 73 | + "providers": { |
| 74 | + "Cloudflare": { |
| 75 | + |
| 76 | + "password": "your-cloudflare-api-token" |
| 77 | + } |
| 78 | + }, |
| 79 | + "domains": [ |
| 80 | + { |
| 81 | + "domain_name": "oldsite.com", |
| 82 | + "sub_domains": ["www", "mail"] |
| 83 | + }, |
| 84 | + { |
| 85 | + "domain_name": "newsite.com", |
| 86 | + "sub_domains": ["www", "api"], |
| 87 | + "provider": "Cloudflare" |
| 88 | + } |
| 89 | + ] |
| 90 | +} |
| 91 | +``` |
| 92 | + |
| 93 | +## Provider Configuration Fields |
| 94 | + |
| 95 | +Each provider in the `providers` section supports these common fields: |
| 96 | + |
| 97 | +- `email`: Email address for authentication (Cloudflare, etc.) |
| 98 | +- `password`: API token or password |
| 99 | +- `password_file`: Path to file containing password/token |
| 100 | +- `login_token`: Login token for token-based auth (DNSPod, etc.) |
| 101 | +- `login_token_file`: Path to file containing login token |
| 102 | +- `app_key`: Application key (provider-specific) |
| 103 | +- `app_secret`: Application secret (provider-specific) |
| 104 | +- `consumer_key`: Consumer key (provider-specific) |
| 105 | + |
| 106 | +## Domain Configuration |
| 107 | + |
| 108 | +Domains support an optional `provider` field: |
| 109 | + |
| 110 | +```json |
| 111 | +{ |
| 112 | + "domain_name": "example.com", |
| 113 | + "sub_domains": ["www", "api", "@"], |
| 114 | + "provider": "Cloudflare" |
| 115 | +} |
| 116 | +``` |
| 117 | + |
| 118 | +If `provider` is omitted, the domain uses the global `provider` setting. |
| 119 | + |
| 120 | +## Supported Providers |
| 121 | + |
| 122 | +All existing providers are supported in multi-provider mode. Use these **exact** provider names in your configuration: |
| 123 | + |
| 124 | +| Provider Name | Configuration Value | Authentication Methods | |
| 125 | +|---------------|-------------------|----------------------| |
| 126 | +| Cloudflare | `"Cloudflare"` | `email` + `password` OR `login_token` | |
| 127 | +| DNSPod | `"DNSPod"` | `password` OR `login_token` | |
| 128 | +| DigitalOcean | `"DigitalOcean"` | `login_token` | |
| 129 | +| AliDNS | `"AliDNS"` | `email` + `password` | |
| 130 | +| Google Domains | `"Google"` | `email` + `password` | |
| 131 | +| Hurricane Electric | `"HE"` | `password` | |
| 132 | +| Dreamhost | `"Dreamhost"` | `login_token` | |
| 133 | +| Duck DNS | `"DuckDNS"` | `login_token` | |
| 134 | +| NoIP | `"NoIP"` | `email` + `password` | |
| 135 | +| Scaleway | `"Scaleway"` | `login_token` | |
| 136 | +| DynV6 | `"Dynv6"` | `login_token` | |
| 137 | +| Linode | `"Linode"` | `login_token` | |
| 138 | +| Strato | `"Strato"` | `password` | |
| 139 | +| LoopiaSE | `"LoopiaSE"` | `password` | |
| 140 | +| Infomaniak | `"Infomaniak"` | `password` | |
| 141 | +| Hetzner | `"Hetzner"` | `login_token` | |
| 142 | +| OVH | `"OVH"` | `app_key` + `app_secret` + `consumer_key` | |
| 143 | +| Dynu | `"Dynu"` | `password` | |
| 144 | +| IONOS | `"IONOS"` | `login_token` | |
| 145 | +| TransIP | `"TransIP"` | `email` + `login_token` | |
| 146 | + |
| 147 | +**Important**: Provider names are case-sensitive. Use the exact values from the "Configuration Value" column. |
| 148 | + |
| 149 | +## Migration Guide |
| 150 | + |
| 151 | +### From Single to Multi-Provider |
| 152 | + |
| 153 | +1. **Keep existing config working**: No changes needed for current setups |
| 154 | +2. **Add new providers gradually**: |
| 155 | + ```json |
| 156 | + { |
| 157 | + "provider": "DNSPod", // Keep existing |
| 158 | + "login_token": "old-token", |
| 159 | + "providers": { // Add new providers |
| 160 | + "Cloudflare": { |
| 161 | + |
| 162 | + "password": "cf-token" |
| 163 | + } |
| 164 | + }, |
| 165 | + "domains": [ |
| 166 | + { |
| 167 | + "domain_name": "old-domain.com", |
| 168 | + "sub_domains": ["www"] // Uses DNSPod (global provider) |
| 169 | + }, |
| 170 | + { |
| 171 | + "domain_name": "new-domain.com", |
| 172 | + "sub_domains": ["www"], |
| 173 | + "provider": "Cloudflare" // Uses Cloudflare |
| 174 | + } |
| 175 | + ] |
| 176 | + } |
| 177 | + ``` |
| 178 | + |
| 179 | +3. **Complete migration**: Remove global provider once all domains specify providers |
| 180 | + |
| 181 | +## Configuration Examples |
| 182 | + |
| 183 | +See the example configuration files: |
| 184 | + |
| 185 | +- `configs/config_multi_sample.json` - Full multi-provider setup |
| 186 | +- `configs/config_multi_sample.yaml` - YAML version of multi-provider setup |
| 187 | +- `configs/config_legacy_compatible.json` - Shows backward compatibility |
| 188 | +- `configs/config_mixed_sample.json` - Mixed legacy + new provider configuration |
| 189 | + |
| 190 | +## Logging and Notifications |
| 191 | + |
| 192 | +Multi-provider configurations include provider information in log messages and notifications: |
| 193 | + |
| 194 | +``` |
| 195 | +INFO [2024-01-01T12:00:00Z] Initialized provider: cloudflare |
| 196 | +INFO [2024-01-01T12:00:00Z] Initialized provider: dnspod |
| 197 | +INFO [2024-01-01T12:00:00Z] [ www, api ] of example.com (via cloudflare) |
| 198 | +``` |
| 199 | + |
| 200 | +## Benefits |
| 201 | + |
| 202 | +1. **Consolidation**: Manage multiple DNS providers from one GoDNS instance |
| 203 | +2. **Flexibility**: Use the best provider for each domain |
| 204 | +3. **Redundancy**: Distribute domains across providers for resilience |
| 205 | +4. **Migration**: Gradually move domains between providers |
| 206 | +5. **Cost Optimization**: Use different providers based on pricing/features |
| 207 | +6. **Compliance**: Meet requirements for geographic distribution |
| 208 | + |
| 209 | +## Troubleshooting |
| 210 | + |
| 211 | +### Provider Not Found Error |
| 212 | +``` |
| 213 | +ERROR provider 'cloudflare' not found for domain example.com |
| 214 | +``` |
| 215 | +**Solution**: |
| 216 | +1. Ensure the provider is configured in the `providers` section |
| 217 | +2. Check that you're using the correct case-sensitive provider name (e.g., `"Cloudflare"` not `"cloudflare"`) |
| 218 | + |
| 219 | +### Authentication Failures |
| 220 | +``` |
| 221 | +ERROR failed to create provider Cloudflare: authentication failed |
| 222 | +``` |
| 223 | +**Solution**: Verify credentials in the provider configuration section and ensure you're using the correct authentication method for the provider. |
| 224 | + |
| 225 | +### Mixed Configuration Issues |
| 226 | +If a domain doesn't specify a `provider` field, it will use the global `provider`. Ensure: |
| 227 | +1. Global `provider` is set when using mixed configuration |
| 228 | +2. All required credentials are provided for the global provider |
0 commit comments