diff options
author | 2020-11-03 15:31:34 +0100 | |
---|---|---|
committer | 2020-11-03 06:31:34 -0800 | |
commit | a136b7128b7113c79a971dc8ed728e73cd37420b (patch) | |
tree | d5e9a77f6c253d4a7bf55c239807cb4ae793c984 /plugin/dnstap/setup_test.go | |
parent | f286a24b4e2c8027b9045b4fb36f92ecf5ed33f1 (diff) | |
download | coredns-a136b7128b7113c79a971dc8ed728e73cd37420b.tar.gz coredns-a136b7128b7113c79a971dc8ed728e73cd37420b.tar.zst coredns-a136b7128b7113c79a971dc8ed728e73cd37420b.zip |
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>
Diffstat (limited to 'plugin/dnstap/setup_test.go')
-rw-r--r-- | plugin/dnstap/setup_test.go | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/plugin/dnstap/setup_test.go b/plugin/dnstap/setup_test.go index 8fad9cd39..129107efd 100644 --- a/plugin/dnstap/setup_test.go +++ b/plugin/dnstap/setup_test.go @@ -8,16 +8,16 @@ import ( func TestConfig(t *testing.T) { tests := []struct { - file string - path string - full bool - socket bool - fail bool + file string + path string + full bool + proto string + fail bool }{ - {"dnstap dnstap.sock full", "dnstap.sock", true, true, false}, - {"dnstap unix://dnstap.sock", "dnstap.sock", false, true, false}, - {"dnstap tcp://127.0.0.1:6000", "127.0.0.1:6000", false, false, false}, - {"dnstap", "fail", false, true, true}, + {"dnstap dnstap.sock full", "dnstap.sock", true, "unix", false}, + {"dnstap unix://dnstap.sock", "dnstap.sock", false, "unix", false}, + {"dnstap tcp://127.0.0.1:6000", "127.0.0.1:6000", false, "tcp", false}, + {"dnstap", "fail", false, "tcp", true}, } for _, c := range tests { cad := caddy.NewTestController("dns", c.file) @@ -26,7 +26,7 @@ func TestConfig(t *testing.T) { if err == nil { t.Errorf("%s: %s", c.file, err) } - } else if err != nil || conf.target != c.path || conf.full != c.full || conf.socket != c.socket { + } else if err != nil || conf.target != c.path || conf.full != c.full || conf.proto != c.proto { t.Errorf("Expected: %+v\nhave: %+v\nerror: %s", c, conf, err) } } |