New in version 0.3.21.
When a client connects to the server, it is useful to know who they claim to be. One such method is looking up the PTR records for the client’s IP address in DNS. If it exists, a PTR record will map an IP address to an arbitrary hostname.
However, it is not usually desired to slow down a client’s request just because
their PTR record lookup has not yet finished. This module implements a
Greenlet thread that will look up a client’s PTR record will
its request is being processed. If the request finishes before the PTR record
lookup, the lookup is stopped.
- class slimta.util.ptrlookup.PtrLookup(ip)¶
Asynchronously looks up the PTR record of an IP address, implemented as a
ip – The IP address to query.
- classmethod from_getpeername(cls, sock)¶
- classmethod from_getsockname(cls, sock)¶
Attempts to get the results of the PTR lookup. If the results are not available,
Noneis returned instead.
When this method returns, the
Greenletexecuting the lookup is killed.
runtime (float) – If this many seconds have not passed since the lookup started, the method call blocks the remaining time. For example, if 3.5 seconds have elapsed since calling
start()and you pass in
5.0, this method will wait at most 1.5 seconds for the results to come in.
The PTR lookup results (a hostname string) or