Class: GitHubPages::HealthCheck::Resolver

Inherits:
Object
  • Object
show all
Defined in:
lib/github-pages-health-check/resolver.rb

Constant Summary collapse

DEFAULT_RESOLVER_OPTIONS =
{
  :retry_times => 2,
  :query_timeout => 5,
  :dnssec => false,
  :do_caching => false
}.freeze
PUBLIC_NAMESERVERS =
%w(
  8.8.8.8
  1.1.1.1
).freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(domain, nameservers: :default) ⇒ Resolver

Create a new resolver.

domain - the domain we’re getting answers for nameserver - (optional) a case



29
30
31
32
# File 'lib/github-pages-health-check/resolver.rb', line 29

def initialize(domain, nameservers: :default)
  @domain = domain
  @nameservers = nameservers
end

Instance Attribute Details

#domainObject (readonly)

Returns the value of attribute domain.



23
24
25
# File 'lib/github-pages-health-check/resolver.rb', line 23

def domain
  @domain
end

#nameserversObject (readonly)

Returns the value of attribute nameservers.



23
24
25
# File 'lib/github-pages-health-check/resolver.rb', line 23

def nameservers
  @nameservers
end

Class Method Details

.default_resolverObject



18
19
20
# File 'lib/github-pages-health-check/resolver.rb', line 18

def default_resolver
  @default_resolver ||= Dnsruby::Resolver.new(DEFAULT_RESOLVER_OPTIONS)
end

Instance Method Details

#query(type) ⇒ Object



34
35
36
# File 'lib/github-pages-health-check/resolver.rb', line 34

def query(type)
  resolver.query(Addressable::IDNA.to_ascii(domain), type).answer
end