Newer
Older
import ipaddress
import time
class RemoteConnection:
def __init__(self, ip: ipaddress.IPv4Address, pk: bytes, cap: float, ucap: float, l: float):
self.publicIP: ipaddress.IPv4Address = ip
self.publicKey: bytes = pk
self.availableCapacity: float = cap
self.usedCapacity: float = ucap
self.loss = l # loss rate during transmission or transformation
def __eq__(self, other):
return self.publicKey == other.publicKey
def __hash__(self):
return hash(self.publicKey)
def __str__(self):
return self.publicIP.__str__()