Commit graph

27 commits

Author SHA1 Message Date
Miek Gieben
0919216d3c middleware/{file, auto}: resolve external CNAMEs
Do the same thing as in etcd and give the option of externally resolving
CNAME. This is needed when CoreDNS is a proxy as well is serving zones.
2016-11-09 21:26:49 +00:00
Miek Gieben
27d893cf33 ServiceBackend interface (#369)
* Add ServiceBackend interface

This adds a ServiceBackend interface that is shared between etcd/etcd3
(later) and kubernetes, leading to a massive reduction in code. When
returning the specific records from their backend.

Fixes #273
2016-10-30 15:54:16 +00:00
Miek Gieben
77947fd51a middleware/etcd: add setup_test.go (#304)
Add tests for parsing etcd Corefile stanza. Discover a bug in the code,
fix that as well.
2016-09-26 14:43:38 +01:00
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
9ac3cab1b7 Make CoreDNS a server type plugin for Caddy (#220)
* Make CoreDNS a server type plugin for Caddy

Remove code we don't need and port all middleware over. Fix all tests
and rework the documentation.

Also make `go generate` build a caddy binary which we then copy into
our directory. This means `go build`-builds remain working as-is.

And new etc instances in each etcd test for better isolation.
Fix more tests and rework test.Server with the newer support Caddy offers.

Fix Makefile to support new mode of operation.
2016-08-19 17:14:17 -07:00
Miek Gieben
21ddfe8290 Move singleflight out of middleware/ (#217)
It is not middleware, so move it up one level. It was also use from
core/ showing that indeed its use is not limited to middlewares.
2016-08-16 09:24:37 -07:00
Miek Gieben
b53661d223 Add debugging for failed lookups (#199)
This PR adds debug support for failed lookups. I.e. when a record
is outside the configured domain, we do a forward lookup. If this
fails the error is silently dropped. This PR adds it back as an error
in when debugging is enabled.

Fixes #197
2016-08-08 19:54:17 -07: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
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
1aa1a92198 Add middleware/dnssec (#133)
This adds an online dnssec middleware. The middleware will sign
responses on the fly. Negative responses are signed with NSEC black
lies.
2016-04-26 17:57:11 +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
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
31ce53f514 better (#104) 2016-04-11 10:22: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
0ea2a6088d Add TestServer (#102)
Add a fullblown testing server. This allows us to do integration tests.

Also add a basic proxy test. Further tests will test etcd proxy
and stub zone communication and other "wildish" configurations.
Redo the server startup, so we can access the ports it listens on when
it has started up (with dns.ActivateAndServer).

Extend the .travis file to download etcd and test for that as well.

Put integration tests in test dir
2016-04-10 18:50:11 +01:00
Miek Gieben
84dfdab584 Cache elements of State
Cache the size and the do bit whenever someone asked for it. We can

probably add more:



PASS

BenchmarkStateDo-4  	100000000	        11.9 ns/op

BenchmarkStateSize-4	 5000000	       265 ns/op

ok  	github.com/miekg/coredns/middleware	2.828s



PASS

BenchmarkStateDo-4  	1000000000	         2.86 ns/op

BenchmarkStateSize-4	500000000	         3.10 ns/op

ok  	github.com/miekg/coredns/middleware	5.032s



This PR also includes some testing cleanups as well.
2016-04-04 08:19:06 +01:00
Miek Gieben
48f7d55f27 Get positive dnssec stuff going 2016-03-30 13:25:45 +00: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
e8982dc99c Add tests for multi zone support
Working as intended and now tested.
2016-03-25 16:24:43 +00:00
Miek Gieben
e62eb2cde0 Bugfix: bx in etcd.go didn't get Key
Thus record only diffing in the Key were seen as identical and not
included in the end results. Of course this being a map when and if
this would happen was rather random.

Fixed by including Key. Further small tweaks and code refactors.
2016-03-25 15:30:44 +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
430f11a6d2 Add context.WithTimeout
Closes #41
2016-03-24 17:46:14 +00:00
Miek Gieben
4fe39f9e9e Port tests from SkyDNS
This adds *most* of the tests from SkyDNS, things lacking is
the stubzone checking, groups and the trim prefix. These
will be added in subsequent PRs and in separate test files.
2016-03-24 17:31:01 +00:00
Miek Gieben
78d2e31ec1 Add Stub resolving
SkyDNS can forward requests from one instance to another.
Add this base infrastructure for this feature to CoreDNS.

Add more tests as well.
2016-03-24 09:20:53 +00:00