improve miner network functionality

This commit is contained in:
UpstreamData
2022-09-26 09:15:37 -06:00
parent c95c58138e
commit e94c81ce44

View File

@@ -48,6 +48,7 @@ class MinerNetwork:
if mask.startswith("/"):
mask = mask.replace("/", "")
self.mask = mask
self.network = self.get_network()
def __len__(self):
return len([item for item in self.get_network().hosts()])
@@ -55,6 +56,10 @@ class MinerNetwork:
def __repr__(self):
return str(self.network)
def hosts(self):
for x in self.network.hosts():
yield x
def get_network(self) -> ipaddress.ip_network:
"""Get the network using the information passed to the MinerNetwork or from cache.