class HostValidator {

    HostValidationResult validateHost(final String host) {
        if (blockedAddresses.isEmpty()) {
            // If not even localhost is blocked, then permit even private, loopback, multicast and wildcard IPs.
            return HostValidationResult.valid();
        } else if (allowedHostnames.contains(host)) {
            // the host is contained in the allow-list, do not block
            return HostValidationResult.valid();
        } else {
            // Forbid blocked, private, loopback, multicast and wildcard IPs.
            try {
                final InetAddress[] inetAddresses = resolver.resolve(host);
                for (final InetAddress requestAddress : inetAddresses) {
                    if (requestAddress.isLoopbackAddress()) {
                        return HostValidationResult.blocked(host, "the hostname resolved to a loopback address.");
                    } else if (requestAddress.isSiteLocalAddress()) {
                        return HostValidationResult.blocked(host, "the hostname resolved to a site local address.");
                    } else if (requestAddress.isMulticastAddress()) {
                        return HostValidationResult.blocked(host, "the hostname resolved to a multicast address.");
                    } else if (requestAddress.isAnyLocalAddress()) {
                        return HostValidationResult.blocked(host, "the hostname resolved to a wildcard address.");
                    } else if (blockedAddresses.contains(requestAddress)) {
                        // host is contained in the blocklist --> block
                        return HostValidationResult.blocked(host);
                    }
                }
                return HostValidationResult.valid();
            } catch (UnknownHostException e) {
                final String reason = String.format("The configured host '%s' is invalid: %s", host, e.getMessage());
                return HostValidationResult.invalid(host, reason);
            }
        }
    }

      HostValidator(final ConnectivityConfig connectivityConfig, final LoggingAdapter loggingAdapter);
      HostValidator(final ConnectivityConfig connectivityConfig, final LoggingAdapter loggingAdapter,
            final AddressResolver resolver);

}