added additional docs to Node to reduce confusion noted in #73

This commit is contained in:
Brian Muller 2019-07-03 08:22:35 -04:00
parent 9743986639
commit f218b83833

View File

@ -3,7 +3,21 @@ import heapq
class Node:
"""
Simple object to encapsulate the concept of a Node (minimally an ID, but
also possibly an IP and port if this represents a node on the network).
This class should generally not be instantiated directly, as it is a low
level construct mostly used by the router.
"""
def __init__(self, node_id, ip=None, port=None):
"""
Create a Node instance.
Args:
node_id (int): A value between 0 and 2^160
ip (string): Optional IP address where this Node lives
port (int): Optional port for this Node (set when IP is set)
"""
self.id = node_id # pylint: disable=invalid-name
self.ip = ip # pylint: disable=invalid-name
self.port = port