plugin/dnstap: remove custom encoder (#4242)

* 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 #4238
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>
This commit is contained in:
Miek Gieben
2020-11-03 15:31:34 +01:00
committed by GitHub
parent f286a24b4e
commit a136b7128b
8 changed files with 130 additions and 256 deletions

View File

@@ -9,8 +9,8 @@
dnstap is a flexible, structured binary log format for DNS software; see https://dnstap.info. With this
plugin you make CoreDNS output dnstap logging.
Note that there is an internal buffer, so expect at least 13 requests before the server sends its
dnstap messages to the socket.
Every message is sent to the socket as soon as it comes in, the *dnstap* plugin has a buffer of
10000 messages, above that number dnstap messages will be dropped (this is logged).
## Syntax
@@ -100,5 +100,5 @@ func (x RandomPlugin) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns
## See Also
The website [dnstap.info](https://dnstap.info) has info on the dnstap protocol.
The *forward* plugin's `dnstap.go` uses dnstap to tap messages sent to an upstream.
The website [dnstap.info](https://dnstap.info) has info on the dnstap protocol. The *forward*
plugin's `dnstap.go` uses dnstap to tap messages sent to an upstream.