Skip to content

Instantly share code, notes, and snippets.

@rhenning
Created July 20, 2016 19:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rhenning/b0828cd763e9c5ea43676662d9054bac to your computer and use it in GitHub Desktop.
Save rhenning/b0828cd763e9c5ea43676662d9054bac to your computer and use it in GitHub Desktop.
Check for an address in MaxCDN's address space
require 'netaddr'
require 'open-uri'
MAXCDN_IPS =
open('https://www.maxcdn.com/one/assets/ips.txt').map(&:chomp).map do |range|
NetAddr::CIDR.create(range).enumerate
end.flatten
puts MAXCDN_IPS.include?(ARGV.first)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment