redisc

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2022 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// Success is the class for caching positive caching.
	Success = "success"
	// Denial is the class defined for negative caching.
	Denial = "denial"
)

Variables

This section is empty.

Functions

func Add

func Add(p *pool.Pool, key string, m *dns.Msg, duration time.Duration) error

Add adds the message m under k in Redis.

func FromString

func FromString(s string, ttl int) *dns.Msg

FromString converts s back into a DNS message.

func Get

func Get(p *pool.Pool, key string) (*dns.Msg, error)

Get returns the message under key from Redis.

func ToString

func ToString(m *dns.Msg) string

ToString converts the message m to a bsae64 encoded string.

Types

type Redis

type Redis struct {
	Next  plugin.Handler
	Zones []string

	DontUseHash bool
	// contains filtered or unexported fields
}

Redis is plugin that looks up responses in a cache and caches replies. It has a success and a denial of existence cache.

func New

func New() *Redis

New returns an new initialized Redis.

func (*Redis) Name

func (re *Redis) Name() string

Name implements the Handler interface.

func (*Redis) ServeDNS

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

ServeDNS implements the plugin.Handler interface.

type ResponseWriter

type ResponseWriter struct {
	dns.ResponseWriter

	*Redis

	DontUseHash bool
	// contains filtered or unexported fields
}

ResponseWriter is a response writer that caches the reply message in Redis.

func (*ResponseWriter) Write

func (w *ResponseWriter) Write(buf []byte) (int, error)

Write implements the dns.ResponseWriter interface.

func (*ResponseWriter) WriteMsg

func (w *ResponseWriter) WriteMsg(res *dns.Msg) error

WriteMsg implements the dns.ResponseWriter interface.

Jump to

Keyboard shortcuts

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