Scroll to navigation

Zonemaster::Engine::Recursor(3pm) User Contributed Perl Documentation Zonemaster::Engine::Recursor(3pm)

NAME

Zonemaster::Engine::Recursor - recursive resolver for Zonemaster

SYNOPSIS

    my $packet = Zonemaster::Engine::Recursor->recurse( $name, $type, $dns_class );
    my $pname  = Zonemaster::Engine::Recursor->parent( 'example.org' );

CLASS VARIABLES

%recurse_cache

Will cache result of previous queries.

%_fake_addresses_cache

A hash of hashrefs of arrayrefs. The keys of the top level hash are domain names. The keys of the second level hashes are name server names (normalized to lower case). The elements of the third level arrayrefs are IP addresses.

The IP addresses are those of the nameservers which are used in case of fake delegations (pre-publication tests).

CLASS METHODS

init_recursor()

Initialize the recursor by loading the root hints.

recurse($name, $type, $class)

Does a recursive resolution from the root servers down for the given triplet.

parent($name)

Does a recursive resolution from the root down for the given name (using type "SOA" and class "IN"). If the resolution is successful, it returns the domain name of the second-to-last step. If the resolution is unsuccessful, it returns the domain name of the last step.

get_ns_from($packet, $state)

Internal method. Takes a packet and a recursion state and returns a list of ns objects. Used to follow redirections.

get_addresses_for($name[, $state])

Takes a name and returns a (possibly empty) list of IP addresses for that name (in the form of Net::IP::XS objects). When used internally by the recursor it's passed a recursion state as its second argument.

add_fake_addresses($domain, $data)

Class method to create fake addresses for fake delegations for a specified domain from data provided.

has_fake_addresses($domain)

Check if there is at least one fake nameserver specified for the given domain.

get_fake_addresses($domain, $nsname)

Returns a list of all cached fake addresses for the given domain and name server name. Returns an empty list if no data is cached for the given arguments.

get_fake_names($domain)

Returns a list of all cached fake name server names for the given domain. Returns an empty list if no data is cached for the given argument.

remove_fake_addresses($domain)

Remove fake delegation data for a specified domain.

clear_cache()

Class method to empty the cache of responses to recursive queries (but not the ones for fake delegations).

N.B. This method does not affect fake delegation data.

root_servers()

Returns a list of ns objects representing the root servers.

    my @name_servers = Zonemaster::Engine::Recursor->root_servers();

The default list of root servers is read from a file installed in the shared data directory. This list can be replaced like so:

    Zonemaster::Engine::Recursor->remove_fake_addresses( '.' );
    Zonemaster::Engine::Recursor->add_fake_addresses(
        '.',
        {
            'ns1.example' => ['192.0.2.1'],
            'ns2.example' => ['192.0.2.2'],
        }
    );
2024-04-22 perl v5.38.2