* core: allow all CIDR ranges in zone specifications
Allow (e.g.) a v4 reverse on a /17. If a zone is specified in such a
way a FilterFunc is set in the config. This filter is checked against
incoming queries.
For all other queries this adds a 'x != nil' check which will not impact
performace too much. Benchmark function is added as well to check for
this as wel.
Add multiple tests in tests/server_reverse_test.go.
Benchmark shows in the non-reverse case this hardly impact the speed:
~~~
classless:
pkg: github.com/coredns/coredns/core/dnsserver
BenchmarkCoreServeDNS-4 1000000 1431 ns/op 16 B/op 1 allocs/op
pkg: github.com/coredns/coredns/core/dnsserver
BenchmarkCoreServeDNS-4 1000000 1429 ns/op 16 B/op 1 allocs/op
master:
pkg: github.com/coredns/coredns/core/dnsserver
BenchmarkCoreServeDNS-4 1000000 1412 ns/op 16 B/op 1 allocs/op
pkg: github.com/coredns/coredns/core/dnsserver
BenchmarkCoreServeDNS-4 1000000 1429 ns/op 16 B/op 1 allocs/op
~~~
* README.md updates
* 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
Check for a nil message and if we have a question section. Request is
usually called with an external Msg that already saw validation checks,
but we may also call it from message we create of our own, that may or
may not adhire to this. Just be more robust in this case.
This PR reverts a previous commit that was applied to master.
block chaos queries, unless the chaos or proxy middleware is loaded. We
respond with REFUSED.
This removes the need for each middleware to do this class != ClassINET
if-then.
Also make config.Registry non-public.
* core: hide registerHandler
Remove RegisterHandler and just make it implicit when we look at the
handler compilation step.
* Rename GetHandler to just Handler
Update callers and make auto check Hander in OnStartup.
* Up test coverage in erratic
* up test coverage
* middleware/debug: add
Add a debug "middleware" that disables the recover() and just lets
CoreDNS crash; very useful for testing.
Fixes ##563
* fix test
* Feedback: check the value of Debug
* Implements tracing in the native gRPC server
* Undo some unnecessary changes
* Properly revert trace/setup.go this time
* Some very very basic tests
* Remove warning for non-Trace middleware
* core: add listening for other protocols
Allow CoreDNS to listen for TLS request coming over port 853. This can
be enabled with `tls://` in the config file.
Implement listening for grps:// as well.
a Corefile like:
~~~
. tls://.:1853 {
whoami
tls
}
~~~
Means we listen on 1853 for tls requests, the `tls` config item allows
configuration for TLS parameters. We *might* be tempted to use Caddy's
Let's Encrypt implementation here.
* Refactor coredns/grpc into CoreDNS
This makes gRPC a first class citizen in CoreDNS. Add defines as being
just another server.
* some cleanups
* unexport the servers
* Move protobuf dir
* Hook up TLS properly
* Fix test
* listen for TLS as well. README updates
* disable test, fix package
* fix test
* Fix tests
* Fix remaining test
* Some tests
* Make the test work
* Add grpc test from #580
* fix crash
* Fix tests
* Close conn
* README cleanups
* README
* link RFC
We don't need to use the muxer in Go DNS s we only have one entry point
per server - and mux ourselves in ServeDNS. Also make ServeDNS take a
context, and make that the canonical way to call all middleware.
This fix updates the Makefile to add the `go lint` check
for the build. This fix also fixes several go lint issues.
NOTE: This fix does not enforce `go lint` (suggestion only).
This fix also ignores the `go lint` error:
```
middleware/middleware.go:72:1: context.Context should be the first parameter of a function
```
as it requires too many changes in API.
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
* checkpoint
* Pass context through ServeDNS, enable gRPC tracing
* Fix types and make tracer available to proxy. go fmt
* Fix imports
* Use the DoNotStartTrace option
* Change to SpanFilter from DoNotStartTrace
* Use new name (IncludeSpan)
* Final names
* Add tests; fix possible client/conn leaks in grpc
* go fmt
* server: fix data race
This fixes the detected race.
Fixes#534
* Remove the listener and packetconn from Server
There does not seem a need to store the listener and packetconn again
in the Server structure. The dns.Servers already has access to them
and can also shutdown the handlers.
* core: make coredns.Server a caddy.GracefulServer
We needed to also implement the Address() method.
Fixes: #519
* Add compile time check if we implement caddy.GracefulServer
* Check if we should shutdown
The gRPC server middleware[1] needs access to the Server object
in order to push the unpacked Msg through the normal middleware
pipeline. These are the changes to core needed to make that
possible.
[1] https://github.com/infobloxopen/coredns-grpc
* 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
The DS record is handled specially in the server ServeDNS mux, but there
was no code that actually called the correct middleware handler chain
when encountering a DS.
This PR fixes that behavoir, additonal bugs has been files to look into
how we are handling delegation (secure and non-secure ones).
For some reasons there was a dnsserver/middleware.go that defined
the middleware handlers. This code was a repeat from
middleware/middleware.go. Removed dnsserver/middleware.go and replaced
all uses of dnsserver.Middleware with middleware.Middleware.
Added dnsserver/address_test.go to test the zone normalization (and to
improve the test coverage). The deleted file will also improve the test
coverage :)
When no Corefile is given, default to loading the whoami middleware on
the default port (2053). Also add back the -port flag that allows you
to override the default port.
Further cleanup the startup messages and use caddy's OnStartupComplete()
to blurp out which zones and ports we have. These can be suppressed
with the -quiet flag.
Normal startup:
miek.nl.:1053
miek.nl2.:1053
example.org.:1054
2016/09/17 20:41:19 [INFO] CoreDNS-001 starting
CoreDNS-001 starting
with the -quiet flag:
2016/09/17 20:41:34 [INFO] CoreDNS-001 starting
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
* Set version to 001
* Remove k8stest, test fails is k8s is not there: touch luck
* Remove server directory: not used anymore
* Disable k8s test (for now)
* gometalinter changes
* 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.