resolver

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package resolver provides the implementation of Penne resolvers

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeResolvers

func MakeResolvers(conf []Config, debug map[string]slog.LogLevel,
	opts *Options) ([]string, map[string]resolver.Exchanger, error)

MakeResolvers builds resolvers from a Config slice.

Types

type Config

type Config struct {
	Name string `yaml:"name"`
	Next string `yaml:"next,omitempty" toml:",omitempty" json:",omitempty"`

	// Debug indicates the requests passing through this [Resolver] should be logged or not.
	Debug bool `yaml:"debug,omitempty"        toml:",omitempty" json:",omitempty"`

	// OmitSubNet indicates requests reaching out to remote servers should omit
	// EDNS0 SUBNET information.
	OmitSubNet bool `yaml:"omit_subnet,omitempty" toml:",omitempty" json:",omitempty"`

	DisableAAAA bool     `yaml:"disable_aaaa,omitempty" toml:",omitempty" json:",omitempty"`
	Iterative   bool     `yaml:"iterative,omitempty"    toml:",omitempty" json:",omitempty"`
	Recursive   bool     `yaml:"recursive,omitempty"    toml:",omitempty" json:",omitempty"`
	Servers     []string `yaml:"servers,omitempty"      toml:",omitempty" json:",omitempty"`
	Suffixes    []string `yaml:"suffixes,omitempty"     toml:",omitempty" json:",omitempty"`

	Rewrites []RewriteConfig `yaml:"rewrite,omitempty" toml:",omitempty" json:",omitempty"`
}

Config describes a Resolver.

func (Config) New added in v0.0.4

func (rc Config) New(next resolver.Exchanger, opts *Options) (*Resolver, error)

New creates a new Resolver.

type Error

type Error struct {
	Resolver string
	Reason   string
	Err      error
}

Error is an error that references the name of a Resolver

func (Error) Error

func (e Error) Error() string

func (Error) Unwrap

func (e Error) Unwrap() error

type Options added in v0.0.4

type Options struct {
	Logger slog.Logger

	TLSConfig *tls.Config
}

Options contains information used to assemble all [Resolver]s.

func (*Options) NewClient added in v0.0.4

func (opts *Options) NewClient(net string) client.Client

NewClient uses the Options to create a new dns.Client.

func (*Options) SetDefaults added in v0.0.4

func (opts *Options) SetDefaults()

SetDefaults fills any gap in the Options.

type Resolver

type Resolver struct {
	resolver.Exchanger

	Next resolver.Exchanger
	// contains filtered or unexported fields
}

Resolver is a custom resolver.Exchanger.

func (*Resolver) Name added in v0.0.4

func (r *Resolver) Name() string

Name returns the name of the resolver.

func (*Resolver) String added in v0.0.4

func (r *Resolver) String() string

type RewriteConfig

type RewriteConfig struct {
	From string `yaml:"from,omitempty" toml:",omitempty" json:",omitempty"`
	To   string `yaml:"to,omitempty" toml:",omitempty" json:",omitempty"`
}

RewriteConfig describes an expression used to alter a request.

Jump to

Keyboard shortcuts

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