Commit graph

10 commits

Author SHA1 Message Date
Miek Gieben
123da4c844
plugin/dnstap: remove config struct ()
* plugin/dnstap: remove config struct

this struct is an uneeded intermidiate to get a dnstap it can be
removed. Remove the dnstapio subpkg: it's also not needed. Make *many*
functions and structs private now that we can.

Signed-off-by: Miek Gieben <miek@miek.nl>

* correct logging

Signed-off-by: Miek Gieben <miek@miek.nl>
2020-11-05 14:37:16 +01:00
Miek Gieben
a136b7128b
plugin/dnstap: remove custom encoder ()
* plugin/dnstap: remove encoder*.go

Those files reimplemented parts of the dnstap spec, we can just use the
dnstap functions for that. This leaves all the queuing that is enabled
and drops messages if the dnstap reader can't keep up. In the new code
flush() would never return an error (at least I couldn't make it do so),
so the reconnect functionally is moved to kick off when we get write
errors.

Some smaller cosmetic changes as well, `d.socket` is now `proto`, which
makes the dial() function smaller.

Total testing time is now <1s (which was the impetus to look into this
plugin *again*).

See 
The buffered channel needs to be sized correctly, as we may need to do
some queing if the dnstap reader can't keep up.

Signed-off-by: Miek Gieben <miek@miek.nl>

* add missing file

Signed-off-by: Miek Gieben <miek@miek.nl>

* update doc on queing

Signed-off-by: Miek Gieben <miek@miek.nl>
2020-11-03 06:31:34 -08:00
Miek Gieben
b3b8a7e4b7
plugin/dnstap: various cleanups ()
* plugin/dnstap: various cleanups

A recent issue made me look into this plugin, I suspect various other
cleanups (hopefully deletion of code) can be made as well

Remove identical functions ToClientQuery etc, and just use tap.Message
as the base type in plugin. Keep msg/ for a few helper functions that
may proof useful.

This remove the whole test directory as we will just check the things we
are interested in which gives much better feedback and keeps that code
closer together.

tapwr dir is also not needed, writer_test.go was just duplicating the
tests already done. This moves writer.go to the top directory.

Make the only user of dnstap, the forward plugin, use the newer code
also remove the test, a better test there would be a full e2e test to
see the correct thing happens.

Cleanup the Tapper interface and move it to dnstapio where it belongs,
remove higher level interfaces that are not used. This remove
dnstap.Tapper and dnstap.IORoutines.

Use the standard mechanism for getting access to a plugin and remove
shuffling the plugin into the context.

Signed-off-by: Miek Gieben <miek@miek.nl>

* use opts to get the correct proto

Signed-off-by: Miek Gieben <miek@miek.nl>

* Various fixes

Signed-off-by: Miek Gieben <miek@miek.nl>

* Remove bad addr test, as dnstap is only called from within coredns where these fields have been preparsed

Signed-off-by: Miek Gieben <miek@miek.nl>

* dnstap: remove saving the error

all these fields have been preparsed, no need for dnstap to be pedantic
and check (and save!) this error again.

Simplifies it a bit more.

Signed-off-by: Miek Gieben <miek@miek.nl>

* Update plugin/forward/dnstap.go

Co-authored-by: Ruslan Drozhdzh <30860269+rdrozhdzh@users.noreply.github.com>

* Code review

Signed-off-by: Miek Gieben <miek@miek.nl>

* add back in preferUDP

Signed-off-by: Miek Gieben <miek@miek.nl>

* nit

Signed-off-by: Miek Gieben <miek@miek.nl>

Co-authored-by: Ruslan Drozhdzh <30860269+rdrozhdzh@users.noreply.github.com>
2020-10-12 19:10:35 +02:00
Yong Tang
a34d564c07 Remove trailing whitespace as otherwise make check fails ()
This PR removes trailing whitespace as otherwise `make check` fails

This PR fixes 3513

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2019-12-07 15:47:18 +00:00
Zou Nengren
13fca02316 use pkg/reuseport in rest plugins ()
Automatically submitted.
2019-12-06 10:55:40 +00:00
Miek Gieben
643550eabe presubmit: check for uppercase ()
Another thing we can test automatically, we sorta settled on using an
uppercase letter in in t.Log and t.Fatal calls.

Let's just check for this.
2018-05-07 23:47:25 +02:00
Uladzimir Trehubenka
861e2382c2 Added reconnect feature for dnstap plugin () 2017-12-01 11:16:14 +00:00
Uladzimir Trehubenka
6d6e1357b9 Dnstap plugin refactoring () 2017-11-27 21:36:14 +00:00
varyoo
45b0252c1a plugin/dnstap: don't spam Travis + valid dnstap payload ()
* don't spam Travis + valid dnstap payload

* log instead of fmt

* Revert "log instead of fmt"

This reverts commit 88f09c3939.

* log the right way

* log the final way

* minor enhancements
2017-09-29 20:29:33 +01:00
varyoo
daf8ef0da8 Adds the dnstap I/O routines and should fix some issues ()
* adds the dnstap I/O thread and should fix a lot of mistakes

* docs

* -race test

* oops

* docs
2017-09-26 11:45:33 -04:00