4 This example shows how to modify the response produced by the ``iterator`` module.
6 As soon as the iterator module returns the response, we :
8 1. invalidate the data in cache
9 2. modify the response *TTL*
10 3. rewrite the data in cache
11 4. return modified packet
13 Note that the steps 1 and 3 are neccessary only in case, the python module is the first module in the processing chain.
14 In other cases, the validator module guarantees updating data which are produced by iterator module.
19 .. literalinclude:: ../../examples/resmod.py
27 ``root@localhost>unbound -dv -c ./test-resmod.conf``
29 Issue a query for name ending with "nic.cz."
31 ``>>>dig A @127.0.0.1 www.nic.cz``
35 ;; global options: printcmd
37 ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 48831
38 ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 3, ADDITIONAL: 5
44 www.nic.cz. 10 IN A 217.31.205.50
47 nic.cz. 10 IN NS e.ns.nic.cz.
48 nic.cz. 10 IN NS a.ns.nic.cz.
49 nic.cz. 10 IN NS c.ns.nic.cz.
51 ;; ADDITIONAL SECTION:
52 a.ns.nic.cz. 10 IN A 217.31.205.180
53 a.ns.nic.cz. 10 IN AAAA 2001:1488:dada:176::180
54 c.ns.nic.cz. 10 IN A 195.66.241.202
55 c.ns.nic.cz. 10 IN AAAA 2a01:40:1000::2
56 e.ns.nic.cz. 10 IN A 194.146.105.38
58 ;; Query time: 166 msec
59 ;; SERVER: 127.0.0.1#53(127.0.0.1)
60 ;; WHEN: Mon Jan 02 13:39:43 2009
63 As you can see, TTL of all the records is set to 10.