POE::Component::Server::DNS

A non-blocking, concurrent DNS server POE component
Download

POE::Component::Server::DNS Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Chris Williams
  • Publisher web site:
  • http://search.cpan.org/~bingos/

POE::Component::Server::DNS Tags


POE::Component::Server::DNS Description

A non-blocking, concurrent DNS server POE component POE::Component::Server::DNS is a POE component that implements a DNS server.It uses POE::Component::Client::DNS to handle resolving when configured as 'forward_only' and Net::DNS::Resolver::Recurse wrapped by POE::Component::Generic to perform recursion.One may add handlers to massage and manipulate responses to particular queries which is vaguely modelled after Net::DNS::Nameserver.SYNOPSIS use strict; use Net::DNS::RR; use POE qw(Component::Server::DNS); my $dns_server = POE::Component::Server::DNS->spawn( alias => 'dns_server' ); POE::Session->create( package_states => , ], ); $poe_kernel->run(); exit 0; sub _start { my ($kernel,$heap) = @_; # Tell the component that we want log events to go to 'log' $kernel->post( 'dns_server', 'log_event', 'log' ); # register a handler for any foobar.com suffixed domains $kernel->post( 'dns_server', add_handler, { event => 'handler', label => 'foobar', match => 'foobar.com$', } ); undef; } sub handler { my ($qname,$qclass,$qtype,$callback) = @_; my ($rcode, @ans, @auth, @add); if ($qtype eq "A") { my ($ttl, $rdata) = (3600, "10.1.2.3"); push @ans, Net::DNS::RR->new("$qname $ttl $qclass $qtype $rdata"); $rcode = "NOERROR"; } else { $rcode = "NXDOMAIN"; } $callback->($rcode, @ans, @auth, @add, { aa => 1 }); undef; } sub log { my ($ip_port,$net_dns_packet) = @_; $net_dns_packet->print(); undef; } Requirements: · Perl


POE::Component::Server::DNS Related Software