nsutil

package
v0.4.17 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2020 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RRProvider

type RRProvider interface {
	// GetExtraRR is called when a DNS response to a DNS message is
	// crafted because the request is either denied or blocked.
	GetExtraRR(query *dns.Msg, reason string, reasonCtx interface{}) []dns.RR
}

RRProvider defines the interface that any block/deny reason interface may implement to support adding additional DNS resource records to the DNS responses extra (additional) section.

type Responder

type Responder interface {
	// ReplyWithDNS is called when a DNS response to a DNS message is
	// crafted because the request is either denied or blocked.
	ReplyWithDNS(query *dns.Msg, reason string, reasonCtx interface{}) *dns.Msg
}

Responder defines the interface that any block/deny reason interface may implement to support sending custom DNS responses for a given reason. That is, if a reason context implements the Responder interface the ReplyWithDNS method will be called instead of creating the default zero-ip response.

type ResponderFunc

type ResponderFunc func(query *dns.Msg, reason string, reasonCtx interface{}) *dns.Msg

ResponderFunc is a convenience type to use a function directly as a Responder.

func NxDomain

func NxDomain() ResponderFunc

NxDomain returns a ResponderFunc that replies with NXDOMAIN.

func Refused

func Refused() ResponderFunc

Refused returns a ResponderFunc that replies with REFUSED.

func ServeFail

func ServeFail() ResponderFunc

ServeFail returns a ResponderFunc that replies with SERVFAIL.

func ZeroIP

func ZeroIP() ResponderFunc

ZeroIP is a ResponderFunc than replies with either 0.0.0.0 or :: for each A or AAAA question respectively.

func (ResponderFunc) ReplyWithDNS

func (rf ResponderFunc) ReplyWithDNS(query *dns.Msg, reason string, reasonCtx interface{}) *dns.Msg

ReplyWithDNS implements the Responder interface and calls rf.

Jump to

Keyboard shortcuts

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