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

@ -12,12 +12,9 @@ import (
"github.com/miekg/dns"
)
func testRequest(t *testing.T, expected Data, r request.Request) {
d := Data{}
if err := d.RemoteAddr(r.W.RemoteAddr()); err != nil {
t.Fail()
return
}
func testRequest(t *testing.T, expected Builder, r request.Request) {
d := Builder{}
d.Addr(r.W.RemoteAddr())
if d.SocketProto != expected.SocketProto ||
d.SocketFam != expected.SocketFam ||
!reflect.DeepEqual(d.Address, expected.Address) ||
@ -27,7 +24,7 @@ func testRequest(t *testing.T, expected Data, r request.Request) {
}
}
func TestRequest(t *testing.T) {
testRequest(t, Data{
testRequest(t, Builder{
SocketProto: tap.SocketProtocol_UDP,
SocketFam: tap.SocketFamily_INET,
Address: net.ParseIP("10.240.0.1"),