Zonema...server(3pm)

πŸ“¦ version 1.0.16, in ubuntu jammy

πŸ’– 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 β€” a Zonemaster::DNSName object holding the nameserver's name.
  • address β€” a Zonemaster::Net::IP object holding the nameserver's address.
  • dns β€” the Net::LDNS object that actually sends and receives the DNS queries. the muscle. πŸ’ͺ
  • cache β€” a reference to a Zonemaster::Nameserver::Cache object 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-independent Storable format. 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. $name and $type are the name and type you're querying for ($type defaults to 'A' if you leave it undefined). $flagref is 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 on STDERR as 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 in Zonemaster. > 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 in Zonemaster.
  • 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. 🫠 see Net::LDNS::axfr for 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