Zonema...server(3pm)
π Zonemaster::Nameserver β your fave little DNS nameserver object (3pm) π
okay bestie, welcome to the Zonemaster::Nameserver page, straight out of the User Contributed Perl Documentation section of the manual. it's giving β¨ very central object β¨ and honestly? she ate.
πΈ SYNOPSIS πΈ
my $ns = Zonemaster::Nameserver->new({ name => 'ns.nic.se', address => '212.247.7.228' });
my $p = $ns->query('www.iis.se', 'AAAA');
like, that's it. that's the whole vibe. make one, query with it. π
π¦ DESCRIPTION π¦
okay so this is a super central object in the Zonemaster framework. literally every DNS conversation with the outside world goes through here, which is the whole point β it means we can do cute things like synthesizing and recording traffic. π
also? all the objects are unique per name/IP pair. so if you try to make a new one with a pair that already exists, you don't get a new object β you get the existing one handed right back to you. no duplicates, no drama. that's main character energy fr fr.
and the queries plus their responses are cached by IP address, so a specific query only ever gets sent once to each address β even if there are multiple objects for that address with different names. one query, many objects, zero wasted packets. iconic. π
oh and the class methods on this class let you save and load cache contents. handy!
π ATTRIBUTES π
nameβ aZonemaster::DNSNameobject holding the nameserver's name.addressβ aZonemaster::Net::IPobject holding the nameserver's address.dnsβ theNet::LDNSobject that actually sends and receives the DNS queries. the muscle. πͺcacheβ a reference to aZonemaster::Nameserver::Cacheobject holding the cache of sent queries. > heads up bestie: this is not meant for external use. hands off. πtimesβ a reference to a list with elapsed time values for the queries made through this nameserver. yes, she keeps receipts. β±οΈ
β¨ CLASS METHODS β¨
save($filename)β save the entire object cache to the given filename, using the byte-order-independentStorableformat. portable and cute. πΎrestore($filename)β replace the entire object cache with the contents of the named file. swapperoo. πall_known_nameservers()β class method that returns a list of all nameserver objects in the global cache. the whole group chat, assembled. π«Άempty_cache()β remove all cached nameserver objects and queries. scorched earth, but make it tidy. π§Ή
π INSTANCE METHODS π
query($name, $type, $flagref)β send a DNS query to the nameserver this object represents.$nameand$typeare the name and type you're querying for ($typedefaults to'A'if you leave it undefined).$flagrefis a reference to a hash β the keys are flags, the values are their corresponding values. the available flags are:classβ defaults to'IN'if not set.usevcβ send the query via TCP (only).retransβ the retransmission interval.dnssecβ set the DO flag in the query.debugβ set the debug flag in the resolver, producing output onSTDERRas the query process proceeds. she's narrating her own life. πrecurseβ set the RD flag in the query.udp_timeoutβ set the UDP timeout for the outgoing UDP socket. > may or may not be observed by the underlying network stack. (translation: she might listen. no promises. π)tcp_timeoutβ set the TCP timeout for the outgoing TCP socket. > may or may not be observed by the underlying network stack. same energy.retryβ set the number of times the query is tried.igntcβ if set to true, incoming response packets with the TC flag set are not automatically retried over TCP.
real talk: all of these except the first one directly correspond to methods in the Net::LDNS::Resolver object. iykyk.
string()β returns a string representation of the object. normally that's just the name and the IP address separated by a slash. clean, simple, slay. πcompare($other)β used for overloading comparison operators.sum_time()β returns the total time spent sending queries and waiting for responses.min_time()β returns the shortest time spent on a query.max_time()β returns the longest time spent on a query.average_time()β returns the average time spent on queries.median_time()β returns the median query time.stddev_time()β returns the standard deviation for the whole set of query times. math girlies rise up πadd_fake_delegation($domain,$data)β adds fake delegation information to this specific nameserver object. takes the same arguments as the similarly named method inZonemaster. > this is primarily used for internal information, and using it directly will likely give you confusing results β though it may be useful to model certain kinds of misconfigurations. so like, use with intention, bestie. πadd_fake_ds($domain, $data)β adds fake DS information to this nameserver object. takes the same arguments as the similarly named method inZonemaster.axfr( $domain, $callback, $class )β does an AXFR for the requested domain from the nameserver. the callback function gets called once for each received RR, with that RR as its only argument. to continue getting more RRs, the callback must return a true value. > and then the page says: if it returns a true value, the AXFR will be aborted. yeah. that's literally what it says. we are simply reporting the lore. π« seeNet::LDNS::axfrfor more details.
and that's the whole page, bestie!! you're now officially fluent in nameserver objects. go forth and query responsibly πβ¨π
this little tour was brought to you by perl v5.32.0, dated 2021-01-06. vintage but still serving looks. ππ¦
π¦ where this page comes from
- ubuntu jammy: libzonemaster-perl 1.0.16-2.1 Β· BSD-2-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms