Commit Briefs
dns: add Handlers for common server responses
this takes more stuff out of cmd/recursor that could be used by other servers. While here reject even more qtypes from recursive resolution
cmd/recursor: return error when no more servers to ask
So we eturn SERVFAIL correctly to clients, the same way that Cloudflare, quad9 et al. do.
cmd/recursor: comments on caching records
With an explanation of why we lookup before we insert into the cache
doc: tutorial with the even simpler Ask function
that is the simplest operation, not Exchange (anymore)!
cmd/recursor: bail out on query loop
Pretty easy fix: just keep track of where we're up to each time we call resolve(). Fixes: https://todo.sr.ht/~otl/dns/4
cmd/recursor: rewrite cache and recursor algorithm
Now we only ever send queries to nameservers, not just things we happen to find in the additional section of a reply. This change also does caching more nicely; cache any records that we get from nameservers. Authoritative answers get priority. Fixes: https://todo.sr.ht/~otl/dns/4
recursor: set more correct header bits in response
This is what quad9 and google's dns resolver do
recursor: actually, move recursive stuff back to cmd
it's too specific to the implementation of a recursive resolver. More stuff will be added there later I reckon.
dns: error on receiving random messages
Caller can handle the error appropriately I reckon...
dns: Separate sending messages from sending bytes
That made it easy to then let us ResponseWriter to implement io.Writer
dns: Move recursive resolution functions into package
They seem generic enough to be in the package rather than in the server implementation - ignoring the cache, of course!