From e94c81ce4409efd66a4084bb11820b4c23ffa4fb Mon Sep 17 00:00:00 2001 From: UpstreamData Date: Mon, 26 Sep 2022 09:15:37 -0600 Subject: [PATCH] improve miner network functionality --- pyasic/network/__init__.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pyasic/network/__init__.py b/pyasic/network/__init__.py index d8781d13..e7a00f71 100644 --- a/pyasic/network/__init__.py +++ b/pyasic/network/__init__.py @@ -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.