Sha256: 54f2ef2ebd199a9585c8a89c9f34f9bf99119a5eac824e49e5608f5a4483f8a0
Contents?: true
Size: 384 Bytes
Versions: 2
Compression:
Stored size: 384 Bytes
Contents
# http://codesnippets.joyent.com/posts/show/7546 class IPAddr UNROUTEABLE_RANGES = [ IPAddr.new('127.0.0.1/32'), IPAddr.new('10.0.0.0/8'), IPAddr.new('172.16.0.0/12'), IPAddr.new('192.168.0.0/16') ] def unrouteable? return false unless self.ipv4? UNROUTEABLE_RANGES.any? { |ipr| ipr.include? self } end def routeable? !unrouteable? end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
honeypot-0.0.8 | lib/honeypot/ipaddr_ext.rb |
honeypot-0.0.7 | lib/honeypot/ipaddr_ext.rb |