Leser: 1
7 Einträge, 1 Seite |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/perl -W
package Net::DNS::Method::Dummy;
use Net::DNS::Method;
use Net::DNS;
our @ISA = qw(Net::DNS::Method);
sub new { bless [], $_[0]; }
sub A {
my $self = shift;
my $q = shift;
my $a = shift;
$a->header->rcode('NOERROR');
$a->push('answer', new Net::DNS::RR $q->qname . ' 10 IN A 1.1.1.1');
return NS_OK;
}
package main;
use Net::DNS;
use Net::DNS::Method;
use Net::DNS::Server;
my $method = Net::DNS::Method::Dummy->new;
my $server = new Net::DNS::Server ('5.5.5.5:53', [ $method ])
or die "Cannot create server object: $!";
while($server->get_question()) {
$server->process;
$server->send_response();
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/perl -W
package Net::DNS::Method::Dummy;
package Proc::Daemon::Init;
use Net::DNS::Method;
use Net::DNS;
use Proc::Daemon;
our @ISA = qw(Net::DNS::Method);
sub new { bless [], $_[0]; }
sub A {
my $self = shift;
.
.
.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
package MyDaemon;
# ...
sub run {
my $self = shift;
unless($^O eq 'MSWin32') {
# run as real daemon - but not under windows
require Proc::Daemon;
Proc::Daemon::Init();
}
}
1;
1
2
3
4
5
6
#!/usr/bin/perl -W
package Net::DNS::Method::Dummy;
package Proc::Daemon::Init;
use Net::DNS::Method;
use Net::DNS;
use Proc::Daemon;
7 Einträge, 1 Seite |