|
|
|
_hit_peer(self,
peer)
Update the node's k-buckets with the peer, using a simplified version
of the kademlia specification's routine for updating k-buckets. |
source code
|
|
|
_node_id_present(self,
node_id)
Determine if any of the connected peers have the specified 160-bit
node ID. |
source code
|
|
|
_conn_present(self,
conn)
Determine if the given (address, port) tuple is presently connected
via any of the peers. |
source code
|
|
|
_make_buckets(self)
At node, start, create 160 k-buckets and 160 replacement buckets.
Currently, replacement buckets are not used but the peer is placed into
them if a bucket's peer count is over k. |
source code
|
|
|
_closest_peers(self,
id,
how_many,
filter_id=None)
Given the specified 160-bit ID, use the k-buckets to return, at most,
how_many closest peers to the ID using a XOR metric (id XOR peer.id) |
source code
|
|
|
rpc_get(self,
key,
callback)
Since value retrieval is async, provide a callback that will handle
the value. |
source code
|
|
|
|
|
|
|
register_chat_callback(self,
callback)
Store a callable in our chat callbacks list. Each will be called in
order of registration, when we receive an RPC_CHAT with a
target_node_id that matches our server's 160-bit ID. |
source code
|
|
|
peer_cleanup(self,
peer)
When error handling or explicit peer removal schedules a peer object
for removal, this function is called to remove it from all applicable
buckets by the core node.py removal routine. |
source code
|
|
|
bootstrap_peer(self,
conn_address,
id=None)
Add a peer. This function does not add it to k-buckets,
as this is handled by the final handshake callback. |
source code
|
|
|
|
|
__init__(self,
host=' 0.0.0.0 ' ,
port=16800,
initial_peers=[ ] ,
debug=False,
ctl_port=None,
pyev_loop=None,
debug_file=None) |
source code
|
|
|
|
|
|
|
|
|
|
|
|
|
add_peer(self,
conn,
connect=False,
existing_socket=None) |
source code
|
|
|
|
|
|
|
|
|
register_handshake(self,
func,
peer=None)
Any time a new incoming connectin is made, the argument will be
executed with the arguments peer and the server itself. |
source code
|
|
|
register_message_callback(self,
message,
func) |
source code
|
|
|
register_message_handler(self,
atype,
func) |
source code
|
|
|
register_message_timeout(self,
message,
func,
peer,
timeout=3) |
source code
|
|
|
|
|
|
|
|