Scroll to navigation

Zonemaster::Nameserver(3pm) User Contributed Perl Documentation Zonemaster::Nameserver(3pm)

NAME

Zonemaster::Nameserver - object representing a DNS nameserver

SYNOPSIS

    my $ns = Zonemaster::Nameserver->new({ name => 'ns.nic.se', address => '212.247.7.228' });
    my $p = $ns->query('www.iis.se', 'AAAA');

DESCRIPTION

This is a very central object in the Zonemaster framework. All DNS communications with the outside world pass through here, so we can do things like synthezising and recording traffic. All the objects are also unique per name/IP pair, and creating a new one with an already existing pair will return the existing object instead of creating a new one. Queries and their responses are cached by IP address, so that a specific query will only be sent once to each address (even if there are multiple objects for that address with different names).

Class methods on this class allows saving and loading cache contents.

ATTRIBUTES

A Zonemaster::DNSName object holding the nameserver's name.
A Zonemaster::Net::IP object holding the nameserver's address.
The Net::LDNS object used to actually send and receive DNS queries.
A reference to a Zonemaster::Nameserver::Cache object holding the cache of sent queries. Not meant for external use.
A reference to a list with elapsed time values for the queries made through this nameserver.

CLASS METHODS

Save the entire object cache to the given filename, using the byte-order-independent Storable format.
Replace the entire object cache with the contents of the named file.
Class method that returns a list of all nameserver objects in the global cache.
Remove all cached nameserver objects and queries.

INSTANCE METHODS

Send a DNS query to the nameserver the object represents. $name and $type are the name and type that will be queried for ($type defaults to 'A' if it's left undefined). $flagref is a reference to a hash, the keys of which are flags and the values are their corresponding values. The available flags are as follows. All but the first directly correspond to methods in the Net::LDNS::Resolver object.
Defaults to 'IN' if not set.
Send the query via TCP (only).
The retransmission interval
Set the DO flag in the query.
Set the debug flag in the resolver, producing output on STDERR as the query process proceeds.
Set the RD flag in the query.
Set the UDP timeout for the outgoing UDP socket. May or may not be observed by the underlying network stack.
Set the TCP timeout for the outgoing TCP socket. May or may not be observed by the underlying network stack.
Set the number of times the query is tried.
If set to true, incoming response packets with the TC flag set are not automatically retried over TCP.
Returns a string representation of the object. Normally this is just the name and IP address separated by a slash.
Used for overloading comparison operators.
Returns the total time spent sending queries and waiting for responses.
Returns the shortest time spent on a query.
Returns the longest time spent on a query.
Returns the average time spent on queries.
Returns the median query time.
Returns the standard deviation for the whole set of query times.
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 confusing results (but may be useful to model certain kinds of misconfigurations).
Adds fake DS information to this nameserver object. Takes the same arguments as the similarly named method in Zonemaster.
Does an AXFR for the requested domain from the nameserver. The callback function will be 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. If it returns a true value, the AXFR will be aborted. See Net::LDNS::axfr for more details.
2022-06-28 perl v5.34.0