diff options
author | Riccardo Spagni <ric@spagni.net> | 2014-10-06 08:51:44 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2014-10-06 08:52:16 +0200 |
commit | 3463f0ab52a84b79977c3e67177637e62265c89c (patch) | |
tree | 1e2077aa15fa18fcc9b00fa23c9514d46df6ef95 /external/unbound/pythonmod/doc/examples/example2.rst | |
parent | fix for miniupnpc static compile under Windows (diff) | |
parent | added aabramov's gpg key (diff) | |
download | monero-3463f0ab52a84b79977c3e67177637e62265c89c.tar.xz |
Merge pull request #171
32be6ae added aabramov's gpg key (Riccardo Spagni)
010bfcf minor English wordlist tweaks (Riccardo Spagni)
9ef094b added unbound to external deps (Riccardo Spagni)
732493c split mnemonic printout over 3 lines (Riccardo Spagni)
Diffstat (limited to 'external/unbound/pythonmod/doc/examples/example2.rst')
-rw-r--r-- | external/unbound/pythonmod/doc/examples/example2.rst | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/external/unbound/pythonmod/doc/examples/example2.rst b/external/unbound/pythonmod/doc/examples/example2.rst new file mode 100644 index 000000000..f00fcc239 --- /dev/null +++ b/external/unbound/pythonmod/doc/examples/example2.rst @@ -0,0 +1,46 @@ +Response generation +===================== + +This example shows how to handle queries and generate response packet. + +.. note:: + If the python module is the first module and validator module is enabled (``module-config: "python validator iterator"``), + a return_msg security flag has to be set at least to 2. Leaving security flag untouched causes that the + response will be refused by unbound worker as unbound will consider it as non-valid response. + +Complete source code +-------------------- + +.. literalinclude:: ../../examples/resgen.py + :language: python + +Testing +------- + +Run the unbound server: + +``root@localhost>unbound -dv -c ./test-resgen.conf`` + +Query for a A record ending with .localdomain + +``dig A test.xxx.localdomain @127.0.0.1`` + +Dig produces the following output:: + + ;; global options: printcmd + ;; Got answer: + ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 48426 + ;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0 + + ;; QUESTION SECTION: + ;test.xxx.localdomain. IN A + + ;; ANSWER SECTION: + test.xxx.localdomain. 10 IN A 127.0.0.1 + + ;; Query time: 2 msec + ;; SERVER: 127.0.0.1#53(127.0.0.1) + ;; WHEN: Mon Jan 01 12:46:02 2009 + ;; MSG SIZE rcvd: 54 + +As we handle (override) in python module only queries ending with "localdomain.", the unboud can still resolve host names. |