exdns

package
v0.7.14 Latest Latest
Warning

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

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

Documentation

Overview

Package exdns contains helpers to work with dns.Msg

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsServerAddress

func AsServerAddress(server string) (string, error)

AsServerAddress validates and optionally appends :53 port if it wasn't specified already

func Decanonize

func Decanonize(qName string) string

Decanonize removes the trailing . if present, unless it's the root dot

func ForEachAnswer

func ForEachAnswer[T dns.RR](msg *dns.Msg, fn func(v T))

ForEachAnswer calls a function for each answer of the specified type.

func GetFirstAnswer

func GetFirstAnswer[T dns.RR](msg *dns.Msg) T

GetFirstAnswer returns the first answer for a specified type

func HasAnswerType

func HasAnswerType(msg *dns.Msg, qType uint16) bool

HasAnswerType checks if a dns.Msg contains answers of the specified type.

func HasNsType

func HasNsType(msg *dns.Msg, qType uint16) bool

HasNsType checks if a dns.Msg contains Ns entries of the specified type

func TrimQ

func TrimQ(s []dns.Question, cond func(q dns.Question) bool) []dns.Question

TrimQ removes entries matching the condition from a dns.Question slice

func TrimRR

func TrimRR(s []dns.RR, cond func(rr dns.RR) bool) []dns.RR

TrimRR removes entries matching the condition from a dns.RR slice

Types

This section is empty.

Jump to

Keyboard shortcuts

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