taprw

package
v1.0.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 22, 2018 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package taprw takes a query and intercepts the response. It will log both after the response is written.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ResponseWriter

type ResponseWriter struct {
	Query *dns.Msg
	dns.ResponseWriter
	Tapper

	Send *SendOption
	// contains filtered or unexported fields
}

ResponseWriter captures the client response and logs the query to dnstap. Single request use. SendOption configures Dnstap to selectively send Dnstap messages. Default is send all.

func (ResponseWriter) DnstapError

func (w ResponseWriter) DnstapError() error

DnstapError check if a dnstap error occurred during Write and returns it.

func (*ResponseWriter) SetQueryEpoch

func (w *ResponseWriter) SetQueryEpoch()

SetQueryEpoch sets the query epoch as reported by dnstap.

func (*ResponseWriter) WriteMsg

func (w *ResponseWriter) WriteMsg(resp *dns.Msg) (writeErr error)

WriteMsg writes back the response to the client and THEN works on logging the request and response to dnstap. Dnstap errors are to be checked by DnstapError.

type SendOption

type SendOption struct {
	Cq bool
	Cr bool
}

SendOption stores the flag to indicate whether a certain DNSTap message to be sent out or not.

type Tapper

type Tapper interface {
	TapMessage(m *tap.Message) error
	TapBuilder() msg.Builder
}

Tapper is what ResponseWriter needs to log to dnstap.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL