How to configure AnyEvent::DNS
resolver by default, I want to change max_outstanding
, reuse
, timeout
.
There is an environment variable $ENV{PERL_ANYEVENT_MAX_OUTSTANDING_DNS}
, but how to change reuse
and timeout
?
$ENV{PERL_ANYEVENT_MAX_OUTSTANDING_DNS}
is only used if the default resolver is used, so you must be using the default resolver, so you can just change the default resolver.
use AnyEvent::DNS qw( );
my $resolver = AnyEvent::DNS->new(
untaint => 1,
max_outstanding => $ENV{PERL_ANYEVENT_MAX_OUTSTANDING_DNS}*1 || ...,
reuse => ...,
timeout => ...,
);
$ENV{PERL_ANYEVENT_RESOLV_CONF}
? $resolver->_load_resolv_conf_file($ENV{PERL_ANYEVENT_RESOLV_CONF})
: $resolver->os_config;
$AnyEvent::DNS::RESOLVER = $resolver;