Provided by: libzonemaster-perl_4.7.3-1_all
NAME
Zonemaster::Engine::Nameserver - object representing a DNS nameserver
SYNOPSIS
my $ns = Zonemaster::Engine::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::Engine 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
name A Zonemaster::Engine::DNSName object holding the nameserver's name. address A Net::IP::XS object holding the nameserver's address. dns The Zonemaster::LDNS object used to actually send and receive DNS queries. cache A reference to a Zonemaster::Engine::Nameserver::Cache object holding the cache of sent queries. Not meant for external use. source_address The source address all resolver objects should use when sending queries. Depends on the IP version used to send the queries. source_address4 The IPv4 source address all resolver objects should use when sending queries over IPv4. source_address6 The IPv6 source address all resolver objects should use when sending queries over IPv6. times A reference to a list with elapsed time values for the queries made through this nameserver.
CLASS METHODS
new Construct a new object. save($filename) Save the entire object cache to the given filename, using the byte-order-independent Storable format. restore($filename) Replace the entire object cache with the contents of the named file. all_known_nameservers() Class method that returns a list of all nameserver objects in the global cache. empty_cache() Remove all cached nameserver objects and queries.
INSTANCE METHODS
query($name, $type, $flagref) 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 'class' and 'edns_details' directly correspond to methods in the Zonemaster::LDNS::Resolver object. 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. Defaults to false. If set to true, it becomes an EDNS query. Value overridden by 'edns_details->do' (if also given). More details in 'edns_details' below. debug Set the debug flag in the resolver, producing output on STDERR as the query process proceeds. recurse Set the RD flag in the query. timeout Set the timeout for the outgoing sockets. May or may not be observed by the underlying network stack. 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. fallback If set to true, incoming response packets with the TC flag set fall back to EDNS and/or TCP. blacklisting_disabled If set to true, prevents a server to be black-listed on a query in case there is no answer OR rcode is REFUSED. edns_size Set the EDNS0 UDP maximum size. Defaults to 512. Used only when the query is an EDNS query. Does not enable on its own the query to be an EDNS query. Value overridden by 'edns_details->size' (if also given). More details in 'edns_details' below. edns_details A hash. An empty hash or a hash with any keys below will enable the query to be an EDNS query. The currently supported keys are 'version', 'z', 'do', 'rcode', 'size' and 'data'. See Zonemaster::LDNS::Packet for more details (key names prefixed with 'edns_'). Note that flag 'edns_size' also exists (see above) and has the same effect as 'edns_details->size', although the value of the latter will take precedence if both are given. Similarly, note that flag 'dnssec' also exists (see above) and has the same effect as 'edns_details->do', although the value of the latter will take precedence if both are given. string() Returns a string representation of the object. Normally this is just the name and IP address separated by a slash. 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. 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::Engine. 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). add_fake_ds($domain, $data) Adds fake DS information to this nameserver object. Takes the same arguments as the similarly named method in Zonemaster::Engine. axfr( $domain, $callback, $class ) 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 Zonemaster::LDNS::axfr for more details.