dnsrecorder

package
v0.0.0-...-71af635 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2016 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package dnsrecorder allows you to record a DNS response when it is send to the client.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Recorder

type Recorder struct {
	dns.ResponseWriter
	Rcode int
	Size  int
	Msg   *dns.Msg
	Start time.Time
}

Recorder is a type of ResponseWriter that captures the rcode code written to it and also the size of the message written in the response. A rcode code does not have to be written, however, in which case 0 must be assumed. It is best to have the constructor initialize this type with that default status code.

func New

func New(w dns.ResponseWriter) *Recorder

New makes and returns a new Recorder, which captures the DNS rcode from the ResponseWriter and also the length of the response message written through it.

func (*Recorder) Hijack

func (r *Recorder) Hijack()

Hijack implements dns.Hijacker. It simply wraps the underlying ResponseWriter's Hijack method if there is one, or returns an error.

func (*Recorder) Write

func (r *Recorder) Write(buf []byte) (int, error)

Write is a wrapper that records the size of the message that gets written.

func (*Recorder) WriteMsg

func (r *Recorder) WriteMsg(res *dns.Msg) error

WriteMsg records the status code and calls the underlying ResponseWriter's WriteMsg method.

Jump to

Keyboard shortcuts

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