File: dns.rst

package info (click to toggle)
python-gevent 25.9.1-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 22,036 kB
  • sloc: python: 170,894; ansic: 82,360; sh: 6,265; makefile: 1,550; javascript: 108
file content (38 lines) | stat: -rw-r--r-- 1,318 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
=======================
 Name Resolution (DNS)
=======================

gevent includes support for a pluggable hostname resolution system.
Pluggable resolvers are (generally) intended to be cooperative.
This pluggable resolution system is used automatically when the system
is :mod:`monkey patched <gevent.monkey>`, and may be used manually
through the :attr:`resolver attribute <gevent.hub.Hub.resolver>` of the
:class:`gevent.hub.Hub` or the corresponding methods in the
:mod:`gevent.socket` module.

A resolver implements the 5 standandard functions from the
:mod:`socket` module for resolving hostnames and addresses:

* :func:`socket.gethostbyname`
* :func:`socket.gethostbyname_ex`
* :func:`socket.getaddrinfo`
* :func:`socket.gethostbyaddr`
* :func:`socket.getnameinfo`

Configuration
=============

gevent includes four implementations of resolvers, and applications
can provide their own implementation. By default, gevent uses
:class:`a threadpool <gevent.resolver.thread.Resolver>`. This can
:attr:`be customized <gevent._config.Config.resolver>`.

Please see the documentation for each resolver class to understand the
relative performance and correctness tradeoffs.

.. toctree::

   api/gevent.resolver.thread
   api/gevent.resolver.ares
   api/gevent.resolver.dnspython
   api/gevent.resolver.blocking