]> granicus.if.org Git - pdns/commitdiff
Change 'split horizon' section into 'lua policy functoin' section
authorbert hubert <bert.hubert@netherlabs.nl>
Fri, 29 Jan 2016 18:30:12 +0000 (19:30 +0100)
committerbert hubert <bert.hubert@netherlabs.nl>
Fri, 29 Jan 2016 18:30:12 +0000 (19:30 +0100)
pdns/README-dnsdist.md

index 292d666733c8c8be8a6480b6417475679c85bc1a..ee36e777903a214eb94e33b239cbf85cb1070321 100644 (file)
@@ -585,27 +585,29 @@ setServerPolicyLua("luaroundrobin", luaroundrobin)
 Incidentally, this is similar to setting: `setServerPolicy(roundrobin)`
 which uses the C++ based roundrobin policy.
 
-Split horizon
--------------
-
-To implement a split horizon, try:
+Lua server policies 
+-------------------
+If the built in rules do not suffice to pick a server pool, full flexibility is available from Lua. For example:
 
 ```
-authServer=newServer({address="2001:888:2000:1d::2", pool="auth"})
+newServer("192.168.1.2")
+newServer({address="8.8.4.4", pool="numbered"})
 
 function splitSetup(servers, dq)
-        if(dq.dh:getRD() == false)
-        then
-               return leastOutstanding.policy(getPoolServers("auth"), dq)
-        else
-               return leastOutstanding.policy(servers, dq)
-        end
+         if(string.match(dq.qname:toString(), "%d"))
+         then
+                print("numbered pool")
+                return leastOutstanding.policy(getPoolServers("numbered"), dq)
+         else
+                print("standard pool")
+                return leastOutstanding.policy(servers, dq)
+         end
 end
 
 setServerPolicyLua("splitsetup", splitSetup)
 ```
 
-This will forward queries that don't want recursion to the pool of auth
+This will forward queries containing a number to the pool of "numbered" 
 servers, and will apply the default load balancing policy to all other
 queries.