proxyprotocol.dnsbl
¶
- class proxyprotocol.dnsbl.Dnsbl[source]¶
Manages the optional lookup of the connecting IP address against a trusted DNSBL.
- abstract async lookup(sock_info, *, loop=None)[source]¶
Looks up the connecting IP address and returns the DNSBL hostname and the lookup result. Any timeout or misconfiguration is treated as an empty result.
- Parameters:
sock_info (SocketInfo) – The connection socket info.
loop (AbstractEventLoop | None)
- Return type:
str | None
- classmethod load(host, *, timeout=None)[source]¶
Given a DNSBL hostname, returns a
Dnsbl
implementation that best suits the given host.- Parameters:
- Raises:
ValueError – The host is invalid for this
Dnsbl
.- Return type:
- class proxyprotocol.dnsbl.NoopDnsbl[source]¶
Disables DNSBL lookup altogether,
lookup()
always returnsNone
.- async lookup(sock_info, *, loop=None)[source]¶
Looks up the connecting IP address and returns the DNSBL hostname and the lookup result. Any timeout or misconfiguration is treated as an empty result.
- Parameters:
sock_info (SocketInfo) – The connection socket info.
loop (AbstractEventLoop | None)
- Return type:
str | None
- class proxyprotocol.dnsbl.BasicDnsbl(host, timeout)[source]¶
A basic
Dnsbl
implementation that simply returns the DNSBL hostname if the DNS lookup returns any IP addresses.- map_results(addresses)[source]¶
Given a list of IP address results from a DNSBL lookup, return a single string categorizing the results or
None
to discard them.- Parameters:
addresses (Sequence[IPv4Address]) – The list of IP address results.
- Return type:
str | None
- async lookup(sock_info, *, loop=None)[source]¶
Looks up the connecting IP address and returns the DNSBL hostname and the lookup result. Any timeout or misconfiguration is treated as an empty result.
- Parameters:
sock_info (SocketInfo) – The connection socket info.
loop (AbstractEventLoop | None)
- Return type:
str | None
- class proxyprotocol.dnsbl.SpamhausDnsbl(host, timeout)[source]¶
A
Dnsbl
designed for querying Spamhaus DNSBLs.- map_results(addresses)[source]¶
Given a list of IP address results from a DNSBL lookup, return a single string categorizing the results or
None
to discard them.- Parameters:
addresses (Sequence[IPv4Address]) – The list of IP address results.
- Return type:
str | None