Python module questions
George Thessalonikefs
george at nlnetlabs.nl
Tue Oct 16 15:22:46 UTC 2018
Hi Vivien,
On 14/10/2018 17:38, Vivien Malerba via Unbound-users wrote:
> Hi!
> I'm using the unbound server in a not yet published open source project,
> specifically the python module to enable filtering of queries (for
> example depending on the client's IP address).
>
> Currently I can't have my python called everytime a query is processed,
> is there a way of configuring unbound so that the operate() function is
> called even though the server already has the answer in its cache?
>
> If not in Python, is there a mechanism to extend unbound in C?
The python module is part of the module logic in unbound (together with
the validator and iterator modules for example) and by default the
operate() function is supposed to be called when it is the module's time
of execution.
The modules start after unbound couldn't answer with local data or from
cache.
However since version 1.6.0 there is the possibility to register inplace
callback functions that will be called just before:
- replying with local data or Chaos (CH),
- replying from cache,
- replying with SERVFAIL,
- replying with a resolved query.
Since version 1.8.0 the client's IP address is also available when
replying with local data and from cache.
You can register inplace callback functions during your module's (either
C or Python) initialization.
>
> Also, it's very difficult to find documentation about the python module,
> the old documentation seems to have been removed, replaced by a page
> stating "/4 April 2018/ We are in the final stages of creating this part
> of the documentation. Please check back in a few days. If there is
> anything specific you are searching for, do not hestitate to contact us
> <https://www.nlnetlabs.nl/documentation/unbound/pythonmod/labs-email>>."
> Is there any book or more current documentation available?
We changed our website's design and unfortunately we didn't have time to
incorporate sphinx's output to the new design yet.
For now you can build the Python module documentation from source by
compiling '--with-pythonmodule' (which I think you already do), making
sure that you have sphinx installed and running
make doc
The documentation will be generated in doc/html/pythonmod.
You could take a look at the example named 'Inplace callbacks'.
I hope that helps,
-- George
More information about the Unbound-users
mailing list