Watch DNS records for changes, polling according to the TTL
This library provides the QueryWatcher
type, which can be used like this:
var watcher = new QueryWatcher();
watcher.Add("github.com", QueryType.A).OnChange((q, r) => {
//Do something with the response
foreach (var a in r.Answers.AddressRecords())
{
Console.WriteLine(a.ToString());
}
});
watcher.Start();
The QueryWatcher
polls the DNS server whenever the shortest TTL expires, whenever the local network configuration changes, or when you tell it to by calling the SkipDelay
method.
It will raise the Change
event (which you can listen on) whenever the DNS records it receives have changed from what it received last time.
Initial release