Skip to content

Commit 63b9413

Browse files
committed
Don't deprecate the 192.30.252.15{3,4} quite yet
1 parent de75544 commit 63b9413

File tree

2 files changed

+27
-11
lines changed

2 files changed

+27
-11
lines changed

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

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,6 @@ module HealthCheck
55
class Domain < Checkable
66
attr_reader :host
77

8-
GITHUB_DATACENTER_ADDRESSES = %w(
9-
192.30.252.153
10-
192.30.252.154
11-
).freeze
12-
138
LEGACY_IP_ADDRESSES = [
149
# Legacy GitHub Datacenter
1510
"207.97.227.245",
@@ -68,18 +63,22 @@ class Domain < Checkable
6863
"43.249.72.133",
6964
"43.249.73.133",
7065
"43.249.74.133",
71-
"43.249.75.133",
72-
73-
*GITHUB_DATACENTER_ADDRESSES
66+
"43.249.75.133"
7467
].freeze
7568

76-
CURRENT_IP_ADDRESSES = %w(
69+
NEW_PRIMARY_IPS = %w(
7770
185.199.108.153
7871
185.199.109.153
7972
185.199.110.153
8073
185.199.111.153
8174
).freeze
8275

76+
CURRENT_IP_ADDRESSES = [
77+
"192.30.252.153",
78+
"192.30.252.154",
79+
*NEW_PRIMARY_IPS
80+
].freeze
81+
8382
HASH_METHODS = %i[
8483
host uri dns_resolves? proxied? cloudflare_ip? fastly_ip?
8584
old_ip_address? a_record? cname_record? mx_records_present?
@@ -164,6 +163,11 @@ def pointed_to_github_pages_ip?
164163
a_record? && CURRENT_IP_ADDRESSES.include?(dns.first.address.to_s)
165164
end
166165

166+
# Is the domain's first response an A record to the new primary IPs?
167+
def pointed_to_new_primary_ips?
168+
a_record? && NEW_PRIMARY_IPS.include?(dns.first.address.to_s)
169+
end
170+
167171
# Is the domain's first response a CNAME to a pages domain?
168172
def cname_to_github_user_domain?
169173
cname? && !cname_to_pages_dot_github_dot_com? && cname.pages_domain?
@@ -339,7 +343,7 @@ def enforces_https?
339343

340344
# Can an HTTPS certificate be issued for this domain?
341345
def https_eligible?
342-
(cname_to_github_user_domain? || pointed_to_github_pages_ip?) &&
346+
(cname_to_github_user_domain? || pointed_to_new_primary_ips?) &&
343347
caa.lets_encrypt_allowed?
344348
end
345349

spec/github_pages_health_check/domain_spec.rb

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@
101101
before(:each) { allow(subject).to receive(:dns) { [a_packet] } }
102102

103103
context "old IP addresses" do
104-
%w(204.232.175.78 207.97.227.245 192.30.252.153 192.30.252.154).each do |ip_address|
104+
%w(204.232.175.78 207.97.227.245).each do |ip_address|
105105
context ip_address do
106106
let(:ip) { ip_address }
107107

@@ -112,6 +112,18 @@
112112
end
113113
end
114114

115+
%w(192.30.252.153 192.30.252.154).each do |ip_address|
116+
context ip_address do
117+
let(:ip) { ip_address }
118+
119+
it "knows it's not an old IP" do
120+
expect(subject).not_to be_a_old_ip_address
121+
expect(subject).not_to be_a_deprecated_ip
122+
expect(subject).to be_pointed_to_github_pages_ip
123+
end
124+
end
125+
end
126+
115127
context "a random IP" do
116128
let(:ip) { "1.2.3.4" }
117129

0 commit comments

Comments
 (0)