Class: NetCrawl::Peer
- Inherits:
-
Object
- Object
- NetCrawl::Peer
- Defined in:
- lib/netcrawl/peer.rb
Instance Attribute Summary collapse
-
#dst ⇒ Object
Returns the value of attribute dst.
-
#ip ⇒ Object
Returns the value of attribute ip.
-
#oid ⇒ Object
Returns the value of attribute oid.
-
#raw_ip ⇒ Object
Returns the value of attribute raw_ip.
-
#raw_name ⇒ Object
Returns the value of attribute raw_name.
-
#src ⇒ Object
Returns the value of attribute src.
Instance Method Summary collapse
-
#initialize ⇒ Peer
constructor
A new instance of Peer.
- #name ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize ⇒ Peer
Returns a new instance of Peer.
4 5 6 7 8 9 10 11 12 |
# File 'lib/netcrawl/peer.rb', line 4 def initialize @ip = nil # Best guess of system IP @name = nil # Reverse of said IP @raw_ip = nil # IP as seen in polling @raw_name = nil # Name as seen in polling @src = nil # SRC/local interface @dst = nil # DSR/remote interface @oid = {} # Hash of oids collected end |
Instance Attribute Details
#dst ⇒ Object
Returns the value of attribute dst.
3 4 5 |
# File 'lib/netcrawl/peer.rb', line 3 def dst @dst end |
#ip ⇒ Object
Returns the value of attribute ip.
3 4 5 |
# File 'lib/netcrawl/peer.rb', line 3 def ip @ip end |
#oid ⇒ Object
Returns the value of attribute oid.
3 4 5 |
# File 'lib/netcrawl/peer.rb', line 3 def oid @oid end |
#raw_ip ⇒ Object
Returns the value of attribute raw_ip.
3 4 5 |
# File 'lib/netcrawl/peer.rb', line 3 def raw_ip @raw_ip end |
#raw_name ⇒ Object
Returns the value of attribute raw_name.
3 4 5 |
# File 'lib/netcrawl/peer.rb', line 3 def raw_name @raw_name end |
#src ⇒ Object
Returns the value of attribute src.
3 4 5 |
# File 'lib/netcrawl/peer.rb', line 3 def src @src end |
Instance Method Details
#name ⇒ Object
13 14 15 |
# File 'lib/netcrawl/peer.rb', line 13 def name @name ||= DNS.getname @ip end |
#to_hash ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/netcrawl/peer.rb', line 16 def to_hash { 'ip' => ip.to_s, 'name' => name.to_s, 'interface' => { 'source' => src.to_s, 'destination' => dst.to_s, }, 'raw' => { 'ip' => raw_ip.to_s, 'name' => raw_name.to_s, }, } end |