<div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">Hi!</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">Many thanks for your quick and helpful answers, I will try your suggestions ASAP!</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">Best regards,</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">Vivien<br></div></div><br><div class="gmail_quote"><div dir="ltr">Le mar. 16 oct. 2018 à 17:23, George Thessalonikefs via Unbound-users <<a href="mailto:unbound-users@nlnetlabs.nl">unbound-users@nlnetlabs.nl</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Vivien,<br>
<br>
<br>
On 14/10/2018 17:38, Vivien Malerba via Unbound-users wrote:<br>
> Hi!<br>
> I'm using the unbound server in a not yet published open source project,<br>
> specifically the python module to enable filtering of queries (for<br>
> example depending on the client's IP address).<br>
> <br>
> Currently I can't have my python called everytime a query is processed,<br>
> is there a way of configuring unbound so that the operate() function is<br>
> called even though the server already has the answer in its cache?<br>
> <br>
> If not in Python, is there a mechanism to extend unbound in C?<br>
<br>
The python module is part of the module logic in unbound (together with<br>
the validator and iterator modules for example) and by default the<br>
operate() function is supposed to be called when it is the module's time<br>
of execution.<br>
The modules start after unbound couldn't answer with local data or from<br>
cache.<br>
<br>
However since version 1.6.0 there is the possibility to register inplace<br>
callback functions that will be called just before:<br>
- replying with local data or Chaos (CH),<br>
- replying from cache,<br>
- replying with SERVFAIL,<br>
- replying with a resolved query.<br>
<br>
Since version 1.8.0 the client's IP address is also available when<br>
replying with local data and from cache.<br>
<br>
You can register inplace callback functions during your module's (either<br>
C or Python) initialization.<br>
<br>
> <br>
> Also, it's very difficult to find documentation about the python module,<br>
> the old documentation seems to have been removed, replaced by a page<br>
> stating "/4 April 2018/ We are in the final stages of creating this part<br>
> of the documentation. Please check back in a few days. If there is<br>
> anything specific you are searching for, do not hestitate to contact us<br>
> <<a href="https://www.nlnetlabs.nl/documentation/unbound/pythonmod/labs-email" rel="noreferrer" target="_blank">https://www.nlnetlabs.nl/documentation/unbound/pythonmod/labs-email</a>>>."<br>
> Is there any book or more current documentation available?<br>
<br>
We changed our website's design and unfortunately we didn't have time to<br>
incorporate sphinx's output to the new design yet.<br>
<br>
For now you can build the Python module documentation from source by<br>
compiling '--with-pythonmodule' (which I think you already do), making<br>
sure that you have sphinx installed and running<br>
        make doc<br>
<br>
The documentation will be generated in doc/html/pythonmod.<br>
You could take a look at the example named 'Inplace callbacks'.<br>
<br>
I hope that helps,<br>
-- George<br>
</blockquote></div>