middleware

package
v1.1.8 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2021 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func List

func List() (list []string)

List return names of handlers

func LoadExternalPlugins added in v1.1.0

func LoadExternalPlugins()

LoadExternalPlugins load external plugins into chain

func Ready added in v1.1.0

func Ready() bool

Ready return true if middleware setup was done

func Register

func Register(name string, new func(*config.Config) Handler)

Register a middleware

func RegisterAt added in v1.1.0

func RegisterAt(name string, new func(*config.Config) Handler, idx int)

RegisterAt a middleware at an index

func RegisterBefore added in v1.1.0

func RegisterBefore(name string, new func(*config.Config) Handler, before string)

RegisterBefore a middleware before another middleware

func Setup

func Setup(cfg *config.Config)

Setup handlers

Types

type Chain added in v1.1.0

type Chain struct {
	Writer  ResponseWriter
	Request *dns.Msg
	// contains filtered or unexported fields
}

Chain type

func NewChain added in v1.1.0

func NewChain(handlers []Handler) *Chain

NewChain return new fresh chain

func (*Chain) Cancel added in v1.1.0

func (ch *Chain) Cancel()

Cancel next calls

func (*Chain) CancelWithRcode added in v1.1.7

func (ch *Chain) CancelWithRcode(rcode int, do bool)

CancelWithRcode next calls with rcode

func (*Chain) Next added in v1.1.0

func (ch *Chain) Next(ctx context.Context)

Next call next dns handler in the chain

func (*Chain) Reset added in v1.1.0

func (ch *Chain) Reset(w dns.ResponseWriter, r *dns.Msg)

Reset the chain variables

type Handler added in v1.1.0

type Handler interface {
	Name() string
	ServeDNS(context.Context, *Chain)
}

Handler interface

func Get

func Get(name string) Handler

Get return a handler by name

func Handlers

func Handlers() []Handler

Handlers return registered handlers

type ResponseWriter added in v1.1.0

type ResponseWriter interface {
	dns.ResponseWriter
	Msg() *dns.Msg
	Rcode() int
	Written() bool
	Reset(dns.ResponseWriter)
	Proto() string
	RemoteIP() net.IP
	Internal() bool
}

ResponseWriter implement of dns.ResponseWriter

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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