bogus

package module
v0.0.0-...-5697a08 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2020 License: GPL-3.0 Imports: 11 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

bogus

Name

bogus - return NXDOMAIN directly if the resovled IP is in the bogus list.

Description

bogus takes a list of IP address and returns NXDOMAIN for any resolved address under them instead of return the bogus IP address.

Put bogus beside rewrite in plugin.cfg.

Syntax

bogus BOGUS_IPs......

Examples

. {
    bogus 10.255.10.1 10.255.10.2 10.255.20.1 10.255.20.2
    whoami
}

Bugs

The list of IP address is just a slice that is traversed, meaning this plugin will get slow when a lof of IP address are to be bogus.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	HitsCount = promauto.NewCounterVec(prometheus.CounterOpts{
		Namespace: plugin.Namespace,
		Subsystem: "bogus",
		Name:      "hits_count_total",
		Help:      "Counter of hits bogus.",
	}, []string{"to"})
)

Variables declared for monitoring.

Functions

This section is empty.

Types

type N

type N struct {
	Next plugin.Handler
	// contains filtered or unexported fields
}

N implements the plugin interface.

func (N) Name

func (n N) Name() string

Name implements the Handler interface.

func (N) ServeDNS

func (n N) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error)

ServeDNS implements the plugin.Handler interface.

type ResponseReverter

type ResponseReverter struct {
	dns.ResponseWriter
	// contains filtered or unexported fields
}

ResponseReverter reverses the operations done on the question section of a packet. This is need because the client will otherwise disregards the response, i.e. dig will complain with ';; Question section mismatch: got example.org/HINFO/IN'

func NewResponseReverter

func NewResponseReverter(w dns.ResponseWriter, r *dns.Msg, bogus []net.IP) *ResponseReverter

NewResponseReverter returns a pointer to a new ResponseReverter.

func (*ResponseReverter) Write

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

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

func (*ResponseReverter) WriteMsg

func (r *ResponseReverter) 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
⌂ 换网址