Commit graph

8 commits

Author SHA1 Message Date
Miek Gieben
d1f17fa7e0 Cleanup: put middleware helper functions in pkgs (#245)
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
2016-09-07 11:10:16 +01:00
Miek Gieben
34ffb2b314 Fix TestStubLookup and TestLookup (#213)
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.
2016-08-14 12:57:49 -06:00
Miek Gieben
e294c95582 middleware/file: Support delegations (#124)
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.
2016-04-16 16:16:52 +01:00
Miek Gieben
c9d8a57ed6 Reload zone when a write is detected (#122)
Zone reloading
2016-04-15 14:26:27 +01:00
Miek Gieben
4829b40efa Rename middleware/testing (#103)
Rename to test and name the toplevel tests dir to test for consitency.
2016-04-11 07:56:38 +01:00
Miek Gieben
09207867e4 Add missing test file and fix notify
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.
2016-04-07 08:03:57 +01:00
Miek Gieben
e4c72719bf Test and fix notify
More tests and add RemoteAddr to State, prolly LocalAddr will be

useful as well.

Fixed and tested IsNotify method.
2016-04-07 07:42:58 +01:00
Miek Gieben
225cdd1ca3 Add AXFR test
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.
2016-04-06 22:29:33 +01:00