class Rex::Proto::Kademlia::Pong
A Kademlia
pong message.
Attributes
port[R]
@return [Integer] the source port from which the PING was received
Public Class Methods
from_data(data)
click to toggle source
Builds a pong from given data
@param data [String] the data to decode @return [Pong] the pong if the data is valid, nil otherwise
Calls superclass method
Rex::Proto::Kademlia::Message::from_data
# File lib/rex/proto/kademlia/pong.rb, line 24 def self.from_data(data) message = super(data) return if message.type != PONG return if message.body.size != 2 Pong.new(message.body.unpack('v')[0]) end
new(port = nil)
click to toggle source
Calls superclass method
Rex::Proto::Kademlia::Message::new
# File lib/rex/proto/kademlia/pong.rb, line 15 def initialize(port = nil) super(PONG) @port = port end
Public Instance Methods
to_str()
click to toggle source
Get this Pong
as a String
@return [String] the string representation of this Pong
Calls superclass method
Rex::Proto::Kademlia::Message#to_str
# File lib/rex/proto/kademlia/pong.rb, line 34 def to_str super + [@port].pack('v') end