class Inspec::Resources::Host

def initialize(hostname, params = {})

def initialize(hostname, params = {})
  @hostname = hostname
  @port = params[:port]
  if params[:proto]
    warn '[DEPRECATION] The `proto` parameter is deprecated. Use `protocol` instead.'
    @protocol = params[:proto]
  else
    @protocol = params.fetch(:protocol, 'icmp')
  end
  @host_provider = nil
  if inspec.os.linux?
    @host_provider = LinuxHostProvider.new(inspec)
  elsif inspec.os.windows?
    return skip_resource 'Invalid protocol: only `tcp` and `icmp` protocols are support for the `host` resource on your OS.' unless
      %w{icmp tcp}.include?(@protocol)
    @host_provider = WindowsHostProvider.new(inspec)
  elsif inspec.os.darwin?
    @host_provider = DarwinHostProvider.new(inspec)
  else
    return skip_resource 'The `host` resource is not supported on your OS yet.'
  end
  missing_requirements = @host_provider.missing_requirements(protocol)
  return skip_resource 'The following requirements are not met for this resource: ' \
    "#{missing_requirements.join(', ')}" unless missing_requirements.empty?
end