Move all (almost all) Go files in middleware into their
own packages. This makes for better naming and discoverability.
Lot of changes elsewhere to make this change.
The middleware.State was renamed to request.Request which is better,
but still does not cover all use-cases. It was also moved out middleware
because it is used by `dnsserver` as well.
A pkg/dnsutil packages was added for shared, handy, dns util functions.
All normalize functions are now put in normalize.go
Changes large parts of proxy lookup mechanism.
The duplicate zone checking erroneous added a nameserver for each
zone we are auth. for, creating to many backend hosts. So even when a
host was determined do be Down() we still got an (identical) new one
from the list.
The Down() and failure checking for upstream hosts had data race in the
uh.Fails check - we now use atomic.LoadInt32 for that.
Use and debug the test/server.go test servers implementation in the
TestStubLookup test to prevent going out to the internet.
Also delete the stub cycle test. That test was wrong and did not test
what it needed to be testing. Deleted for now.
Return a delegation when seeing one while traversing the tree in
search of an answer.
Put the SOA and NS record in the zone.Apex as these are to be handled
somewhat special.
Lowercase record on insert to make compares easier. This lowercases
all RR that have domain names in their rdata as well.
We should not check the port of the request, we *should* actually
normalize it to port 53 - as that will probably be the address of
the server. Still need to double check if this will work if the
axfr should actually be done from a different port. That will come
later, this is good enough for now.
Test shouldTransfer by upping a testserver and sending the SOA query.
Remove state from DefaultErrorHandler and just get it from the request.
Add more logging to show what is going on.
This also adds the infrastructure for future tests.