#!/usr/bin/perl

use warnings;
use strict;

use Net::DNS::Nameserver;

my $LISTEN_IP = "127.0.0.1";
my $DUMMY_IP  = "127.0.0.1";

my $ns = Net::DNS::Nameserver->new(
    LocalAddr    => $LISTEN_IP,
    LocalPort    => "5353",
    ReplyHandler => \&reply_handler,
    Verbose      => 1,
) or die;

$ns->main_loop();

sub reply_handler {
    my ($qname, $qclass, $qtype, $peerhost, $query, $conn) = @_;

    return (
	"NOERROR",
	[ Net::DNS::RR->new("$qname 60 $qclass $qtype $DUMMY_IP") ],
	[],
	[],
	{ ra => 1 },
    );
}
