All Projects → saghul → Aiodns

saghul / Aiodns

Licence: mit
Simple DNS resolver for asyncio

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Aiodns

Dnspython
a powerful DNS toolkit for python
Stars: ✭ 1,838 (+396.76%)
Mutual labels:  asyncio, dns
V3n0m Scanner
Popular Pentesting scanner in Python3.6 for SQLi/XSS/LFI/RFI and other Vulns
Stars: ✭ 847 (+128.92%)
Mutual labels:  asyncio, dns
Dns
Async DNS resolver for ReactPHP.
Stars: ✭ 342 (-7.57%)
Mutual labels:  dns
Packetq
A tool that provides a basic SQL-frontend to PCAP-files
Stars: ✭ 363 (-1.89%)
Mutual labels:  dns
Which Dns
Detects which DNS server is being used
Stars: ✭ 360 (-2.7%)
Mutual labels:  dns
Graphql Core
A Python 3.6+ port of the GraphQL.js reference implementation of GraphQL.
Stars: ✭ 344 (-7.03%)
Mutual labels:  asyncio
Kadnode
P2P DNS with content key, crypto key and PKI support. DynDNS alternative.
Stars: ✭ 359 (-2.97%)
Mutual labels:  dns
Anyio
High level compatibility layer for multiple asynchronous event loop implementations on Python
Stars: ✭ 343 (-7.3%)
Mutual labels:  asyncio
Smartdns
A local DNS server to obtain the fastest website IP for the best Internet experience, 一个本地DNS服务器,获取最快的网站IP,获得最佳上网体验。
Stars: ✭ 4,333 (+1071.08%)
Mutual labels:  dns
Aiozmq
Asyncio (pep 3156) integration with ZeroMQ
Stars: ✭ 358 (-3.24%)
Mutual labels:  asyncio
Picoweb
Really minimal web application framework for the Pycopy project (minimalist Python dialect) and its "uasyncio" async framework
Stars: ✭ 361 (-2.43%)
Mutual labels:  asyncio
Example Hftish
Example Order Book Imbalance Algorithm
Stars: ✭ 355 (-4.05%)
Mutual labels:  asyncio
Micropython Async
Application of uasyncio to hardware interfaces. Tutorial and code.
Stars: ✭ 348 (-5.95%)
Mutual labels:  asyncio
Docker Pi Hole
Pi-hole in a docker container
Stars: ✭ 4,288 (+1058.92%)
Mutual labels:  dns
Ahk
Python wrapper for AutoHotkey. Harness the automation power of AutoHotkey with the beauty of Python.
Stars: ✭ 343 (-7.3%)
Mutual labels:  asyncio
Github Stats
Better GitHub statistics images for your profile, no external server required
Stars: ✭ 338 (-8.65%)
Mutual labels:  asyncio
Open dnsdb
OpenDnsdb 是去哪儿网OPS团队开源的基于Python语言的DNS管理系统
Stars: ✭ 345 (-6.76%)
Mutual labels:  dns
Js.org
Dedicated to JavaScript and its awesome community since 2015
Stars: ✭ 3,996 (+980%)
Mutual labels:  dns
Stig
TUI and CLI for the BitTorrent client Transmission
Stars: ✭ 360 (-2.7%)
Mutual labels:  asyncio
Userge
Userge, Durable as a Serge
Stars: ✭ 363 (-1.89%)
Mutual labels:  asyncio

=============================== Simple DNS resolver for asyncio

.. image:: https://secure.travis-ci.org/saghul/aiodns.svg?branch=master :target: http://travis-ci.org/saghul/aiodns

aiodns provides a simple way for doing asynchronous DNS resolutions using pycares <https://github.com/saghul/pycares>_.

Example

.. code:: python

import asyncio
import aiodns

loop = asyncio.get_event_loop()
resolver = aiodns.DNSResolver(loop=loop)

async def query(name, query_type):
    return await resolver.query(name, query_type)

coro = query('google.com', 'A')
result = loop.run_until_complete(coro)

The following query types are supported: A, AAAA, ANY, CNAME, MX, NAPTR, NS, PTR, SOA, SRV, TXT.

API

The API is pretty simple, three functions are provided in the DNSResolver class:

  • query(host, type): Do a DNS resolution of the given type for the given hostname. It returns an instance of asyncio.Future. The actual result of the DNS query is taken directly from pycares. As of version 1.0.0 of aiodns (and pycares, for that matter) results are always namedtuple-like objects with different attributes. Please check the documentation <http://pycares.readthedocs.org/en/latest/channel.html#pycares.Channel.query>_ for the result fields.
  • gethostbyname(host, socket_family): Do a DNS resolution for the given hostname and the desired type of address family (i.e. socket.AF_INET). While query() always performs a request to a DNS server, gethostbyname() first looks into /etc/hosts and thus can resolve local hostnames (such as localhost). Please check the documentation <http://pycares.readthedocs.io/en/latest/channel.html#pycares.Channel.gethostbyname>_ for the result fields. The actual result of the call is a asyncio.Future.
  • gethostbyaddr(name): Make a reverse lookup for an address.
  • cancel(): Cancel all pending DNS queries. All futures will get DNSError exception set, with ARES_ECANCELLED errno.

Running the test suite

To run the test suite: python tests.py

Author

Saúl Ibarra Corretgé [email protected]

License

aiodns uses the MIT license, check LICENSE file.

Python versions

Python >= 3.5 are supported.

Contributing

If you'd like to contribute, fork the project, make a patch and send a pull request. Have a look at the surrounding code and please, make yours look alike :-)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].