Module: DnsChecker
- Defined in:
- lib/dns_checker.rb,
lib/dns_checker/domain.rb,
lib/dns_checker/version.rb,
lib/dns_checker/nameserver.rb
Defined Under Namespace
Classes: Domain, Nameserver
Constant Summary collapse
- DNS =
Resolv::DNS.new
- VERSION =
'0.3.0'
Class Method Summary collapse
Class Method Details
.on_our_nameservers?(domain_names:, nameservers:, groups: 25) ⇒ Boolean
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/dns_checker.rb', line 14 def self.on_our_nameservers?(domain_names:, nameservers:, groups: 25) nameserver_ips = nameservers.each_with_object(Set.new) do |ns_name, ips| Nameserver.new(name: ns_name).a_records.each { |a| ips << a } end threads = [] result = {} domain_names.in_groups(groups, false) do |group| threads << Thread.new do domains = group.map { |g| Domain.new(g) } domains.each do |domain| result[domain] = domain.nameserver_ips.all? { |ip| nameserver_ips.include? ip } end end end threads.map(&:join) result end |