dnscheck

package
v0.20.1 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2020 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Overview

Package dnscheck contains the DNS check experiment.

This experiment is not meant to be an user facing experiment rather it is meant to be a building block for building DNS experiments.

Description of the experiment

You run this experiment with one or more DNS server URLs in input. We describe the format of such URLs later.

For each DNS server URL, the code behaves as follows:

1. if the URL's hostname is a domain name, we resolve such domain name using the system resolver and attempt to query the selected resolver using all the possible IP addresses, so to verify all of them

2. otherwise, we directly attempt to use the specified resolver

The purpose of this algorithm is to make sure we measure whether each possible IP address for the domain is working or not.

By default, we resolve `example.org`. There is an experiment option called Domain allowing you to change that.

Input URL format

To perform DNS over UDP, use `udp://<address_or_domain>[:<port>]`.

To perform DNS over TCP, use `tcp://<address_or_domain>[:<port>]`.

For DNS over TLS, use `dot://<address_or_domain>[:<port>]`.

For DNS over HTTPS, use `https://<address_or_domain>[:<port>]/<path>`.

When the `<port>` is missing, we use the correct default.

Output data format

A measurement data structure is generated for every input resolver URL using the format described above. Because a single URL might expand to one or more IP addresses, the toplevel output data format is a map.

The map key is the TCP or UDP destination endpoint being used. The map value is the measurement for such endpoint.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInputRequired        = errors.New("this experiment needs input")
	ErrInvalidURL           = errors.New("the input URL is invalid")
	ErrUnsupportedURLScheme = errors.New("unsupported URL scheme")
)

The following errors may be returned by this experiment. Of course these errors are in addition to any other errors returned by the low level packages that are used by this experiment to implement its functionality.

Functions

func Collect

func Collect(ctx context.Context, multi urlgetter.Multi, inputs []urlgetter.MultiInput,
	callbacks model.ExperimentCallbacks) <-chan urlgetter.MultiOutput

Collect prints on the output channel the result of running dnscheck on every provided input. It closes the output channel when done.

func NewExperimentMeasurer

func NewExperimentMeasurer(config Config) model.ExperimentMeasurer

NewExperimentMeasurer creates a new ExperimentMeasurer.

Types

type Config

type Config struct {
	Domain string `ooni:"domain to resolve using the specified resolver"`
}

Config contains the experiment's configuration.

type Measurer

type Measurer struct {
	Config
}

Measurer performs the measurement.

func (Measurer) ExperimentName

func (m Measurer) ExperimentName() string

ExperimentName implements model.ExperimentSession.ExperimentName

func (Measurer) ExperimentVersion

func (m Measurer) ExperimentVersion() string

ExperimentVersion implements model.ExperimentSession.ExperimentVersion

func (Measurer) Run

func (m Measurer) Run(
	ctx context.Context, sess model.ExperimentSession,
	measurement *model.Measurement, callbacks model.ExperimentCallbacks,
) error

Run implements model.ExperimentSession.Run

type TestKeys

type TestKeys struct {
	Domain           string                        `json:"domain"`
	Bootstrap        *urlgetter.TestKeys           `json:"bootstrap"`
	BootstrapFailure *string                       `json:"bootstrap_failure"`
	Lookups          map[string]urlgetter.TestKeys `json:"lookups"`
}

TestKeys contains the results of the dnscheck experiment.

Jump to

Keyboard shortcuts

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