Class: Ciri::P2P::Discovery::Protocol::To

Inherits:
Object
  • Object
show all
Includes:
RLP::Serializable
Defined in:
lib/ciri/p2p/discovery/protocol.rb

Overview

a struct represent which node is target of this packet

Class Method Summary collapse

Class Method Details

.from_host_port(host, port) ⇒ Object



158
159
160
# File 'lib/ciri/p2p/discovery/protocol.rb', line 158

def from_host_port(host, port)
  new(recipient_ip: host.is_a?(IPAddr) ? host.to_i : IPAddr.new(host).to_i, recipient_udp_port: port)
end

.from_inet_addr(address) ⇒ Object



154
155
156
# File 'lib/ciri/p2p/discovery/protocol.rb', line 154

def from_inet_addr(address)
  from_host_port(address.ip_address, address.ip_port)
end