sdns: github.com/semihalev/sdns/middleware Index | Files | Directories

package middleware

import "github.com/semihalev/sdns/middleware"

Index

Package Files

chain.go middleware.go response_writer.go

func List Uses

func List() (list []string)

List return names of handlers

func LoadExternalPlugins Uses

func LoadExternalPlugins()

LoadExternalPlugins load external plugins into chain

func Ready Uses

func Ready() bool

Ready return true if middleware setup was done

func Register Uses

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

Register a middleware

func RegisterAt Uses

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

RegisterAt a middleware at an index

func RegisterBefore Uses

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

RegisterBefore a middleware before another middleware

func Setup Uses

func Setup(cfg *config.Config)

Setup handlers

type Chain Uses

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

Chain type

func NewChain Uses

func NewChain(handlers []Handler) *Chain

NewChain return new fresh chain

func (*Chain) Cancel Uses

func (ch *Chain) Cancel()

Cancel next calls

func (*Chain) CancelWithRcode Uses

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

CancelWithRcode next calls with rcode

func (*Chain) Next Uses

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

Next call next dns handler in the chain

func (*Chain) Reset Uses

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

Reset the chain variables

type Handler Uses

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

Handler interface

func Get Uses

func Get(name string) Handler

Get return a handler by name

func Handlers Uses

func Handlers() []Handler

Handlers return registered handlers

type ResponseWriter Uses

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

PathSynopsis
accesslist
accesslog
as112
blocklist
cache
chaos
edns
failover
hostsfile
metrics
ratelimit
recovery
resolver

Package middleware imports 9 packages (graph) and is imported by 17 packages. Updated 2020-10-28. Refresh now. Tools for package owners.