diff options
author | anonimal <anonimal@i2pmail.org> | 2017-06-28 21:07:24 +0000 |
---|---|---|
committer | anonimal <anonimal@i2pmail.org> | 2018-03-18 15:52:19 +0000 |
commit | 84c5a9ba481d7a33cc0fd0ca43867b61d127d907 (patch) | |
tree | f05d3d3f107da02005b4a61f0e5074c113a7165c /external/unbound/libunbound/python/doc/examples/example1b.rst | |
parent | Merge pull request #3416 (diff) | |
download | monero-84c5a9ba481d7a33cc0fd0ca43867b61d127d907.tar.xz |
Unbound: remove unbound from in-tree source
We'll instead use a git submodule to pull from our unbound repo.
Diffstat (limited to 'external/unbound/libunbound/python/doc/examples/example1b.rst')
-rw-r--r-- | external/unbound/libunbound/python/doc/examples/example1b.rst | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/external/unbound/libunbound/python/doc/examples/example1b.rst b/external/unbound/libunbound/python/doc/examples/example1b.rst deleted file mode 100644 index 1adae2cb1..000000000 --- a/external/unbound/libunbound/python/doc/examples/example1b.rst +++ /dev/null @@ -1,37 +0,0 @@ -.. _example_reverse_lookup: - -Reverse DNS lookup -================== - -Reverse DNS lookup involves determining the hostname associated with a given IP -address. -This example shows how reverse lookup can be done using unbound module. - -For the reverse DNS records, the special domain in-addr.arpa is reserved. -For example, a host name for the IP address ``74.125.43.147`` can be obtained -by issuing a DNS query for the PTR record for address -``147.43.125.74.in-addr.arpa.`` - -Source code ------------ - -:: - - #!/usr/bin/python - import unbound - - ctx = unbound.ub_ctx() - ctx.resolvconf("/etc/resolv.conf") - - status, result = ctx.resolve(unbound.reverse("74.125.43.147") + ".in-addr.arpa.", unbound.RR_TYPE_PTR, unbound.RR_CLASS_IN) - if status == 0 and result.havedata: - print "Result.data:", result.data.domain_list - elif status != 0: - print "Resolve error:", unbound.ub_strerror(status) - -In order to simplify the python code, unbound module contains the -:meth:`unbound.reverse` function which reverses the hostname components. -This function is defined as follows:: - - def reverse(domain): - return '.'.join([a for a in domain.split(".")][::-1]) |