class DEVp2p::P2PProtocol
DEV P2P Wire Protocol
@see github.com/ethereum/wiki/wiki/%C3%90%CE%9EVp2p-Wire-Protocol
Attributes
config[R]
Public Class Methods
get_hello_packet(data)
click to toggle source
special: we need this packet before the protocol can be initialized
# File lib/devp2p/p2p_protocol.rb, line 124 def get_hello_packet(data) payload = Hello.encode_payload(data.merge(version: 55)) Packet.new protocol_id, Hello.cmd_id, payload end
new(peer, service)
click to toggle source
Calls superclass method
# File lib/devp2p/p2p_protocol.rb, line 137 def initialize(peer, service) raise ArgumentError, "invalid peer" unless peer.respond_to?(:capabilities) raise ArgumentError, "invalid peer" unless peer.respond_to?(:stop) raise ArgumentError, "invalid peer" unless peer.respond_to?(:receive_hello) @config = peer.config super(peer, service) @monitor = ConnectionMonitor.new self end
Public Instance Methods
stop()
click to toggle source
Calls superclass method
# File lib/devp2p/p2p_protocol.rb, line 148 def stop @monitor.stop super end
Private Instance Methods
logger()
click to toggle source
# File lib/devp2p/p2p_protocol.rb, line 155 def logger @logger = Logger.new "p2p.protocol" end