errors

package
v0.7.16 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2023 License: MIT Imports: 6 Imported by: 3

Documentation

Overview

Package errors aids error handling for dns.Msg and darvaza.org/resolver related functions

Index

Constants

View Source
const (
	// NOANSWER is the text on [net.DNSError].Err if no [dns.Msg] was returned
	NOANSWER = "no answer"
	// NODATA is the text on [net.DNSError].Err if an authoritative server
	// returned no answer
	NODATA = "NODATA"
	// NXDOMAIN is the text on [net.DNSError].Err if the server returned a
	// Name error
	NXDOMAIN = "NXDOMAIN"
	// TRUNCATED is the text on [net.DNSError].Err if the server returned a
	// truncated response
	TRUNCATED = "dns response was truncated"
	// BADREQUEST is the text on [net.DNSError].Err if the client request
	// is invalid
	BADREQUEST = "invalid dns request"
	// BADRESPONSE is the text on [net.DNSError].Err if the server response
	// in invalid
	BADRESPONSE = "invalid dns response from server"
	// NOTIMPLEMENTED is the text on [net.DNSError].Err if the requested
	// functionality isn't implemented by the server
	NOTIMPLEMENTED = "feature not implemented by the server"
)

Variables

This section is empty.

Functions

func ErrBadRequest added in v0.6.3

func ErrBadRequest() *net.DNSError

ErrBadRequest reports an invalid request from the client

func ErrBadResponse

func ErrBadResponse() *net.DNSError

ErrBadResponse reports a bad response from the server

func ErrNotFound

func ErrNotFound(qName string) *net.DNSError

ErrNotFound assembles a net.DNSError indicating the asked name doesn't exist.

func ErrNotImplemented

func ErrNotImplemented(name string) *net.DNSError

ErrNotImplemented reports something isn't implemented

func ErrTimeout

func ErrTimeout(qName string, err error) *net.DNSError

ErrTimeout assembles a Timeout() error

func ErrTimeoutMessage

func ErrTimeoutMessage(qName string, msg string) *net.DNSError

ErrTimeoutMessage is a variant of ErrTimeout that uses a given message instead of wrapping an error

func ErrTypeNotFound added in v0.7.5

func ErrTypeNotFound(qName string) *net.DNSError

ErrTypeNotFound assembles a net.DNSError indicating the name exists but not the requested qType/qClass.

func ErrorAsMsg added in v0.6.3

func ErrorAsMsg(req *dns.Msg, err error) *dns.Msg

ErrorAsMsg attempts to convert a net.DNSError into a dns.Msg response

func IsNotFound

func IsNotFound(err error) bool

IsNotFound checks if the given error represents a NotFound

func IsTemporary

func IsTemporary(err error) bool

IsTemporary checks if the given error could be rechecked

func IsTimeout

func IsTimeout(err error) bool

IsTimeout checks if the given error represents a Timeout

func MsgAsError

func MsgAsError(r *dns.Msg) *net.DNSError

MsgAsError validates a response and produces a matching net.DNSError if due.

func New

func New(s string) error

New creates a simple error wrapping a string

func ValidateResponse

func ValidateResponse(server string, r *dns.Msg, err error) *net.DNSError

ValidateResponse analyses a dns.Exchange response and produces a matching net.DNSError if it's an error

Types

This section is empty.

Jump to

Keyboard shortcuts

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