get_rdns_async¶
-
async
privex.helpers.net.
get_rdns_async
(host: Union[str, ipaddress.IPv4Address, ipaddress.IPv6Address], throw=True, version='any', name_port=80) → Optional[str][source]¶ AsyncIO version of
get_rdns()
- get the reverse DNS for a given host (IP address or domain)>>> from privex.helpers import get_rdns_async >>> await get_rdns_async('185.130.44.10') 'web-se1.privex.io' >>> await get_rdns_async('2a07:e00::333') 'se.dns.privex.io' >>> await get_rdns_async('privex.io') 'web-se1.privex.io'
- Parameters
host (str|IPv4Address|IPv6Address) – An IPv4/v6 address, or domain to lookup reverse DNS for.
throw (bool) – (Default:
True
) WhenTrue
, will raiseReverseDNSNotFound
orInvalidHost
when no rDNS records can be found forhost
, or whenhost
is an invalid IP / non-existent domain. WhenFalse
, will simply returnNone
whenhost
is invalid, or no rDNS records are found.version (str|int) – IP version to use when looking up a domain/hostname (default:
'any'
)name_port (int) – This generally isn’t important. This port is passed to
loop.getnameinfo()
when looking up the reverse DNS forhost
. Usually there’s no reason to change this from the default.
- Raises
ReverseDNSNotFound – When
throw
is True and no rDNS records were found forhost
InvalidHost – When
throw
is True andhost
is an invalid IP address or non-existent domain/hostname
- Return Optional[str] rDNS
The reverse DNS hostname for
host
(value of PTR record)