dnsxl

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2021 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

Package dnsxl provides a xlistd.List implementation that uses a dns zone as a source for its checks.

This package is a work in progress and makes no API stability promises.

Index

Constants

View Source
const ComponentClass = "dnsxl"

ComponentClass registered.

Variables

This section is empty.

Functions

func Builder

func Builder(defaultCfg Config) xlistd.BuildListFn

Builder returns a builder function.

func DefaultResolver

func DefaultResolver(resolver Resolver)

DefaultResolver sets the default resolver for all new instances

Types

type Config

type Config struct {
	Timeout         time.Duration
	ForceValidation bool
	DoReverse       bool
	HalfPing        bool
	ResolveReason   bool
	AuthToken       string
	Reason          string
	PingDNS         string
	Resolver        Resolver
	Retries         int
	DNSCodes        map[string]string
	ErrCodes        map[string]string
}

Config options.

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns default configuration.

func (Config) Copy

func (src Config) Copy() Config

Copy configuration.

type List

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

List implements an xlistd.List that checks against DNS blacklists.

func New

func New(id, zone string, resources []xlist.Resource, cfg Config, logger yalogi.Logger) (*List, error)

New creates a new DNSxL based RBL.

func (*List) Check

func (l *List) Check(ctx context.Context, name string, resource xlist.Resource) (xlist.Response, error)

Check implements xlist.Checker interface.

func (*List) Class

func (l *List) Class() string

Class implements xlistd.List interface.

func (*List) ID

func (l *List) ID() string

ID implements xlistd.List interface.

func (*List) Ping

func (l *List) Ping() error

Ping implements xlistd.List interface.

func (*List) Resources

func (l *List) Resources(ctx context.Context) ([]xlist.Resource, error)

Resources implements xlist.Checker interface.

type Resolver

type Resolver interface {
	Resolver() string
	Ping(domain string) error
}

Resolver is an interface for dns resolvers

type ResolverRRPool

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

ResolverRRPool implements Resolver interface with a round robbin pool

func NewResolverFromConf

func NewResolverFromConf(file string) (*ResolverRRPool, error)

NewResolverFromConf returns a dns pool from a resolv.conf file

func NewResolverPoolFromZone

func NewResolverPoolFromZone(zone string) (*ResolverRRPool, error)

NewResolverPoolFromZone queries a dns zone for its name servers and returns a resolver pool

func NewResolverRRPool

func NewResolverRRPool(addresses []string) (*ResolverRRPool, error)

NewResolverRRPool constructs a dns server pool with passed addresses.

func (*ResolverRRPool) Ping

func (p *ResolverRRPool) Ping(domain string) error

Ping implements interface Resolver checking that all resolvers in the pool resolves the domain name passed as parameter. Returns an error if something is not working.

func (*ResolverRRPool) Resolver

func (p *ResolverRRPool) Resolver() string

Resolver implements interface returning the next server in the pool

Jump to

Keyboard shortcuts

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