As time permits I would like to improve it but based on recent discussions regarding US servers being given out in Africa and load in the Belgium zone I thought it may be useful to others.
Thinking aloud - What is a number of locations ran this from many different servers around the world then uploaded to a common location. Maybe that results could be useful.
Yeah I created this after one of the big anycast dns providers started including Argentina ip addresses for queries from NZ. The round trip time highlights distant servers. When you see a response with 400+ msec times you start to wonder why the system is providing it.
So you’re seeing this behaviour with one particular DNS provider?
Afaik, if provided, the pool will make use of something called EDNS to derive your country from your IP address, as reported by your DNS server. Not all DNS services provide this for privacy reasons, in which case the pool uses the DNS server’s location instead.
Which does not explain what you’re describing. What is this DNS service?
I noticed in glancing at the code that if an NTP query fails, the code waits 1 second before retrying. I suggest at least two seconds as the default ntpd restrict ... limited ignores queries less than 2s apart. I’m guessing your code caches RTT to NTP servers, if so you’re likely not going to self-inflict rate limiting but it’s just a good practice to avoid hitting NTP servers every second. If this were run from a client behind CGNAT, you could hit rate limiting due to neighboring networks happening to have queried the pool server just before.