* plugin/file: Rename do to walk, cleanup and document
* This renames Do to Walk to be more inline with Go standards. Also make
it return an error instead of a bool.
Also give give walk access to rrs. Alternatively e.m could be
exported, but just access the map of rrs should work as well. Another
alternative would be adding a whole bunch of helper functions, but
those need grab and return the data. Just having access to the rrs
should be easiest for most Walks.
* It adds Type and TypeForWildcard to show the different functions
* *Removes* the identical RR check when inserting; this was only done
for A, AAAA and MX and not finished; removed under the mantra garbage
in garbage out.
* Reuses Types to return all the types in an *tree.Elem
Signed-off-by: Miek Gieben <miek@miek.nl>
* better comments
Signed-off-by: Miek Gieben <miek@miek.nl>
* plugin/file: fix setting ReloadInterval
The reload interval was only correctly set if there was an extra
block for the file. Move this down to set up.
Add test case that fails before, but now works.
Signed-off-by: Miek Gieben <miek@miek.nl>
* layout and use Errorf
Signed-off-by: Miek Gieben <miek@miek.nl>
* replacer: evaluate format once and improve perf by ~3x
This improves the performance of logging by almost 3x and reduces memory
usage by ~8x.
Benchmark results:
benchmark old ns/op new ns/op delta
BenchmarkReplacer-12 644 324 -49.69%
BenchmarkReplacer_CommonLogFormat-12 4228 1471 -65.21%
benchmark old allocs new allocs delta
BenchmarkReplacer-12 8 2 -75.00%
BenchmarkReplacer_CommonLogFormat-12 51 17 -66.67%
benchmark old bytes new bytes delta
BenchmarkReplacer-12 240 48 -80.00%
BenchmarkReplacer_CommonLogFormat-12 3723 446 -88.02%
* replacer: code review comments
* bufPool: document why we use a pointer to a slice
* parseFormat: fix confusing comment
* TestParseFormat_Nodes: rename to TestParseFormatNodes
* replacer: use a value for bufPool instead of a pointer
* replacer: remove comment
* replacer: replace labels with knownLabels
The previous slice of label names is no longer needed.
* log: use ioutil.Discard as write buffer in benchmark
Using a buffer gives unrealistic stats and consumes a large amount of
memory.
* log: lazily check if a msg should be logged
* log: improve variable name
Change 'ok' to the more descriptive 'shouldLog'.
* log: code comments: don't reuse variable
miekg/dns recently became more aggressive in setting TC; anything that's
chopped of a response results in TC. Amend the tests. Disputable if
these TC checks still add something.
Signed-off-by: Miek Gieben <miek@miek.nl>
Ditch our truncation code and use the upstream one in miekg/dns.
This saves code on our end, end upstream is also more efficient as every
RR is Len-ed only once. With our bin-search this is not guaranteed.
Signed-off-by: Miek Gieben <miek@miek.nl>
This fix fixes the `\ No newline at end of file`
in plugin/chaos/zowners.go, by adding `"\n"`
to the end of owners_generate.go.
Also fixes a gofmt issue in plugin/etcd/setup.go
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
This fix updates:
- github.com/miekg/dns to 1.15 (#2947)
- github.com/aws/aws-sdk-go to 1.20.13 (#2953)
- google.golang.org/grpc to 1.22.0 (#2966)
This fix fixes#2947
This fix fixes#2953
This fix fixes#2966
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
* plugin/file: make non-existent file non-fatal
If the zone file being loaded doesn't exist *and* reload is enabled,
just wait the file to pop up in the normal Reload routine.
If reload is set to 0s; we keep this a fatal error on startup. Aslo fix
the ticker in z.Reload(): remove the per second ticks and just use the
reload interval for the ticker.
Brush up the documentation a bit as well.
Fixes: #2951
Signed-off-by: Miek Gieben <miek@miek.nl>
* Stickler and test compile
Signed-off-by: Miek Gieben <miek@miek.nl>
* Remove there too
Signed-off-by: Miek Gieben <miek@miek.nl>
* Cant README test these because zone files dont exist
Signed-off-by: Miek Gieben <miek@miek.nl>
The -cpu flag is a weird one (and copied originally from Caddy), it
basically sets GOMAXPROCS which can be *easily* done by just setting
that environment variable. Also with systemd and containerized env you
set this externally *anyway*, so there is little use to do this again in
the binary.
Also the option's help was confusing (i.e. percentage of what?). Remove
the option and supporting files.
Signed-off-by: Miek Gieben <miek@miek.nl>
Run through the motions; create manual pages. Run go generate for good
measure. Fix typo in Makefile.release while at it.
Signed-off-by: Miek Gieben <miek@miek.nl>
* file: close correctlty after AXFR
Don't hijack, but wait for the writes to be done and then savely close
the connection.
Fixes: #2929
Signed-off-by: Miek Gieben <miek@miek.nl>
* Update comment
Signed-off-by: Miek Gieben <miek@miek.nl>
* file: close correctlty after AXFR (#2943)
apply
Signed-off-by: Miek Gieben <miek@miek.nl>
* Update Caddy to 1.0.1, and update import path
This fix updates caddy to 1.0.1 and also
updates the import path to github.com/caddyserver/caddy
This fix fixes 2959
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
* Also update plugin.cfg
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
* Update and bump zplugin.go
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
`upstream` is not needed as a setting; just set if unconditionally and
remove all documentation and tests for it.
At some point we want remove the hanlding for `upstream` as well and
error out on seeing it.
Signed-off-by: Miek Gieben <miek@miek.nl>
This fixes a long standing bug:
fixes: #1609
Load secondary zones in a go-routine; this required another mutex to
protect some fields; I think those were needded anyway because a
transfer can also happen when we're running; we just didn't have a test
for that situation.
The test had to be changed to wait for the transfer to happen at this is
async now.
Signed-off-by: Miek Gieben <miek@miek.nl>
* added a test for transferring a large zone in file plugin
* avoid hardcoding number of RRs multiple times
* don't do testing.Parallel as suggested.
* applied gofmt -s
* Provide example to utilize k8s_external plugin
The example provides a specific use case of k8s_external and may help others to grasp `k8s_external`'s capabilities.
* Update plugin/k8s_external/README.md
Co-Authored-By: Chris O'Haver <cohaver@infoblox.com>
* Update plugin/k8s_external/README.md
Co-Authored-By: Chris O'Haver <cohaver@infoblox.com>
* add metrics for reload
* documented release process better
* run: Makefile.doc all to push reload doc to man-pages
Signed-off-by: Miek Gieben <miek@miek.nl>
* Run gofmt -s and golint on the codebase
Run golint and fix everythign it flagged (except the context arg
ordering), mostly edits in the rewrite plugin.
Signed-off-by: Miek Gieben <miek@miek.nl>
* ... and ofcourse the test as well
Signed-off-by: Miek Gieben <miek@miek.nl>
* Add 1.5.1 release notes
Prepare for imminent release.
Also list PRs merged in a new section to provide more detail.
Signed-off-by: Miek Gieben <miek@miek.nl>
* Updates after review
Signed-off-by: Miek Gieben <miek@miek.nl>
This fix updates:
- github.com/miekg/dns from 1.1.12 to 1.1.14
- google.golang.org/grpc from 1.21.0 to 1.21.1
- github.com/aws/aws-sdk-go from 1.19.41 to 1.20.3
- github.com/prometheus/common from 0.4.1 to 0.6.0
- gopkg.in/DataDog/dd-trace-go.v1 from 1.14.0 to 1.15.0
This fix fixes#2899
This fix fixes#2900
This fix fixes#2901
This fix fixes#2902
This fix fixes#2903
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>