Skip to content

Add support for querying public resolvers #98

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 22, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions lib/github-pages-health-check/domain.rb
Original file line number Diff line number Diff line change
@@ -80,13 +80,13 @@ class Domain < Checkable
].freeze

HASH_METHODS = %i[
host uri dns_resolves? proxied? cloudflare_ip? fastly_ip?
old_ip_address? a_record? cname_record? mx_records_present?
valid_domain? apex_domain? should_be_a_record?
host uri nameservers dns_resolves? proxied? cloudflare_ip?
fastly_ip? old_ip_address? a_record? cname_record?
mx_records_present? valid_domain? apex_domain? should_be_a_record?
cname_to_github_user_domain? cname_to_pages_dot_github_dot_com?
cname_to_fastly? pointed_to_github_pages_ip? pages_domain?
served_by_pages? valid? reason valid_domain?
https? enforces_https? https_error https_eligible? caa_error
served_by_pages? valid? reason valid_domain? https?
enforces_https? https_error https_eligible? caa_error
].freeze

def self.redundant(host)
6 changes: 5 additions & 1 deletion lib/github-pages-health-check/redundant_check.rb
Original file line number Diff line number Diff line change
@@ -27,14 +27,18 @@ def https_eligible?
private

def checks
@checks ||= %i[default authoritative].map do |ns|
@checks ||= %i[default authoritative public].map do |ns|
GitHubPages::HealthCheck::Domain.new(domain, :nameservers => ns)
end
end

def check_with_default_nameservers
@check_with_default_nameservers ||= checks.find { |c| c.nameservers == :default }
end

def check_with_public_nameservers
@check_with_public_nameservers ||= checks.find { |c| c.nameservers == :public }
end
end
end
end
8 changes: 8 additions & 0 deletions lib/github-pages-health-check/resolver.rb
Original file line number Diff line number Diff line change
@@ -8,6 +8,10 @@ class Resolver
:query_timeout => 5,
:dnssec => false
}.freeze
PUBLIC_NAMESERVERS = %w(
8.8.8.8
1.1.1.1
).freeze

class << self
def default_resolver
@@ -40,6 +44,10 @@ def resolver
Dnsruby::Resolver.new(DEFAULT_RESOLVER_OPTIONS.merge(
:nameservers => authoritative_nameservers
))
when :public
Dnsruby::Resolver.new(DEFAULT_RESOLVER_OPTIONS.merge(
:nameservers => PUBLIC_NAMESERVERS
))
when Array
Dnsruby::Resolver.new(DEFAULT_RESOLVER_OPTIONS.merge(
:nameservers => nameservers
2 changes: 1 addition & 1 deletion spec/github_pages_health_check/site_spec.rb
Original file line number Diff line number Diff line change
@@ -74,7 +74,7 @@
end

context "hash" do
let(:valid_values) { [true, false, nil] }
let(:valid_values) { [true, false, nil, :default] }

it "returns a valid values" do
hash = subject.to_hash