class Bitcourier::Protocol::Message::Hello

Constants

ID
PROTOCOL_VERSION

Attributes

nonce[RW]
port[RW]
protocol_version[RW]

Public Class Methods

new() click to toggle source
# File lib/bitcourier/protocol/message/hello.rb, line 10
def initialize
  self.protocol_version = PROTOCOL_VERSION
end

Public Instance Methods

extract(bytes) click to toggle source
# File lib/bitcourier/protocol/message/hello.rb, line 18
def extract bytes
  data = bytes.unpack('SSQ')

  self.protocol_version = data[0]
  self.port             = data[1]
  self.nonce            = data[2]
end
payload() click to toggle source
# File lib/bitcourier/protocol/message/hello.rb, line 14
def payload
  [protocol_version.to_i, port.to_i, nonce.to_i].pack('SSQ')
end