resolver

package
v0.0.0-...-1e25372 Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMinFound     = errors.New("not enough hosts found")
	ErrMaxFailRatio = errors.New("maximum failure ratio reached")
)
View Source
var (
	ErrMaxNoNew = errors.New("reached the maximum number of no new update")
	ErrMaxFails = errors.New("reached the maximum number of consecutive failures")
)

Functions

This section is empty.

Types

type Parallel

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

func NewParallelResolver

func NewParallelResolver(resolverAddress string) *Parallel

func (*Parallel) Resolve

func (pr *Parallel) Resolve(ctx context.Context, settings ParallelSettings) (
	hostToIPs map[string][]netip.Addr, warnings []string, err error)

type ParallelSettings

type ParallelSettings struct {
	// Hosts to resolve in parallel.
	Hosts     []string
	Repeat    RepeatSettings
	FailEarly bool
	// Maximum ratio of the hosts failing DNS resolution
	// divided by the total number of hosts requested.
	// This value is between 0 and 1. Note this is only
	// applicable if FailEarly is not set to true.
	MaxFailRatio float64
}

type Repeat

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

func NewRepeat

func NewRepeat(resolverAddress string) *Repeat

func (*Repeat) Resolve

func (r *Repeat) Resolve(ctx context.Context, host string, settings RepeatSettings) (
	ips []netip.Addr, err error)

type RepeatSettings

type RepeatSettings struct {
	Address         string
	MaxDuration     time.Duration
	BetweenDuration time.Duration
	MaxNoNew        int
	// Maximum consecutive DNS resolution failures
	MaxFails int
	SortIPs  bool
}

Jump to

Keyboard shortcuts

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