Documentation
¶
Overview ¶
Package exdns contains helpers to work with dns.Msg
Index ¶
- func AsServerAddress(server string) (string, error)
- func CleanString(v fmt.Stringer) string
- func Decanonize(qName string) string
- func ForEachAnswer[T dns.RR](msg *dns.Msg, fn func(v T))
- func ForEachQuestion(req *dns.Msg, fn func(dns.Question))
- func ForEachQuestionOfClass(req *dns.Msg, qClass uint16, fn func(dns.Question))
- func ForEachRR[T dns.RR](records []dns.RR, fn func(v T))
- func GetFirstAnswer[T dns.RR](msg *dns.Msg) T
- func GetFirstRR[T dns.RR](records []dns.RR) (T, bool)
- func HasAnswerType(msg *dns.Msg, qType uint16) bool
- func HasNsType(msg *dns.Msg, qType uint16) bool
- func NewRequestFromParts(qName string, qClass uint16, qType uint16) *dns.Msg
- func RestoreReturn(req, resp *dns.Msg, err error) (*dns.Msg, error)
- func TrimQ(s []dns.Question, cond func(q dns.Question) bool) []dns.Question
- func TrimRR(s []dns.RR, cond func(rr dns.RR) bool) []dns.RR
- func ValidateResponse(server string, resp *dns.Msg, err error) error
- func ValidateRestoreReturn(req, resp *dns.Msg, server string, err error) (*dns.Msg, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AsServerAddress ¶
AsServerAddress validates and optionally appends :53 port if it wasn't specified already
func CleanString ¶ added in v0.7.25
CleanString replaces all whitespace on the `.String()` output of a command with single spaces, to turn them into readable fields in logs.
func Decanonize ¶
Decanonize removes the trailing . if present, unless it's the root dot
func ForEachAnswer ¶
ForEachAnswer calls a function for each answer of the specified type.
func ForEachQuestion ¶ added in v0.7.15
ForEachQuestion calls a function for each question on the given request.
func ForEachQuestionOfClass ¶ added in v0.7.15
ForEachQuestionOfClass calls a function for each question of the specified class on the given request
func GetFirstAnswer ¶
GetFirstAnswer returns the first answer for a specified type.
func GetFirstRR ¶ added in v0.7.23
GetFirstRR returns the first RR for a specified type on the given slice.
func HasAnswerType ¶
HasAnswerType checks if a dns.Msg contains answers of the specified type.
func NewRequestFromParts ¶ added in v0.7.24
NewRequestFromParts creates a new dns.Msg from the described question.
func RestoreReturn ¶ added in v0.7.19
RestoreReturn makes sure the response carries the same ID as the original request before returning it an already validated response.
func ValidateResponse ¶ added in v0.7.17
ValidateResponse wraps errors.ValidateResponse to avoid getting nil errors typed as *net.DNSError, which aren't nil anymore.
Types ¶
This section is empty.