dnscache

package
v1.8.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package dnscache provides process-wide cached DNS lookups: PTR records, forward (A/AAAA) records, and forward-confirmed reverse DNS (FCrDNS) composed from the two. Results — including failures — are cached in a shared LRU, and concurrent lookups for the same key coalesce via singleflight, so a given DNS fact costs at most one query per TTL.

Consumers: the parser's reverse_dns enricher (PTR only) and the MatchKnownBot expr helper (FCrDNS).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Configure

func Configure(posTTL time.Duration, negTTL time.Duration, size int)

func ForwardConfirmedNames

func ForwardConfirmedNames(addr netip.Addr) []string

func ForwardIPs

func ForwardIPs(host string) []netip.Addr

func PTRRecords

func PTRRecords(addr netip.Addr) []string

func Purge

func Purge()

func SetResolver

func SetResolver(r Resolver)

Types

type Resolver

type Resolver interface {
	LookupAddr(ctx context.Context, addr string) ([]string, error)
	LookupIPAddr(ctx context.Context, host string) ([]net.IPAddr, error)
}

Resolver is satisfied by *net.Resolver; swapped for a fake in tests.

Jump to

Keyboard shortcuts

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