Class: IPAddr

Inherits:
Object
  • Object
show all
Defined in:
lib/honeypot/ipaddr_ext.rb

Overview

Constant Summary collapse

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')
]

Instance Method Summary collapse

Instance Method Details

#routeable?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/honeypot/ipaddr_ext.rb', line 15

def routeable?
  !unrouteable?
end

#unrouteable?Boolean

Returns:

  • (Boolean)


10
11
12
13
# File 'lib/honeypot/ipaddr_ext.rb', line 10

def unrouteable?
  return false unless self.ipv4?
  UNROUTEABLE_RANGES.any? { |ipr| ipr.include? self }
end