recorder

package module
v0.0.0-...-a0695a9 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2019 License: MPL-2.0 Imports: 6 Imported by: 0

README

Build Status codecov GitHub version GitHub issues GitHub pull requests Go Report Card

CoreDNS recorder

This CoreDNS plugin implements a dns.ResponseWriter that records the message that was sent through it's chain. This is useful only if you need to access readonly data for what was sent back to the user.

There is no configuration for this plugin at this time, super simple and easy implementation to add for your plugins.

For reference use, please see my other pluging dns logging

Documentation

Index

Constants

View Source
const PluginName string = "recorder"

PluginName is the name of our plugin

Variables

This section is empty.

Functions

This section is empty.

Types

type Recorder

type Recorder struct {
	Next plugin.Handler
}

Recorder is the 'logic' for enabling the recording of our message

func (Recorder) Name

func (rec Recorder) Name() string

Name is the name of our plugin

func (Recorder) ServeDNS

func (rec Recorder) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (rc int, err error)

ServeDNS just creates a new recorer writer and then chains that down to the next plugin

type RecorderWriter

type RecorderWriter struct {
	// contains filtered or unexported fields
}

RecorderWriter encapsulates the response that is written to the response writer, allows later plugins to access data after sending response back to the user

func NewRecorderWriter

func NewRecorderWriter(w dns.ResponseWriter) *RecorderWriter

NewRecorderWriter automagically creates a recorder instance with the underlying writer backing it for most of it's operations

func (*RecorderWriter) Close

func (recw *RecorderWriter) Close() error

Close just facades the underlying Close call

func (*RecorderWriter) Hijack

func (recw *RecorderWriter) Hijack()

Hijack just facades the underlying hijack call

func (*RecorderWriter) LocalAddr

func (recw *RecorderWriter) LocalAddr() net.Addr

LocalAddr just facades the underlying LocalAddr call

func (*RecorderWriter) Msg

func (recw *RecorderWriter) Msg() *dns.Msg

Msg returns the message that has already been sent

func (*RecorderWriter) RemoteAddr

func (recw *RecorderWriter) RemoteAddr() net.Addr

RemoteAddr just facades the underlying RemoteAddr call

func (*RecorderWriter) TsigStatus

func (recw *RecorderWriter) TsigStatus() error

TsigStatus just facades the underlying TsigStatus call

func (*RecorderWriter) TsigTimersOnly

func (recw *RecorderWriter) TsigTimersOnly(b bool)

TsigTimersOnly just facades the underlying TsigTimersOnly call

func (*RecorderWriter) Write

func (recw *RecorderWriter) Write(b []byte) (i int, err error)

Write just facades the underlying Write call

func (*RecorderWriter) WriteMsg

func (recw *RecorderWriter) WriteMsg(res *dns.Msg) error

WriteMsg both records the message, and facades the underlying writemsg call

Jump to

Keyboard shortcuts

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