Adds the dnstap I/O routines and should fix some issues (#1083)
* adds the dnstap I/O thread and should fix a lot of mistakes * docs * -race test * oops * docs
This commit is contained in:
parent
2a32cd4159
commit
daf8ef0da8
7 changed files with 164 additions and 22 deletions
|
@ -16,11 +16,15 @@ import (
|
|||
// Dnstap is the dnstap handler.
|
||||
type Dnstap struct {
|
||||
Next plugin.Handler
|
||||
Out io.Writer
|
||||
IO IORoutine
|
||||
Pack bool
|
||||
}
|
||||
|
||||
type (
|
||||
// IORoutine is the dnstap I/O thread as defined by: <http://dnstap.info/Architecture>.
|
||||
IORoutine interface {
|
||||
Dnstap(tap.Dnstap)
|
||||
}
|
||||
// Tapper is implemented by the Context passed by the dnstap handler.
|
||||
Tapper interface {
|
||||
TapMessage(*tap.Message) error
|
||||
|
@ -49,7 +53,8 @@ func tapMessageTo(w io.Writer, m *tap.Message) error {
|
|||
|
||||
// TapMessage implements Tapper.
|
||||
func (h Dnstap) TapMessage(m *tap.Message) error {
|
||||
return tapMessageTo(h.Out, m)
|
||||
h.IO.Dnstap(msg.Wrap(m))
|
||||
return nil
|
||||
}
|
||||
|
||||
// TapBuilder implements Tapper.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue