rdns

package
v0.0.0-...-75a31e8 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package rdns processes reverse DNS lookup queries.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Logger is used for logging the operation of the reverse DNS lookup
	// queries.  It must not be nil.
	Logger *slog.Logger

	// Exchanger resolves IP addresses to domain names.
	Exchanger Exchanger

	// CacheSize is the maximum size of the cache.  It must be greater than
	// zero.
	CacheSize int

	// CacheTTL is the Time to Live duration for cached IP addresses.
	CacheTTL time.Duration
}

Config is the configuration structure for Default.

type Default

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

Default is the default rDNS query processor.

func New

func New(conf *Config) (r *Default)

New returns a new default rDNS query processor. conf must not be nil.

func (*Default) Process

func (r *Default) Process(ctx context.Context, ip netip.Addr) (host string, changed bool)

Process implements the Interface interface for Default.

type Empty

type Empty struct{}

Empty is an empty Interface implementation which does nothing.

func (Empty) Process

func (Empty) Process(_ context.Context, _ netip.Addr) (host string, changed bool)

Process implements the Interface interface for Empty.

type Exchanger

type Exchanger interface {
	// Exchange tries to resolve the ip in a suitable way, i.e. either as local
	// or as external.
	Exchange(ip netip.Addr) (host string, ttl time.Duration, err error)
}

Exchanger is a resolver for clients' addresses.

type Interface

type Interface interface {
	// Process makes rDNS request and returns domain name.  changed indicates
	// that domain name was updated since last request.
	Process(ctx context.Context, ip netip.Addr) (host string, changed bool)
}

Interface processes rDNS queries.

Jump to

Keyboard shortcuts

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