Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNilRR = errors.New("is nil")
ErrNilRR is returned when a parsed RR is nil.
Functions ¶
func AddMessagesToReply ¶
AddMessagesToReply creates information resource records using MakeMessageRecord and immediately adds them to the extra section of the given reply. If an error occurs, the resource record will not be added, and the error will be logged.
Types ¶
type RRProvider ¶
type RRProvider interface { // GetExtraRRs is called when a DNS response to a DNS message is // crafted because the request is either denied or blocked. GetExtraRRs(ctx context.Context, request *dns.Msg) []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(ctx context.Context, request *dns.Msg) *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 ¶
ResponderFunc is a convenience type to use a function directly as a Responder.
func BlockIP ¶
func BlockIP(msgs ...string) ResponderFunc
BlockIP is a ResponderFunc than replies with either 0.0.0.17 or ::17 for each A or AAAA question respectively. If there is no A or AAAA question, it defaults to replying with NXDomain.
func Localhost ¶
func Localhost(msgs ...string) ResponderFunc
Localhost is a ResponderFunc than replies with localhost IP addresses. If there is no A or AAAA question, it defaults to replying with NXDomain.
func NxDomain ¶
func NxDomain(msgs ...string) ResponderFunc
NxDomain returns a ResponderFunc that replies with NXDOMAIN.
func Refused ¶
func Refused(msgs ...string) ResponderFunc
Refused returns a ResponderFunc that replies with REFUSED.
func ServerFailure ¶
func ServerFailure(msgs ...string) ResponderFunc
ServerFailure returns a ResponderFunc that replies with SERVFAIL.
func ZeroIP ¶
func ZeroIP(msgs ...string) ResponderFunc
ZeroIP is a ResponderFunc than replies with either 0.0.0.0 or :: for each A or AAAA question respectively. If there is no A or AAAA question, it defaults to replying with NXDomain.
func (ResponderFunc) MarshalJSON ¶
func (rf ResponderFunc) MarshalJSON() ([]byte, error)
MarshalJSON disables JSON marshaling for ResponderFunc.
func (ResponderFunc) ReplyWithDNS ¶
ReplyWithDNS implements the Responder interface and calls rf.