Commit graph

32 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
ad76aef5fc Fix stubzone retention (#198)
Make the receiver a pointer so that the uptdateStubZones map update will
retain the stubzones found, unlike the current case where the update
will be applied and then promptly forgotten, because it is working on a
copy.

Add test/etcd_test.go to test a large part of the code. This didn't
catch the chaos middleware hack though. The chaos middleware zones are
now *not* automatically added. You have to take care of that by yourself
(docs updates).

When using debug queries and falling through to the next middleware in
etcd, restore the original (with o-o.debug) query before passing it on.
2016-08-08 19:18:55 -07:00
Joe Blow
2882991000 Tidy up most errors and warnings from lint tools. (#165) 2016-06-10 23:00:47 +01:00
Miek Gieben
713f10f6af middleware/etcd: reverse addresses (#162)
* middleware/etcd: reverse addresses

Implement reverse (PTR) addresses. Update the documentation on how to
configure test. Added tests as well.

Fixes: #157 #159

* Cleanup readme a little
2016-06-08 10:29:46 +01:00
Miek Gieben
3110306296 middleware/etcd: Return json parsing errors (#158)
When coredns unmarshals a json value and it fails it will put the error
in the returned message iff the query was a debug query
(o-o.debug.<REST>).
2016-06-07 20:57:45 +01:00
Miek Gieben
446eaa957d Fixes: debug RR and header bits (#151)
Always set the auth and rd bits in the reply. And reverse the
ownername of debug queries so that manual matching is much easier.
2016-05-23 09:16:57 +01:00
Miek Gieben
c30671f4c0 Allow debug queries to etcd middleware (#150)
With this you can retreive the raw data that the etcd middleware
used to create the reply. The debug data is put in TXT records
that are stuffed in the CH classs. This is only enabled if you
specify `debug` in the etcd stanza.

You can retrieve it by prefixing your query with 'o-o.debug.'
For instance:

; <<>> DiG 9.10.3-P4-Ubuntu <<>> @localhost -p 1053 SRV o-o.debug.production.*.skydns.local
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 47798
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 3

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;o-o.debug.production.*.skydns.local. IN	SRV

;; ANSWER SECTION:
production.*.skydns.local. 154	IN	SRV	10 50 8080 service1.example.com.
production.*.skydns.local. 154	IN	SRV	10 50 8080 service2.example.com.

;; ADDITIONAL SECTION:
skydns.local.skydns.east.production.rails.1. 154 CH TXT	"service1.example.com:8080(10,0,,false)[0,]"
skydns.local.skydns.west.production.rails.2. 154 CH TXT	"service2.example.com:8080(10,0,,false)[0,]"
2016-05-22 21:16:26 +01:00
Miek Gieben
e726dca2ee Fix error reporting (#128)
Put error back in the correct place in the directives.go. Also don't
make it a pointer. If it *is* a pointer the buildstack function does
not correctly set the Next Handler. Don't understand *why* this is
different from Caddy. Anyway this fixes it, with the caveat that
the error log file is now openend earlier in the startup.

Fixes #127
2016-04-19 22:51:23 +01:00
Miek Gieben
a1e6cb7cf4 middleware/etcd: Use the correct endpoint
The endpoint for etcd as wrongly set if a proxy was configured.
Clean up some documentation in the process as well.
2016-04-19 12:52:05 +00:00
Miek Gieben
95477fd2fe Dont crash on tests with etcd running 2016-04-15 20:22:37 +01:00
Miek Gieben
e979acba1b Implement NS queries to Etcd middleware
Copy and port the NS record stuff from SkyDNS. Slightly cleaner
implementation.
2016-04-13 08:03:56 +01:00
Miek Gieben
a441f93e0c Fix NODATA/NXDOMAIN for unknown types in etcd (#113)
* Finish the nodata stuff. See issue #9
* middleware/etc: add response to SOA queries
* Remove and add a few TODOs
2016-04-12 23:26:46 +01:00
Miek Gieben
27ff83e70f Stub forward/proxy tests (#108)
Test the handling of EDNS0 payloads and forwarding to stubzones
servers.
2016-04-12 21:30:08 +01:00
Miek Gieben
ad221f4b2a correct EDNS responses (#96)
Tests updated as well and all the middleware. And Prometheus renamed to
metrics (directive is still prometheus).
2016-04-09 16:17:53 +01:00
Miek Gieben
e0c4f94d67 return failure with CH class hits file or etcd, monitoring portis 9135 2016-04-05 16:23:03 +01:00
Miek Gieben
8892a1b490 Middleware chaining fixes
For prometheus use the plain value, not a pointer and change all usages.
Allow AXFR to be requested over udp as well and some other more log
printed when commencing an AXFR.
2016-04-05 15:54:06 +01:00
Miek Gieben
20e16491ec Add more logging
Put some more logging in CoreDNS.
2016-04-05 07:37:05 +01:00
Miek Gieben
6445a3f2f0 Cleanup docs and the chaos middleware
Make the CH middleware actually work. Needs a bit of a hack to route

the fake version.bind and friends zone to the correct handler. Fiddle

with the order in directive.go so that CH queries get logged as well.



Secondly add class rewriting to the rewrite middleware handler and also

log the class by default.
2016-04-04 15:45:17 +01:00
Miek Gieben
6eae17b0bd Add testing package
This already includes a bunch of helper functions that aid in testing.
Factor out etcd and file testing to use this package.

Fixes: #50
2016-03-28 10:49:28 +01:00
Miek Gieben
5a919198ac Merge pull request #45 from miekg/etcd-stub
Etcd stub
2016-03-28 10:18:08 +01:00
Miek Gieben
5387c162c9 Implement a DNS zone
Full implementation, DNS (and in the future DNSSEC). Returns answer in a
hopefully standards compliant way.
Testing with my miek.nl zone are included as well.
This should correctly handle nodata, nxdomain and cnames.
2016-03-28 10:15:05 +01:00
Miek Gieben
ebef64280a Support SkyDNS' stubzones
This implements stubzones in the same way as SkyDNS. This
also works with multiple configured domains and has tests.
Also add more configuration parameters for TLS and path prefix and
enabling stubzones.  Run StubUpdates as a startup command to keep up to
date with the list in etcd.
2016-03-26 16:29:35 +00:00
Miek Gieben
90f73c50cf Add Scrub function
This function will make the message fit for the client's buffer, or
set the TC bit.
2016-03-26 09:26:54 +00:00
Miek Gieben
e408c81a8c Add more tests and include the forgotten chaos_test.go as well 2016-03-25 10:32:12 +00:00
Miek Gieben
a655a5735b Slowly adding all the tests from skydns 2016-03-23 22:59:05 +00:00
Miek Gieben
503cf5176a clean println 2016-03-22 23:33:07 +00:00
Miek Gieben
58b5e93b8a fix order 2016-03-22 23:31:11 +00:00
Miek Gieben
8c707c8031 more 2016-03-22 22:44:50 +00:00
Miek Gieben
ae841ae342 it compiles 2016-03-22 11:04:56 +00:00
Miek Gieben
1a7f0deadd More cleanup - needs to think a little about NewSOA() 2016-03-22 10:29:48 +00:00
Miek Gieben
b6341e8b63 more etcd stuff 2016-03-20 21:36:55 +00:00
Miek Gieben
57d45cbbd8 Start working on a etcd backend 2016-03-20 17:44:58 +00:00
Renamed from middleware/etcd/TODO (Browse further)