Skip to content

Commit 7ba251a

Browse files
authored
Merge pull request #98 from github/public-resolvers
Add support for querying public resolvers
2 parents 36c67fb + 32ee578 commit 7ba251a

File tree

4 files changed

+19
-7
lines changed

4 files changed

+19
-7
lines changed

lib/github-pages-health-check/domain.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,13 @@ class Domain < Checkable
8080
].freeze
8181

8282
HASH_METHODS = %i[
83-
host uri dns_resolves? proxied? cloudflare_ip? fastly_ip?
84-
old_ip_address? a_record? cname_record? mx_records_present?
85-
valid_domain? apex_domain? should_be_a_record?
83+
host uri nameservers dns_resolves? proxied? cloudflare_ip?
84+
fastly_ip? old_ip_address? a_record? cname_record?
85+
mx_records_present? valid_domain? apex_domain? should_be_a_record?
8686
cname_to_github_user_domain? cname_to_pages_dot_github_dot_com?
8787
cname_to_fastly? pointed_to_github_pages_ip? pages_domain?
88-
served_by_pages? valid? reason valid_domain?
89-
https? enforces_https? https_error https_eligible? caa_error
88+
served_by_pages? valid? reason valid_domain? https?
89+
enforces_https? https_error https_eligible? caa_error
9090
].freeze
9191

9292
def self.redundant(host)

lib/github-pages-health-check/redundant_check.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,18 @@ def https_eligible?
2727
private
2828

2929
def checks
30-
@checks ||= %i[default authoritative].map do |ns|
30+
@checks ||= %i[default authoritative public].map do |ns|
3131
GitHubPages::HealthCheck::Domain.new(domain, :nameservers => ns)
3232
end
3333
end
3434

3535
def check_with_default_nameservers
3636
@check_with_default_nameservers ||= checks.find { |c| c.nameservers == :default }
3737
end
38+
39+
def check_with_public_nameservers
40+
@check_with_public_nameservers ||= checks.find { |c| c.nameservers == :public }
41+
end
3842
end
3943
end
4044
end

lib/github-pages-health-check/resolver.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ class Resolver
88
:query_timeout => 5,
99
:dnssec => false
1010
}.freeze
11+
PUBLIC_NAMESERVERS = %w(
12+
8.8.8.8
13+
1.1.1.1
14+
).freeze
1115

1216
class << self
1317
def default_resolver
@@ -40,6 +44,10 @@ def resolver
4044
Dnsruby::Resolver.new(DEFAULT_RESOLVER_OPTIONS.merge(
4145
:nameservers => authoritative_nameservers
4246
))
47+
when :public
48+
Dnsruby::Resolver.new(DEFAULT_RESOLVER_OPTIONS.merge(
49+
:nameservers => PUBLIC_NAMESERVERS
50+
))
4351
when Array
4452
Dnsruby::Resolver.new(DEFAULT_RESOLVER_OPTIONS.merge(
4553
:nameservers => nameservers

spec/github_pages_health_check/site_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
end
7575

7676
context "hash" do
77-
let(:valid_values) { [true, false, nil] }
77+
let(:valid_values) { [true, false, nil, :default] }
7878

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

0 commit comments

Comments
 (0)