make miner ips a true ip address, and allow sorting miners using __lt__ and __gt__

This commit is contained in:
UpstreamData
2022-05-18 11:34:39 -06:00
parent 8ebcbd3c33
commit 8cbf3a20a3
8 changed files with 61 additions and 54 deletions

View File

@@ -2,12 +2,13 @@ from API.bmminer import BMMinerAPI
from miners import BaseMiner
import logging
from settings import MINER_FACTORY_GET_VERSION_RETRIES as DATA_RETRIES
import ipaddress
class BMMiner(BaseMiner):
def __init__(self, ip: str) -> None:
super().__init__(ip)
self.ip = ip
self.ip = ipaddress.ip_address(ip)
self.api = BMMinerAPI(ip)
self.api_type = "BMMiner"
self.uname = "root"

View File

@@ -1,3 +1,5 @@
import ipaddress
from miners import BaseMiner
from API.bosminer import BOSMinerAPI
import toml
@@ -9,7 +11,7 @@ from settings import MINER_FACTORY_GET_VERSION_RETRIES as DATA_RETRIES
class BOSMiner(BaseMiner):
def __init__(self, ip: str) -> None:
super().__init__(ip)
self.ip = ip
self.ip = ipaddress.ip_address(ip)
self.api = BOSMinerAPI(ip)
self.api_type = "BOSMiner"
self.uname = "root"

View File

@@ -3,12 +3,13 @@ from miners import BaseMiner
from API import APIError
import logging
from settings import MINER_FACTORY_GET_VERSION_RETRIES as DATA_RETRIES
import ipaddress
class BTMiner(BaseMiner):
def __init__(self, ip: str) -> None:
super().__init__(ip)
self.ip = ip
self.ip = ipaddress.ip_address(ip)
self.api = BTMinerAPI(ip)
self.api_type = "BTMiner"

View File

@@ -3,12 +3,13 @@ from API.cgminer import CGMinerAPI
from API import APIError
from settings import MINER_FACTORY_GET_VERSION_RETRIES as DATA_RETRIES
import logging
import ipaddress
class CGMiner(BaseMiner):
def __init__(self, ip: str) -> None:
super().__init__(ip)
self.ip = ip
self.ip = ipaddress.ip_address(ip)
self.api = CGMinerAPI(ip)
self.api_type = "CGMiner"
self.uname = "root"

View File

@@ -1,10 +1,11 @@
from miners._backends import BMMiner
import ipaddress
class Hiveon(BMMiner):
def __init__(self, ip: str) -> None:
super().__init__(ip)
self.ip = ip
self.ip = ipaddress.ip_address(ip)
self.api_type = "Hiveon"
self.uname = "root"
self.pwd = "admin"