Unverified Commit df7f1747 authored by Gavin Brown's avatar Gavin Brown
Browse files

accept command-line arguments

parent e5a18214
......@@ -10,19 +10,25 @@ use strict;
my @types = qw(application/dns-message application/dns-udpwireformat);
my $laddr = '127.0.0.1';
my $lport = '8080';
my $addr = '127.0.0.1';
my $port = '8080';
my $raddr = '127.0.0.1';
GetOptions(
'addr=s' => \$addr,
'port=i' => \$port,
'resolver=s' => \$raddr,
);
my $resolver = Net::DNS::Resolver->new('nameservers' => [ $raddr ]);
my $server = HTTP::Daemon->new(
'LocalAddr' => $laddr,
'LocalPort' => $lport,
'LocalAddr' => $addr,
'LocalPort' => $port,
);
if (!$server) {
printf(STDERR "Unable to start server on %s:%u: %s\n", $laddr, $lport, $@);
chomp($@);
printf(STDERR "Unable to start server on %s:%u: %s\n", $addr, $port, $@);
exit(1);
} else {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment