Easier way to dnstap? (#1496)

* Easier way to dnstap?

* Remove unnecessary function parameter from Tapper

* golint

* golint 2

* Proxy dnstap tests

* README.md & doc

* net.IP

* Proxy test was incorrect

* Small changes

* Update README.md

* Was not reporting dnstap errors + test

* Wasn't working at all, now it's ok

* Thanks Travis
This commit is contained in:
varyoo
2018-03-01 03:19:01 +01:00
committed by Miek Gieben
parent f697b33283
commit 6bb08ffee4
12 changed files with 274 additions and 255 deletions

View File

@@ -17,8 +17,8 @@ type Context struct {
}
// TestingData returns the Data matching coredns/test.ResponseWriter.
func TestingData() (d *msg.Data) {
d = &msg.Data{
func TestingData() (d *msg.Builder) {
d = &msg.Builder{
SocketFam: tap.SocketFamily_INET,
SocketProto: tap.SocketProtocol_UDP,
Address: net.ParseIP("10.240.0.1"),
@@ -68,13 +68,12 @@ type TrapTapper struct {
Full bool
}
// TapMessage adds the message to the trap.
func (t *TrapTapper) TapMessage(m *tap.Message) error {
t.Trap = append(t.Trap, m)
return nil
// Pack returns field Full.
func (t *TrapTapper) Pack() bool {
return t.Full
}
// TapBuilder returns a test msg.Builder.
func (t *TrapTapper) TapBuilder() msg.Builder {
return msg.Builder{Full: t.Full}
// TapMessage adds the message to the trap.
func (t *TrapTapper) TapMessage(m *tap.Message) {
t.Trap = append(t.Trap, m)
}