utils

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2026 License: Apache-2.0 Imports: 7 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AnswersByType

func AnswersByType(msg *dns.Msg, qtype uint16) []dns.RR

AnswersByType returns only the answers from the DNS Answer section matching the provided type.

func BackoffJitter

func BackoffJitter(min, max time.Duration) time.Duration

BackoffJitter returns a random Duration between the provided min and max parameters.

func ExponentialBackoff

func ExponentialBackoff(events int, delay time.Duration) time.Duration

ExponentialBackoff returns a Duration equal to 2^events multiplied by the provided delay and jitter added equal to [0,delay).

func FQDNToRegistered

func FQDNToRegistered(fqdn, registered string, callback func(domain string) bool)

FQDNToRegistered executes the provided callback routine for domain names, starting with the FQDN to the registered domain name, removing one label with each execution. The process stops if the callback routine returns true, indicating completion.

func QueryMsg

func QueryMsg(name string, qtype uint16) *dns.Msg

QueryMsg generates a message used for a forward DNS query.

func RegisteredToFQDN

func RegisteredToFQDN(registered, fqdn string, callback func(domain string) bool)

RegisteredToFQDN executes the provided callback routine for domain names, starting with the registered domain name to the FQDN, adding one label with each execution. The process stops if the callback routine returns true, indicating completion.

func RemoveLastDot

func RemoveLastDot(name string) string

RemoveLastDot removes the '.' at the end of the provided FQDN.

func ReverseMsg

func ReverseMsg(addr string) *dns.Msg

ReverseMsg generates a message used for a reverse DNS query.

func SetupOptions

func SetupOptions() *dns.OPT

SetupOptions returns the EDNS0_SUBNET option for hiding our location.

func TCPExchange

func TCPExchange(req types.Request, timeout time.Duration)

func TruncatedExponentialBackoff

func TruncatedExponentialBackoff(events int, delay, max time.Duration) time.Duration

TruncatedExponentialBackoff returns a Duration equal to ExponentialBackoff with a provided maximum Duration used to truncate the result.

func WalkMsg

func WalkMsg(name string, qtype uint16) *dns.Msg

WalkMsg generates a message used for a NSEC walk query.

Types

This section is empty.

Jump to

Keyboard shortcuts

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