Sha256: a0d75156cdef24d27954e83d9e6253e639aae5a9bbcb75fc471608cf82fe3fa8

Contents?: true

Size: 528 Bytes

Versions: 1

Compression:

Stored size: 528 Bytes

Contents

# frozen_string_literal: true
module Netchk
  class DNSResolvVerifier
    def initialize(**options)
      @domains = options['domains'] || %w[google.com youtube.com facebook.com]
      @resolv_conf = options['resolv.conf']
    end

    def verify
      ::Resolv::DNS.open(@resolv_conf) do |dns|
        @domains.each do |domain|
          begin
            dns.getaddress(domain)
          rescue ::Resolv::ResolvError
            $stderr.puts "Failed to resolve #{domain}"
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
netchk-0.0.1 lib/netchk/dns_resolv_verifier.rb