mirror of
https://github.com/coredns/coredns.git
synced 2025-11-02 02:03:13 -05:00
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:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user