* Run gostaticheck
Run gostaticcheck on the codebase and fix almost all flagged items.
Only keep
* coremain/run.go:192:2: var appVersion is unused (U1000)
* plugin/chaos/setup.go:54:3: the surrounding loop is unconditionally terminated (SA4004)
* plugin/etcd/setup.go:103:3: the surrounding loop is unconditionally terminated (SA4004)
* plugin/pkg/replacer/replacer.go:274:13: argument should be pointer-like to avoid allocations (SA6002)
* plugin/route53/setup.go:124:28: session.New is deprecated: Use NewSession functions to create sessions instead. NewSession has the same functionality as New except an error can be returned when the func is called instead of waiting to receive an error until a request is made. (SA1019)
* test/grpc_test.go:25:69: grpc.WithTimeout is deprecated: use DialContext and context.WithTimeout instead. Will be supported throughout 1.x. (SA1019)
The first one isn't true, as this is set via ldflags. The rest is
minor. The deprecation should be fixed at some point; I'll file some
issues.
Signed-off-by: Miek Gieben <miek@miek.nl>
* Make sure to plug in the plugins
import the plugins, that file that did this was removed, put it in the
reload test as this requires an almost complete coredns server.
Signed-off-by: Miek Gieben <miek@miek.nl>
* Remove context.Context from request.Request
This removes the context from request.Request and makes all the changes
in the code to make it compile again. It's all mechanical. It did
unearth some weirdness in that the context was kept in handler structs
which may cause havoc with concurrently handling of requests.
Fixes#2721
Signed-off-by: Miek Gieben <miek@miek.nl>
* Make test compile
Signed-off-by: Miek Gieben <miek@miek.nl>
Every plugin needs to deal with EDNS0 and should call Scrub to make a
message fit the client's buffer. Move this functionality into the server
and wrapping the ResponseWriter into a ScrubWriter that handles these
bits for us. Result:
Less code and faster, because multiple chained plugins could all be
calling scrub and SizeAndDo - now there is just one place.
Most tests in file/* and dnssec/* needed adjusting because in those unit
tests you don't see OPT RRs anymore. The DNSSEC signer was also looking
at the returned OPT RR to see if it needed to sign - as those are now
added by the server (and thus later), this needed to change slightly.
Scrub itself still exist (for backward compat reasons), but has been
made a noop. Scrub has been renamed to scrub as it should not be used by
external plugins.
Fixes: #2010
Signed-off-by: Miek Gieben <miek@miek.nl>
* Remove Compress by default
Set Compress = true in Scrub only when the message doesn not fit the
advertized buffer. Doing compression is expensive, so try to avoid it.
Master vs this branch
pkg: github.com/coredns/coredns/plugin/cache
BenchmarkCacheResponse-2 50000 24774 ns/op
pkg: github.com/coredns/coredns/plugin/cache
BenchmarkCacheResponse-2 100000 21960 ns/op
* and make it compile
* global: move to context
Move from golang.org/x/net/context to std lib's context.
Change done with:
for i in $(grep -l '/context' **/*.go); do sed -e 's|golang.org/x/net/context|context|' -i $i; echo $i; done
for i in **/*.go; do goimports -w $i; done
* drop from dns.pb.go as well
With Go 1.9 you *can* include the std lib's context package and nothing
breaks. However we never officially made the move (and grpc also doesn't
ues the std lib's one).
Standardize all plugins on using the extern context package.
Fixes#1466
* Align plugin/template usage and syntax with other plugins
* Use new fallthrough logic in plugin/template
* Use zone name normalization for plugin/template
* Test fallthrough parsing in plugin/template
* Rework scoping of match checks
Most matches are not plugin global but per template. The plugin does only a
very rough check while detailed checks are done per-template.
Per template checks include:
- Zones
- Class/Type
- Regex
- Fallthrough
* Remove trailing `.` from fully qualified domain names
* Register template metrics with zone/class/type instead of regex
* Remove trailing fqdn dot from multiple testcases
* Add a template plugin
The template plugin matches the incoming query by class, type and regex
and templates a response with go templates.
* Fix go style errors
* Fix template README example
* Fix corefile example in plugin/template
* Clarify plugin/template/README.md
Add more details and external links where needed.
* Fix code issues in plugin/template
* Add template metrics
* Add section and template to template plugin metrics
* Fix style / remove extra newline on go imports
* Fix typo in plugin/template/README.md
* Update README.md
I've change the format a bit in a PR that I merged yesterday.
* Add authority section to plugin/template
* Fix naming of incoming query name in plugin/template/README.md
* Fix doc syntax in plugin/template/README.md
* Add authority section to plugin/template/README.md config overview
* Add metric labels to plugin/template/README.md metrics section
* Use request.Request to pass state to the template matcher