doh

package module
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2026 License: MIT Imports: 14 Imported by: 20

README

go-doh-resolver

DNS over HTTPS resolver

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option added in v0.4.0

type Option func(*Resolver) error

func WithCacheDisabled added in v0.4.0

func WithCacheDisabled() Option

func WithMaxCacheTTL added in v0.4.0

func WithMaxCacheTTL(maxCacheTTL time.Duration) Option

Specifies the maximum time entries are valid in the cache A maxCacheTTL of zero or less is equivalent to `WithCacheDisabled`

type Resolver

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

func NewResolver

func NewResolver(url string, opts ...Option) (*Resolver, error)

func (*Resolver) LookupIPAddr

func (r *Resolver) LookupIPAddr(ctx context.Context, domain string) (result []net.IPAddr, err error)

func (*Resolver) LookupTXT

func (r *Resolver) LookupTXT(ctx context.Context, domain string) ([]string, error)

func (*Resolver) LookupTXTWithTTL added in v0.6.0

func (r *Resolver) LookupTXTWithTTL(ctx context.Context, domain string) ([]string, time.Duration, error)

LookupTXTWithTTL is like Resolver.LookupTXT but also returns how long the TXT records may be cached. The TTL is the smallest Ttl across the answer's TXT resource records, capped by the resolver's max cache TTL (WithMaxCacheTTL). On a cache hit it is the remaining lifetime of the cached entry, so the value shrinks as the entry ages. A TTL of 0 means the records may not be cached: because the cache is disabled (WithCacheDisabled), the records themselves carry a TTL of 0, or the upstream resolver did not provide one.

Jump to

Keyboard shortcuts

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