Net-DNS
view release on metacpan or search on metacpan
lib/Net/DNS/Resolver.pm view on Meta::CPAN
$resolver->tsig( $keyfile, fudge => 60 );
$resolver->tsig( undef );
Set the TSIG record used to automatically sign outgoing queries, zone
transfers and updates. Automatic signing is disabled if called with
undefined arguments.
The default resolver behaviour is not to sign any packets. You must
call this method to set the key if you would like the resolver to
sign and verify packets automatically.
Packets can also be signed manually; see the L<Net::DNS::Packet>
and L<Net::DNS::Update> manual pages for examples. TSIG records
in manually-signed packets take precedence over those that the
resolver would add automatically.
=head1 ENVIRONMENT
The following environment variables can also be used to configure
the resolver:
=head2 RES_NAMESERVERS
# Bourne Shell
RES_NAMESERVERS="2001:DB8::1 192.0.2.1"
export RES_NAMESERVERS
# C Shell
setenv RES_NAMESERVERS "2001:DB8::1 192.0.2.1"
A space-separated list of nameservers to query.
=head2 RES_SEARCHLIST
# Bourne Shell
RES_SEARCHLIST="a.example.com b.example.com c.example.com"
export RES_SEARCHLIST
# C Shell
setenv RES_SEARCHLIST "a.example.com b.example.com c.example.com"
A space-separated list of domains to put in the search list.
=head2 LOCALDOMAIN
# Bourne Shell
LOCALDOMAIN=example.com
export LOCALDOMAIN
# C Shell
setenv LOCALDOMAIN example.com
The default domain.
=head2 RES_OPTIONS
# Bourne Shell
RES_OPTIONS="retrans:3 retry:2 inet6"
export RES_OPTIONS
# C Shell
setenv RES_OPTIONS "retrans:3 retry:2 inet6"
A space-separated list of resolver options to set. Options that
take values are specified as C<option:value>.
=head1 IPv4 TRANSPORT
The C<force_v4()>, C<force_v6()>, C<prefer_v4()>, and C<prefer_v6()> methods
with non-zero argument may be used to configure transport selection.
The behaviour of the C<nameserver()> method illustrates the transport
selection mechanism. If, for example, IPv4 transport has been forced,
the C<nameserver()> method will only return IPv4 addresses:
$resolver->nameservers( '192.0.2.1', '192.0.2.2', '2001:DB8::3' );
$resolver->force_v4(1);
print join ' ', $resolver->nameservers();
will print
192.0.2.1 192.0.2.2
=head1 CUSTOMISED RESOLVERS
Net::DNS::Resolver is actually an empty subclass. At compile time a
super class is chosen based on the current platform. A side benefit of
this allows for easy modification of the methods in Net::DNS::Resolver.
You can simply add a method to the namespace!
For example, if we wanted to cache lookups:
package Net::DNS::Resolver;
my %cache;
sub send {
my ( $self, @q ) = @_;
return $cache{"@q"} ||= $self->SUPER::send(@q);
}
=head1 COPYRIGHT
Copyright (c)1997-2000 Michael Fuhr.
Portions Copyright (c)2002-2004 Chris Reinhardt.
Portions Copyright (c)2005 Olaf M. Kolkman, NLnet Labs.
Portions Copyright (c)2014,2015 Dick Franks.
All rights reserved.
=head1 LICENSE
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted, provided
that the original copyright notices appear in all copies and that both
( run in 2.646 seconds using v1.01-cache-2.11-cpan-437f7b0c052 )