Commit graph

15 commits

Author SHA1 Message Date
Miek Gieben
d8714e64e4 Remove the word middleware (#1067)
* Rename middleware to plugin

first pass; mostly used 'sed', few spots where I manually changed
text.

This still builds a coredns binary.

* fmt error

* Rename AddMiddleware to AddPlugin

* Readd AddMiddleware to remain backwards compat
2017-09-14 09:36:06 +01:00
Miek Gieben
468d5b57de core: export ClientWrite (#849)
Make ClientWrite available for middleware to use.
2017-08-07 07:39:57 -07:00
Miek Gieben
4723fb9418 Gofmt all code (#552)
* Gofmt all code

* fmt
2017-02-22 16:06:20 +00:00
John Belamaric
bc301be5ee Add tracing option (#487)
Adds a middleware to enable tracing with OpenTracing/OpenZipkin.
Enabling tracing will have a large impact on performance so it is
not advisable in production.
2017-01-23 15:40:47 -05:00
Miek Gieben
c4ab98c6e3 Add middleware.NextOrFailure (#462)
This checks if the next middleware to be called is nil, and if so returns
ServerFailure and an error. This makes the next calling more robust and
saves some lines of code.

Also prefix the error with the name of the middleware to aid in
debugging.
2016-12-20 18:58:05 +00:00
Miek Gieben
94dc28646d golint 2016-10-27 11:48:37 +00:00
Miek Gieben
219bfd0493 middleware/metrics: cleanup (#355)
* middleware/metrics: add more metrics

middleware/cache:
Add metrics for number of elements in the cache. Also export the total
size. Update README to detail the new metrics.

middleware/metrics

Move metrics into subpackage called "vars". This breaks the import
cycle and is cleaner. This allows vars.Report to be used in the
the dnsserver to log refused queries.

middleware/metrics: tests

Add tests to the metrics framework. The metrics/test subpackage allows
scraping of the local server. Do a few test scrape of the metrics that
are defined in the metrics middleware.

This also allows metrics integration tests to check if the caching and
dnssec middleware export their metrics correctly.

* update README

* typos

* fix tests
2016-10-26 10:01:52 +01:00
Miek Gieben
30fd224504 middleware/whoami: add (#264)
Add a new middleware that tells you who you are; IP, port and transport
is echoed back.

Also some various cleanup and documentation improvements while at it:

* ResponseWriter: improve the documentation of these helper functions.
* And add an NextHandler for use in tests. Make chaos_test.go and
* whoam_test.go use it.
2016-09-17 17:09:05 +01:00
Miek Gieben
2dd8a687b3 Startup notification (#250)
Stop the caddy message and start our own init notifications.
Log the version of CoreDNS when starting up.
Fix all middleware's setup functions so that return the error prefixed
with *which* middleware was failing; leads to better debuggable errors
when starting up.
2016-09-10 09:16:25 +01:00
Miek Gieben
26f52a99d9 Remove old stuff from caddy and some go vet changes (#227) 2016-08-21 11:28:11 +01:00
Miek Gieben
a412255ad1 middleware/cache: Add metrics (#132)
Add prometheus metrics to the cache handler. This just used prometheus,
if the metrics middleware does not setup the handler, there is nobody
reading these metrics, but they are still reported. Seems the simplest
solution while keeping the whole middleware separation in tact.
2016-04-21 21:46:58 +01:00
Miek Gieben
4c55b6732f Documentation updates
Remove placeholder for the docs inside the logs middleware and
explain response codes better.
2016-04-04 15:45:11 +00: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
f907311cdf Use context.Context
Rename the old Context to State and use context.Context in the
middleware for intra-middleware communication and more.
2016-03-19 07:32:50 +00:00
Miek Gieben
3ec0d9fe6b First commit 2016-03-18 20:57:35 +00:00