#!/usr/bin/perl -w -T
BEGIN {
if
(
$ENV
{PERL5LIB} &&
$ENV
{PERL5LIB}=~m%^([\w\-\./:]+)$%) {
foreach
(
split
/:/,$1) {
unshift
(
@INC
,
$_
);
}
}
}
my
$options_ref
= {};
my
$zone_ref
= {};
&Net::DNSServer::ConfParser::load_configuration
({
conf_file
=>
"conf/named.conf"
,
opts_callback
=>
sub
{
my
$field
=
shift
;
my
$value
=
shift
;
$value
=~ s/^
"(.*)"
$/$1/;
$options_ref
->{
$field
} =
$value
;
},
zone_callback
=>
sub
{
my
$zone
=
shift
;
my
$class
=
shift
;
my
$field
=
shift
;
my
$value
=
shift
;
$zone
=~ s/\.*$/./;
$value
=~ s/^
"(.*)"
$/$1/;
die
"Unimplemented class [$class]"
if
$class
&&
$class
ne
"IN"
;
$zone_ref
->{
$zone
}->{
$field
} =
$value
;
},
});
print
Data::Dumper->Dump([
$options_ref
,
$zone_ref
],
qw($options $zone)
);
my
$cache_resolver
= new Net::DNSServer::SharedCache {
ipc_key
=>
"DNSk"
,
max_size
=> 0,
fresh
=> 1,
};
my
$proxy_resolver
= new Net::DNSServer::Proxy;
run Net::DNSServer {
priority
=> [
$cache_resolver
,
$proxy_resolver
],
};
exit
;