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

    func LoadExternalPlugins()

      LoadExternalPlugins load external plugins into chain

      func Ready

      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

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

            RegisterAt a middleware at an index

            func RegisterBefore

            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

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

                  Chain type

                  func NewChain

                  func NewChain(handlers []Handler) *Chain

                    NewChain return new fresh chain

                    func (*Chain) Cancel

                    func (ch *Chain) Cancel()

                      Cancel next calls

                      func (*Chain) CancelWithRcode

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

                        CancelWithRcode next calls with rcode

                        func (*Chain) Next

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

                          Next call next dns handler in the chain

                          func (*Chain) Reset

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

                            Reset the chain variables

                            type Handler

                            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

                                  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