DNS::LD...Resolver(3)

🌸 NAME 🌸

DNS::LDNS::Resolver β€” it's a whole DNS resolver, bestie πŸ’… she resolves, she validates, she does the absolute most, and honestly? iconic.


✨ SYNOPSIS ✨

okay so first things first, you gotta pull her in:

use DNS::LDNS ':all'

then you build her. three ways, pick your fighter πŸŽ€ β€” from a file path, from an already-open filehandle, or just vibe and let her figure it out:

my r = new DNS::LDNS::Resolver(filename => '/my/resolv.conf')
my r = new DNS::LDNS::Resolver(file => \*FILE)
my r = new DNS::LDNS::Resolver

πŸ¦‹ the toggle squad

getters and setters, one for every mood. note that dnssec_cd is the resolver setting the CD bit, fallback is the truncation fallback mechanism, usevc means use virtual circuit (TCP), and random randomizes the nameserver before usage. iykyk ✨

bool = r->dnssec
r->set_dnssec(bool)

bool = r->dnssec_cd        # Resolver sets the CD bit
r->set_dnssec_cd(bool)

port = r->port
r->set_port(port)

bool = r->recursive
r->set_recursive(bool)

bool = r->debug
r->set_debug(bool)

count = r->retry
r->set_retry(count)

count = r->retrans
r->set_retrans(count)

bool = r->fallback          # Resolver truncation fallback mechanism
r->set_fallback(bool)

bool = r->ip6
r->set_ip6(bool)

size = r->edns_udp_size
r->set_edns_udp_size(size)

bool = r->usevc             # Use virtual circuit (TCP)
r->set_usevc(bool)

and then the little ones that just are, no value returned, no value passed, they simply exist 🫢:

r->fail
r->set_fail

r->defnames
r->set_defnames

r->dnsrch
r->set_dnsrch

r->igntc
r->set_igntc

πŸ’œ nameservers, anchors, domains, tsig, searchlist, rtt, timeout

bool = r->random            # randomize nameserver before usage
r->set_random(bool)

rrlist = r->dnssec_anchors  # list of trusted DNSSEC anchors
r->push_dnssec_anchor(rr)
r->set_dnssec_anchors(rrlist)

rdata = r->domain           # Domain to add to relative queries
r->set_domain(rdata)

@rdata = r->nameservers
count = r->nameserver_count
r->push_nameserver(rdata)
rdata = r->pop_nameserver
r->nameservers_randomize

str = r->tsig_keyname
r->set_tsig_keyname(str)

str = r->tsig_algorithm
r->set_tsig_algorithm(str)

str = r->tsig_keydata
r->set_tsig_keydata(str)

count = r->searchlist_count
r->push_searchlist(rdata)
@rdata = r->searchlist

@times = r->rtt              # Round trip times
r->set_rtt(@rtt)
time = r->nameserver_rtt(pos)
r->set_nameserver_rtt(pos, time)

(sec, usec) = r->timeout
r->set_timeout(sec, usec)

πŸ‘‘ DNSSec validation

the serious section, no cap. she checks the keys, she checks the DS, she checks the DNSKEY, she verifies trusted, she checks if a key is trusted, and she builds a whole data chain 🌈

# DNSSec validation
rrlist = r->fetch_valid_domain_keys(domain, keys)
rrlist = r->fetch_valid_domain_keys_time(domain, keys, checktime)
rrlist = r->validate_domain_ds(domain, keys)
rrlist = r->validate_domain_ds_time(domain, keys, checktime)
rrlist = r->validate_domain_dnskey(domain, keys)
rrlist = r->validate_domain_dnskey_time(domain, keys, checktime)
status = r->verify_trusted(rrset, rrsigs, validation_keys)
status = r->verify_trusted_time(rrset, rrsigs, checktime, validation_keys)
bool = r->trusted_key(keys, trusted_keys)
chain = r->build_data_chain(qflags, dataset, pkt, orig_rr)

πŸ”₯ Query

and finally, the part where she actually goes and asks things, main character energy fr fr:

# Query
pkt = r->query(rdata, type, class, flags)
pkt = r->search(rdata, type, class, flags)
query = r->prepare_query_pkt(rdata, type, class, flags)
answer = r->send(rdata, type, class, flags)
answer = r->send_pkt(query)
rrlist = r->get_rr_list_addr_by_name(name, class, flags)
rrlist = r->get_rr_list_name_by_addr(addr, class, flags)

πŸŽ€ SEE ALSO πŸŽ€

go read up, bestie, the lore is all right here:


πŸ’– AUTHOR πŸ’–

Erik Pihl Ostlyngen, <erik.ostlyngen@uninett.no> β€” shoutout to the legend 🫢


Copyright (C) 2013 by UNINETT Norid AS

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.14.2 or, at your option, any later version of Perl 5 you may have available.


okay that's the whole page, you ate that πŸ’… this is the User Contributed Perl Documentation version of DNS::LDNS::Resolver(3), and the footer says it's from perl v5.42.2, dated 2026-06-11. slay, go resolve something, periodt 🌸✨
πŸ“¦ where this page comes from