]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
simple example script that shows some techniques
authorBert Hubert <bert.hubert@netherlabs.nl>
Thu, 12 Jun 2008 18:32:49 +0000 (18:32 +0000)
committerBert Hubert <bert.hubert@netherlabs.nl>
Thu, 12 Jun 2008 18:32:49 +0000 (18:32 +0000)
git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@1195 d19b8d6e-7fed-0310-83ef-9ca221ded41b

pdns/powerdns-example-script.lua [new file with mode: 0644]

diff --git a/pdns/powerdns-example-script.lua b/pdns/powerdns-example-script.lua
new file mode 100644 (file)
index 0000000..8f709b9
--- /dev/null
@@ -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