feat(routers): integrate Banana Pi Client API and onboard LibreSpeed measurements
Discover Ethernet routers under the board, map physical SIM slots, expose vendor controls and real telemetry, and provide packaged VPS speed tests with a live monochrome gauge. Enforce compact typography across Core and Node UI.
This commit is contained in:
@@ -14,6 +14,12 @@ def probe(kind: str, row: Document, verify: Callable[[Document, Document], Docum
|
||||
value = request(row, "GET", "/v1/status")
|
||||
if kind == "wireguard":
|
||||
verify(row, value)
|
||||
elif kind == "librespeed":
|
||||
if (
|
||||
value.get("schema") != "missioncore.librespeed/v1"
|
||||
or value.get("server_id") != row["id"]
|
||||
):
|
||||
raise ValueError("Service identity mismatch")
|
||||
elif value.get("schema") != "missioncore.vps-host/v1" or value.get("host_id") != row["id"]:
|
||||
raise ValueError("Service identity mismatch")
|
||||
state = "online"
|
||||
@@ -34,16 +40,24 @@ class ServerHealth:
|
||||
self, kind: str, row: Document, verify: Callable[[Document, Document], Document]
|
||||
) -> Document:
|
||||
# Changes to the trusted binding must invalidate its prior observation.
|
||||
key = tuple(str(x) for x in (
|
||||
kind, row.get("id", row.get("server_id")), row["endpoint"],
|
||||
row.get("fingerprint"), row.get("token"), row.get("network_interface"),
|
||||
))
|
||||
key = tuple(
|
||||
str(x)
|
||||
for x in (
|
||||
kind,
|
||||
row.get("id", row.get("server_id")),
|
||||
row["endpoint"],
|
||||
row.get("fingerprint"),
|
||||
row.get("token"),
|
||||
row.get("network_interface"),
|
||||
)
|
||||
)
|
||||
now = time.monotonic()
|
||||
self.cache = {k: v for k, v in self.cache.items() if now - v[0] < 15}
|
||||
if key in self.cache:
|
||||
return self.cache[key][1]
|
||||
task = self.pending.get(key)
|
||||
if task is None:
|
||||
|
||||
async def run() -> Document:
|
||||
try:
|
||||
async with self.slots:
|
||||
@@ -54,6 +68,7 @@ class ServerHealth:
|
||||
return value
|
||||
finally:
|
||||
self.pending.pop(key, None)
|
||||
|
||||
task = asyncio.create_task(run())
|
||||
self.pending[key] = task
|
||||
return await asyncio.shield(task)
|
||||
|
||||
Reference in New Issue
Block a user