From: Bert Hubert Date: Thu, 12 Jun 2008 18:32:49 +0000 (+0000) Subject: simple example script that shows some techniques X-Git-Tag: rec-3.1.7.1~46 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=de851209bcfa36252abb311ddbd8e38d52040e3b;p=thirdparty%2Fpdns.git simple example script that shows some techniques git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@1195 d19b8d6e-7fed-0310-83ef-9ca221ded41b --- diff --git a/pdns/powerdns-example-script.lua b/pdns/powerdns-example-script.lua new file mode 100644 index 0000000000..8f709b95a7 --- /dev/null +++ b/pdns/powerdns-example-script.lua @@ -0,0 +1,35 @@ +function prequery ( ip, domain, qtype ) + print ("prequery handler called for: ", ip, domain, qtype) + ret = {} + + ret[0]= {1, "9.8.7.6", 3601}; + ret[1]= {1, "10.11.12.13", 3601}; + ret[2]= {1, "11.12.13.14", 3601}; + + if domain == "www.ds9c.nl." + then + print "dealing!" + return 1, ret + else + print "not dealing!" + return false, ret + end +end + +function nxdomain ( ip, domain, qtype ) + print ("nxhandler called for: ", ip, domain, qtype) + ret={} + if qtype ~= 1 then return false, ret end -- only A records + if not string.match(domain, "^www.") then return false, ret end -- only things that start with www. + + if matchnetmask(ip, "127.0.0.1/8") + then + print "dealing" + ret[0]={1, "127.1.2.3", 3602} + ret[1]={15, "25 ds9a.nl", 3602} + return 1, ret + else + print "not dealing" + return false, ret + end +end