class Peers: db = Config.getValue("PEERS_DB") subDb = Config.getValue("PEERS_SUB_DB") peers = Storage(db, subDb) hostname = Network.getHostname() ipAddress = Network.getIpAddress() if Config.getBoolValue('PEERS_ENABLE_SEEDS'): with open(Config.getValue('SEEDS_DIR')) as seeds: hosts = json.load(seeds) for host in hosts: if host != hostname and host != ipAddress: hostBytes = DataType.serialize(host) if peers.get(hostBytes) == None: peer = Peer() peer.host = host peer.lastUpdate = DataType.asTime() peers.set(hostBytes, peer.serialize())
def __init__(self): self.addrRecv = None self.addrFrom = Network.getHostname()