8.6. HostResolver¶
-
class
safeguard.sessions.plugin.host_resolver.
HostResolver
¶ The
HostResolver
class represents a utility class to access DNS services.Do not instantiate
HostResolver
with its constructor, rather use thefrom_config()
method.-
classmethod
from_config
(plugin_configuration)¶ The
from_config()
method creates an instance of HostResolver service.- Parameters
plugin_configuration (
PluginConfiguration
) – plugin configuration object- Returns
HostResolver instance
- Return type
-
resolve_hosts_by_ip
(ip_address)¶ The
resolve_hosts_by_ip()
method uses the DNS service to resolve a given IP address into a list of the primary fully qualified domain name and possible alias names.- Parameters
ip_address (str) – the IP address to resolve
- Returns
list of host names
- Raises
socket.error
-
classmethod