Skip to content

Commit 289536b

Browse files
committed
Documentation: architecture section
1 parent d5e4936 commit 289536b

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,40 @@ If you have a host firewall in place, this container needs the following ports:
208208
- UDP 53 outbound for outbound DNS resolution
209209
- TCP 8000 inbound (or other) for the WebUI
210210

211+
## Architecture
212+
213+
At program start and every period (5 minutes by default):
214+
215+
1. Fetch your public IP address
216+
1. For each record:
217+
1. DNS resolve it to obtain its current IP address(es)
218+
- If the resolution fails, update the record with your public IP address by calling the DNS provider API and finish
219+
1. Check if your public IP address is within the resolved IP addresses
220+
- Yes: skip the update
221+
- No: update the record with your public IP address by calling the DNS provider API
222+
223+
💡 We do DNS resolution every period so it detects a change made to the record manually, for example on the DNS provider web UI
224+
💡 As DNS resolutions are essentially free and without rate limiting, these are great to avoid getting banned for too many requests.
225+
226+
### Special case: Cloudflare
227+
228+
For Cloudflare records with the `proxied` option, the following is done.
229+
230+
At program start and every period (5 minutes by default), for each record:
231+
232+
1. Fetch your public IP address
233+
1. For each record:
234+
1. Check the last IP address (persisted in `updates.json`) for that record
235+
- If it doesn't exist, update the record with your public IP address by calling the DNS provider API and finish
236+
1. Check if your public IP address matches the last IP address you updated the record with
237+
- Yes: skip the update
238+
- No: update the record with your public IP address by calling the DNS provider API
239+
240+
This is the only way as doing a DNS resolution on the record will give the IP address of a Cloudflare server instead of your server.
241+
242+
⚠️ This has the disadvantage that if the record is changed manually, the program will not detect it.
243+
We could do an API call to get the record IP address every period, but that would get you banned especially with a low period duration.
244+
211245
## Gotify
212246
213247
[![Gotify](https://github.com/qdm12/ddns-updater/blob/master/readme/gotify.png?raw=true)](https://gotify.net)

0 commit comments

Comments
 (0)