diff --git a/tailscalesd/main.py b/tailscalesd/main.py index b664cdb..ee05204 100644 --- a/tailscalesd/main.py +++ b/tailscalesd/main.py @@ -55,7 +55,7 @@ settings = Settings() # type: ignore[call-arg] CACHE_SD = [] -async def tailscale_devices() -> List: +async def tailscale_devices() -> List[Dict]: async with httpx.AsyncClient() as client: try: # https://github.com/tailscale/tailscale/blob/main/api.md#tailnet-devices-get @@ -107,7 +107,7 @@ async def matrix_node_sd(device) -> Dict: return group_by_type(data) -def matrix_workers_to_sd(tailnet, device, workers) -> List: +def matrix_workers_to_sd(tailnet, device, workers) -> List[Dict]: if len(workers) == 0: return [] ipv4 = ipv4_only(device["addresses"])[0] @@ -134,8 +134,8 @@ def matrix_workers_to_sd(tailnet, device, workers) -> List: return target_groups -async def matrix_sd(tailnet, devices) -> List: - sd = [] +async def matrix_sd(tailnet, devices) -> List[Dict]: + sd: List[Dict] = [] for device in devices: if MATRIX_TAG not in device["tags"]: continue @@ -150,12 +150,12 @@ async def matrix_sd(tailnet, devices) -> List: workers = {} targets = matrix_workers_to_sd(tailnet, device, workers) if targets: - sd.append(targets) + sd = sd + targets log.info(f"Found {len(sd)} matrix servcies") return sd -def plain_devices_sd(tailnet, devices) -> List: +def plain_devices_sd(tailnet, devices) -> List[Dict]: sd = [] for device in devices: targets = ipv4_only(device["addresses"])