cache

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AcquireMsg added in v1.0.0

func AcquireMsg() *dns.Msg

AcquireMsg returns an empty msg from pool

func ReleaseMsg added in v1.0.0

func ReleaseMsg(m *dns.Msg)

ReleaseMsg returns msg to pool

Types

type Cache

type Cache struct {
	// contains filtered or unexported fields
}

Cache type

func New

func New(cfg *config.Config) *Cache

New return cache

func (*Cache) Name

func (c *Cache) Name() string

Name return middleware name

func (*Cache) ServeDNS

func (c *Cache) ServeDNS(ctx context.Context, ch *middleware.Chain)

ServeDNS implements the Handle interface.

func (*Cache) Set

func (c *Cache) Set(key uint64, msg *dns.Msg)

Set adds a new element to the cache. If the element already exists it is overwritten.

type ResponseWriter

type ResponseWriter struct {
	middleware.ResponseWriter

	*Cache
}

ResponseWriter implement of ctx.ResponseWriter

func (*ResponseWriter) WriteMsg

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

WriteMsg implements the ctx.ResponseWriter interface

Jump to

Keyboard shortcuts

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