Refactor geo enrichment into jail_service and mark Task 14 done

This commit is contained in:
2026-04-17 16:36:22 +02:00
parent 487f252a4d
commit 900d111a5d
4 changed files with 56 additions and 7 deletions

View File

@@ -58,14 +58,11 @@ async def lookup_ip(
HTTPException: 400 when *ip* is not a valid IP address.
HTTPException: 502 when fail2ban is unreachable.
"""
async def _enricher(addr: str) -> geo_service.GeoInfo | None:
return await geo_service.lookup(addr, http_session)
try:
result: IpLookupResult = await jail_service.lookup_ip(
socket_path,
ip,
geo_enricher=_enricher,
http_session=http_session,
)
except ValueError as exc:
raise HTTPException(