Provided by: libzonemaster-perl_7.1.0-1_all bug

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 synthesizing 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.

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

       blacklisted
           A reference to a hash used to prevent sending subsequent queries to the name  server  after  specific
           queries have failed.

           The  mechanism  will  only trigger on no response from non-EDNS SOA queries and is protocol dependent
           (i.e. TCP/UDP). It can be disabled on a per query basis with blacklisting_disabled, or globally  with
           "$BLACKLISTING_ENABLED" in Zonemaster::Engine::Constants.

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 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 name server from being blacklisted.

           edns_size
               Set the EDNS0 UDP maximum size. The value must be comprised between 0 and 65535.  Defaults to  0,
               or 512 if the query is a non-DNSSEC EDNS query, or 1232 if the query is a DNSSEC query.

               Setting a value other than 0 will also implicitly enable EDNS for the 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 EDNS for the 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.

       source_address()
               my $src_address = source_address();

           Returns the configured IPv4 or IPv6 source address to be used by  the  underlying  DNS  resolver  for
           sending queries, or "undef" if the source address is the empty string.

       empty_cache()
           Clears  the  caches  of  Zonemaster::Engine::Nameserver  (name  server  names  and  IP addresses) and
           Zonemaster::Engine::Nameserver::Cache (query and response packets) objects.

perl v5.40.1                                       2025-03-21                Zonemaster::Engine::Nameserver(3pm)