dnsvalidator

package module
v0.0.0-...-6d33041 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2019 License: MIT Imports: 7 Imported by: 0

README

DNS Validator

GoDoc

Validate that a set of resource records are set on all nameservers.

Uses github.com/domainr/dnsr as recursor to avoid external DNS caching.

Usage:

import "github.com/pior/dnsvalidator"
dnsv := dnsvalidator.New()
ctx := context.Background()

report, err := dnsv.Inspect(ctx, name, type)

expected := []RR{{Name:  "...", Type:  "CNAME", Value: "..."},}
err = report.Validate(expected)

See example: cmd/test

License

The MIT License (MIT)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrInvalid

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

func (*ErrInvalid) Error

func (e *ErrInvalid) Error() string

type NS

type NS struct {
	Name string
	IP   string
}

type NSReport

type NSReport struct {
	Rcode int
	RRs   []RR
}

type RR

type RR struct {
	Name  string
	Type  string
	Value string
	TTL   int
}

RR represents a DNS resource record.

func (*RR) String

func (rr *RR) String() string

String returns a string representation of an RR in zone-file format.

type Report

type Report map[NS]NSReport

func (*Report) Validate

func (r *Report) Validate(expected []RR) error

type Validator

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

func New

func New() *Validator

func (*Validator) FindNameservers

func (v *Validator) FindNameservers(ctx context.Context, qname string) (nss []string, err error)

FindNameservers tries to find the nameservers for a given query name, by iterating on parents. Returns the root nameservers if the domain does not exist.

func (*Validator) Inspect

func (v *Validator) Inspect(ctx context.Context, qname string, qtype string) (Report, error)

Inspect queries all nameservers for a query name and type and return a report by nameserver.

func (*Validator) QueryNameserver

func (v *Validator) QueryNameserver(ctx context.Context, qname, qtype, nameserver string) (Report, error)

func (*Validator) QueryNameservers

func (v *Validator) QueryNameservers(ctx context.Context, qname, qtype string, nameservers []string) (Report, error)

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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