forwarder

package
v0.18.1 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NUM_WORKERS          = 4
	SNAPSHOT_BUFFER_SIZE = 1024
)
View Source
const CACHE_UPDATE_BUFFER_SIZE = 10_000

Variables

This section is empty.

Functions

func NewCacheReaperCronJob

func NewCacheReaperCronJob(dispatcher *DNSDispatcher) cron.Job

func ShouldLog

func ShouldLog(err error) bool

Types

type CacheReaper

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

func (*CacheReaper) Run

func (job *CacheReaper) Run()

type DNSCache

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

func NewDNSCache

func NewDNSCache(maxSize int, logger *slog.Logger) *DNSCache

func (*DNSCache) Close

func (dc *DNSCache) Close()

func (*DNSCache) DeleteExpired

func (dc *DNSCache) DeleteExpired()

func (*DNSCache) Get

func (dc *DNSCache) Get(key string) ([]dns.RR, bool)

func (*DNSCache) Len

func (dc *DNSCache) Len() int

func (*DNSCache) OnDrop

func (dc *DNSCache) OnDrop(fn func())

func (*DNSCache) Set

func (dc *DNSCache) Set(key string, values []dns.RR, ttl time.Duration)

func (*DNSCache) Stat

func (dc *DNSCache) Stat() cache.Stats

type DNSCheck

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

func (*DNSCheck) Name

func (d *DNSCheck) Name() string

func (*DNSCheck) Pass

func (d *DNSCheck) Pass() bool

type DNSDispatcher

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

func NewDNSDispatcher

func NewDNSDispatcher(
	cache *DNSCache,
	dnsMetrics *metrics.DnsMetrics,
	dnsClient *RoundRobinClient,
	blockLists []*blocklist.BlockList,
	noiseFilter *noisefilter.NoiseFilter,
	broadcaster *sse.Broadcaster,
	ttlFloor time.Duration,
	logger *slog.Logger,
	enableECS bool,
) (*DNSDispatcher, error)

func (*DNSDispatcher) Close

func (d *DNSDispatcher) Close()

func (*DNSDispatcher) GetBroadcaster added in v0.6.0

func (d *DNSDispatcher) GetBroadcaster() *sse.Broadcaster

func (*DNSDispatcher) HandleDNSRequest

func (d *DNSDispatcher) HandleDNSRequest(source DNSSource) DispatcherFunc

type DNSSource

type DNSSource string
const (
	SourceUDP DNSSource = "UDP"
	SourceTCP DNSSource = "TCP"
	SourceDoT DNSSource = "DoT"
	SourceDoH DNSSource = "DoH"
)

type DispatcherFunc

type DispatcherFunc func(writer dns.ResponseWriter, req *dns.Msg)

type QuestionResolution added in v0.13.0

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

type RcodeError

type RcodeError struct {
	Rcode int
	Err   error
}

func (*RcodeError) Error

func (e *RcodeError) Error() string

func (*RcodeError) ShouldLog

func (e *RcodeError) ShouldLog() bool

func (*RcodeError) Unwrap

func (e *RcodeError) Unwrap() error

type RequestContext

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

type RoundRobinClient

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

func NewRoundRobinClient

func NewRoundRobinClient(metrics *metrics.DnsMetrics, readTimeout, writeTimeout, dialTimeout time.Duration, logger *slog.Logger, upstreams ...string) (*RoundRobinClient, error)

func (*RoundRobinClient) Exchange

func (r *RoundRobinClient) Exchange(msg *dns.Msg) (*dns.Msg, string, error)

func (*RoundRobinClient) Healthchecks

func (r *RoundRobinClient) Healthchecks() []checks.Check

Jump to

Keyboard shortcuts

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