Class: Rex::Socket::Host

Inherits:
Range
  • Object
show all
Defined in:
lib/rex/socket/range_walker.rb

Overview

A single host

Instance Attribute Summary collapse

Attributes inherited from Range

#options, #start, #stop

Instance Method Summary collapse

Methods inherited from Range

#==, #ipv6?, #length

Constructor Details

#initialize(address, hostname = nil, options = {}) ⇒ Host

Returns a new instance of Host.



543
544
545
546
547
548
549
550
551
# File 'lib/rex/socket/range_walker.rb', line 543

def initialize(address, hostname=nil, options={})
  if address.is_a? String
    options.merge!({ ipv6: Rex::Socket.is_ipv6?(address) }) if options[:ipv6].nil?
    address = Rex::Socket.addr_atoi(address)
  end

  super(address, address, options)
  @hostname = hostname
end

Instance Attribute Details

#hostnameObject

Returns the value of attribute hostname.



541
542
543
# File 'lib/rex/socket/range_walker.rb', line 541

def hostname
  @hostname
end

Instance Method Details

#addressObject



553
554
555
# File 'lib/rex/socket/range_walker.rb', line 553

def address
  Rex::Socket.addr_itoa(@start)
end