class GitHubPages::HealthCheck::CDN
Attributes
Internal: The path of the config file.
Internal: The path of the config file.
Public Class Methods
Source
# File lib/github-pages-health-check/cdn.rb, line 12 def self.controls_ip?(address) instance.controls_ip?(address) end
Public: Does cloudflare control this address?
Source
# File lib/github-pages-health-check/cdn.rb, line 17 def initialize(options = {}) @name = options.fetch(:name) { self.class.name.split("::").last.downcase } @path = options.fetch(:path) { default_config_path } end
Internal: Create a new CDN
info instance.
Public Instance Methods
Source
# File lib/github-pages-health-check/cdn.rb, line 23 def controls_ip?(address) ranges.any? { |range| range.include?(address.to_s) } end
Internal: Does this CDN
control this address?
Private Instance Methods
Source
# File lib/github-pages-health-check/cdn.rb, line 39 def default_config_path File.expand_path("../../config/#{name}-ips.txt", File.dirname(__FILE__)) end
Source
# File lib/github-pages-health-check/cdn.rb, line 35 def load_ranges File.read(path).lines.map { |line| IPAddr.new(line.chomp) } end
Internal: Load IPAddr ranges from path
Source
# File lib/github-pages-health-check/cdn.rb, line 30 def ranges @ranges ||= load_ranges end
Internal: The IP address ranges that cloudflare controls.