dnsutil

package
v0.0.0-...-dd22d64 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2021 License: AGPL-3.0 Imports: 5 Imported by: 6

Documentation

Overview

Package dnsutil defines an API to analyze and archive information related to the DNS protocol.

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

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCanceledRequest = errors.New("dnsutil: canceled request")
	ErrBadRequest      = errors.New("dnsutil: bad request")
	ErrNotSupported    = errors.New("dnsutil: not supported")
	ErrUnavailable     = errors.New("dnsutil: not available")
	ErrInternal        = errors.New("dnsutil: internal error")
	//limit errors
	ErrLimitDNSClientQueries = errors.New("dnsutil: max queries per dns client")
	ErrLimitResolvedNamesIP  = errors.New("dnsutil: max names resolved for an ip")
)

Some standard errors returned by interfaces.

Functions

This section is empty.

Types

type Archiver

type Archiver interface {
	SaveResolv(context.Context, ResolvData) (uuid.UUID, error)
}

Archiver is the interface for archive DNS information.

type CacheResponse

type CacheResponse struct {
	// Result is true if was resolved
	Result bool `json:"result"`
	// Last time resolved
	Last time.Time `json:"last,omitempty"`
	// Store time of cache
	Store time.Time `json:"store"`
}

CacheResponse stores cache response information.

type Finder

type Finder interface {
	GetResolv(ctx context.Context, id uuid.UUID) (ResolvData, bool, error)
	ListResolvs(ctx context.Context, filters []ResolvsFilter, rev bool, max int, next string) ([]ResolvData, string, error)
}

Finder is the interface for archive finder DNS information.

type ResolvCache

type ResolvCache interface {
	ResolvCollector
	ResolvChecker
}

ResolvCache interface defines a cache for dns resolutions.

type ResolvChecker

type ResolvChecker interface {
	Check(ctx context.Context, client, resolved net.IP, name string) (CacheResponse, error)
}

ResolvChecker is the interface for checks in a resolv cache. Params client and resolved are required, name can be empty.

type ResolvCollector

type ResolvCollector interface {
	Collect(ctx context.Context, client net.IP, name string, resolved []net.IP, cnames []string) error
}

ResolvCollector interface collects to the cache resolved ip address information.

type ResolvData

type ResolvData struct {
	ID        uuid.UUID     `json:"id"`
	Timestamp time.Time     `json:"timestamp"`
	Duration  time.Duration `json:"duration"`
	Server    net.IP        `json:"server"`
	Client    net.IP        `json:"client"`
	//query
	QID        uint16           `json:"qid"`
	Name       string           `json:"name"`
	IsIPv6     bool             `json:"isIPv6"`
	QueryFlags ResolvQueryFlags `json:"queryFlags"`
	//response
	ReturnCode     int                 `json:"returnCode"`
	ResolvedIPs    []net.IP            `json:"resolvedIPs,omitempty"`
	ResolvedCNAMEs []string            `json:"resolvedCNAMEs,omitempty"`
	ResponseFlags  ResolvResponseFlags `json:"responseFlags"`
	//tld calculated info
	TLD        string `json:"tld"`
	TLDPlusOne string `json:"tldPlusOne"`
}

ResolvData stores information about DNS domain name resolutions.

type ResolvQueryFlags

type ResolvQueryFlags struct {
	Do                bool `json:"do"`
	AuthenticatedData bool `json:"authenticatedData"`
	CheckingDisabled  bool `json:"checkingDisabled"`
}

ResolvQueryFlags stores information about resolv query flags

type ResolvResponseFlags

type ResolvResponseFlags struct {
	AuthenticatedData bool `json:"authenticatedData"`
}

ResolvResponseFlags stores information about resolv response flags

type ResolvsFilter

type ResolvsFilter struct {
	Since, To      time.Time
	Server, Client net.IP
	Name           string
	ResolvedIP     net.IP
	ResolvedCNAME  string
	QID            int
	ReturnCode     int
	TLD            string
	TLDPlusOne     string
}

ResolvsFilter stores filter information

Directories

Path Synopsis
grpc
archive
Package archive implements a dnsutil.Archive client and a ready to use service component.
Package archive implements a dnsutil.Archive client and a ready to use service component.
finder
Package finder implements a dnsutil.Finder client and a ready to use service component.
Package finder implements a dnsutil.Finder client and a ready to use service component.
pb
resolvcheck
Package resolvcheck implements a dnsutil.ResolvChecker client and a ready to use service component.
Package resolvcheck implements a dnsutil.ResolvChecker client and a ready to use service component.
resolvcollect
Package resolvcollect implements a dnsutil.ResolvCollector client and a ready to use service component.
Package resolvcollect implements a dnsutil.ResolvCollector client and a ready to use service component.
Package parallel allows multiple checks in paralell using dnsutil.ResolvChecker interface.
Package parallel allows multiple checks in paralell using dnsutil.ResolvChecker interface.

Jump to

Keyboard shortcuts

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