ecscache

package
v0.0.0-...-b6e3791 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2024 License: AGPL-3.0 Imports: 20 Imported by: 0

Documentation

Overview

Package ecscache implements a EDNS Client Subnet (ECS) aware DNS cache that can be used as a dnsserver.Middleware.

Index

Constants

This section is empty.

Variables

View Source
var FakeECSFQDNs = map[string]struct{}{}/* 8343 elements not displayed */

FakeECSFQDNs contains all domains that indicate ECS support, but in fact don't have one.

Functions

This section is empty.

Types

type Middleware

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

Middleware is a dnsserver.Middleware with ECS-aware caching.

func NewMiddleware

func NewMiddleware(c *MiddlewareConfig) (m *Middleware)

NewMiddleware initializes a new ECS-aware LRU caching middleware. c must not be nil.

func (*Middleware) Wrap

func (mw *Middleware) Wrap(h dnsserver.Handler) (wrapped dnsserver.Handler)

Wrap implements the dnsserver.Middleware interface for *Middleware.

type MiddlewareConfig

type MiddlewareConfig struct {
	// Cloner is used to clone messages taken from cache.
	Cloner *dnsmsg.Cloner

	// GeoIP is the GeoIP database used to get subnets for countries.  It must
	// not be nil.
	GeoIP geoip.Interface

	// MinTTL is the minimum supported TTL for cache items.
	MinTTL time.Duration

	// Size is the number of entities to hold in the cache for hosts that don't
	// support ECS.  It must be greater than zero.
	Size int

	// ECSSize is the number of entities to hold in the cache for hosts that
	// support ECS.  It must be greater than zero.
	ECSSize int

	// UseTTLOverride shows if the TTL overrides logic should be used.
	UseTTLOverride bool
}

MiddlewareConfig is the configuration structure for NewMiddleware.

Jump to

Keyboard shortcuts

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