mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2026-02-12 16:10:57 +00:00
added changes from future commits to last passing bmuller commit
This commit is contained in:
@ -12,6 +12,15 @@ log = logging.getLogger(__name__) # pylint: disable=invalid-name
|
||||
|
||||
|
||||
class KademliaProtocol(RPCProtocol):
|
||||
"""
|
||||
There are four main RPCs in the Kademlia protocol
|
||||
PING, STORE, FIND_NODE, FIND_VALUE
|
||||
PING probes if a node is still online
|
||||
STORE instructs a node to store (key, value)
|
||||
FIND_NODE takes a 160-bit ID and gets back
|
||||
(ip, udp_port, node_id) for k closest nodes to target
|
||||
FIND_VALUE behaves like FIND_NODE unless a value is stored
|
||||
"""
|
||||
def __init__(self, source_node, storage, ksize):
|
||||
RPCProtocol.__init__(self)
|
||||
self.router = RoutingTable(self, ksize, source_node)
|
||||
@ -28,6 +37,12 @@ class KademliaProtocol(RPCProtocol):
|
||||
ids.append(rid)
|
||||
return ids
|
||||
|
||||
def rpc_add_provider(self, sender, nodeid, key):
|
||||
pass
|
||||
|
||||
def rpc_get_providers(self, sender, nodeid, key):
|
||||
pass
|
||||
|
||||
def rpc_stun(self, sender): # pylint: disable=no-self-use
|
||||
return sender
|
||||
|
||||
|
||||
Reference in New Issue
Block a user