Zonemaster::Engine::Nameserver(3p)

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 Zonemaster::Engine::Net::IP object holding the nameserver's address.

dns The Zonemaster::LDNS object used to actually send and recieve DNS queries.

cache
    A reference to a Zonemaster::Engine::Nameserver::Cache object holding the cache of sent queries. Not meant for external use.

times
    A reference to a list with elapsed time values for the queries made through this nameserver.

CLASS METHODS

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 the first 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.

    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.

    udp_timeout
        Set the UDP timeout for the outgoing UDP socket. May or may not be observed by the underlying network stack.

    tcp_timeout
        Set the TCP timeout for the outgoing TCP socket. 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.

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.