resolvers

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2024 License: GPL-3.0 Imports: 18 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Answer added in v0.2.0

type Answer struct {
	Name       string `json:"name"`
	Type       string `json:"type"`
	Class      string `json:"class"`
	TTL        string `json:"ttl"`
	Address    string `json:"address"`
	Status     string `json:"status"`
	RTT        string `json:"rtt"`
	Nameserver string `json:"nameserver"`
}

type Authority added in v0.2.0

type Authority struct {
	Name       string `json:"name"`
	Type       string `json:"type"`
	Class      string `json:"class"`
	TTL        string `json:"ttl"`
	MName      string `json:"mname"`
	Status     string `json:"status"`
	RTT        string `json:"rtt"`
	Nameserver string `json:"nameserver"`
}

type ClassicResolver

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

ClassicResolver represents the config options for setting up a Resolver.

func (*ClassicResolver) Lookup

func (r *ClassicResolver) Lookup(ctx context.Context, questions []dns.Question, flags QueryFlags) ([]Response, error)

Lookup implements the Resolver interface

type ClassicResolverOpts

type ClassicResolverOpts struct {
	UseTLS bool
	UseTCP bool
}

ClassicResolverOpts holds options for setting up a Classic resolver.

type DNSCryptResolver added in v0.4.0

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

DNSCryptResolver represents the config options for setting up a Resolver.

func (*DNSCryptResolver) Lookup added in v0.4.0

func (r *DNSCryptResolver) Lookup(ctx context.Context, questions []dns.Question, flags QueryFlags) ([]Response, error)

Lookup implements the Resolver interface

type DNSCryptResolverOpts added in v0.4.0

type DNSCryptResolverOpts struct {
	UseTCP bool
}

DNSCryptResolverOpts holds options for setting up a DNSCrypt resolver.

type DOHResolver

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

DOHResolver represents the config options for setting up a DOH based resolver.

func (*DOHResolver) Lookup

func (r *DOHResolver) Lookup(ctx context.Context, questions []dns.Question, flags QueryFlags) ([]Response, error)

Lookup implements the Resolver interface

type DOQResolver added in v0.4.2

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

DOQResolver represents the config options for setting up a DOQ based resolver.

func (*DOQResolver) Lookup added in v0.4.2

func (r *DOQResolver) Lookup(ctx context.Context, questions []dns.Question, flags QueryFlags) ([]Response, error)

Lookup implements the Resolver interface

type Options added in v0.2.0

type Options struct {
	Logger *slog.Logger

	Nameservers        []models.Nameserver
	UseIPv4            bool
	UseIPv6            bool
	SearchList         []string
	Ndots              int
	Timeout            time.Duration
	Strategy           string
	InsecureSkipVerify bool
	TLSHostname        string
}

Options represent a set of common options to configure a Resolver.

type QueryFlags added in v1.0.0

type QueryFlags struct {
	AA bool // Authoritative Answer
	AD bool // Authenticated Data
	CD bool // Checking Disabled
	RD bool // Recursion Desired
	Z  bool // Reserved for future use
	DO bool // DNSSEC OK
}

QueryFlags represents the various DNS query flags

type QueryFunc added in v1.0.3

type QueryFunc func(ctx context.Context, question dns.Question, flags QueryFlags) (Response, error)

QueryFunc represents the signature of a query function

type Question added in v0.2.0

type Question struct {
	Name  string `json:"name"`
	Type  string `json:"type"`
	Class string `json:"class"`
}

type Resolver

type Resolver interface {
	Lookup(ctx context.Context, questions []dns.Question, flags QueryFlags) ([]Response, error)
}

Resolver implements the configuration for a DNS Client. Different types of providers can load a DNS Resolver satisfying this interface.

func LoadResolvers added in v0.3.0

func LoadResolvers(opts Options) ([]Resolver, error)

LoadResolvers loads differently configured resolvers based on a list of nameserver.

func NewClassicResolver

func NewClassicResolver(server string, classicOpts ClassicResolverOpts, resolverOpts Options) (Resolver, error)

NewClassicResolver accepts a list of nameservers and configures a DNS resolver.

func NewDNSCryptResolver added in v0.4.0

func NewDNSCryptResolver(server string, dnscryptOpts DNSCryptResolverOpts, resolverOpts Options) (Resolver, error)

NewDNSCryptResolver accepts a list of nameservers and configures a DNS resolver.

func NewDOHResolver

func NewDOHResolver(server string, resolverOpts Options) (Resolver, error)

NewDOHResolver accepts a nameserver address and configures a DOH based resolver.

func NewDOQResolver added in v0.4.2

func NewDOQResolver(server string, resolverOpts Options) (Resolver, error)

NewDOQResolver accepts a nameserver address and configures a DOQ based resolver.

type Response

type Response struct {
	Answers     []Answer    `json:"answers"`
	Authorities []Authority `json:"authorities"`
	Questions   []Question  `json:"questions"`
}

Response represents a custom output format for DNS queries. It wraps metadata about the DNS query and the DNS Answer as well.

func ConcurrentLookup added in v1.0.3

func ConcurrentLookup(ctx context.Context, questions []dns.Question, flags QueryFlags, queryFunc QueryFunc, logger *slog.Logger) ([]Response, error)

ConcurrentLookup performs concurrent DNS lookups

Jump to

Keyboard shortcuts

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