Refactor geo re-resolve endpoint into geo_service and add typed response

This commit is contained in:
2026-04-15 08:56:37 +02:00
parent 2451ec77b2
commit a8f2d2d7b9
7 changed files with 115 additions and 31 deletions

View File

@@ -189,7 +189,7 @@ The business logic layer. Services orchestrate operations, enforce rules, and co
| `log_service.py` | Log preview and regex test operations (extracted from config_service) |
| `history_service.py` | Queries the fail2ban database for historical ban records, builds per-IP timelines, computes ban counts and repeat-offender flags, and syncs new records into BanGUI's archive table |
| `blocklist_service.py` | Downloads blocklists via aiohttp, validates IPs/CIDRs, applies bans through fail2ban or iptables, logs import results |
| `geo_service.py` | Resolves IP addresses to country, ASN, and RIR using external APIs or a local database, caches results |
| `geo_service.py` | Resolves IP addresses to country, ASN, and RIR using external APIs or a local database, caches results, and re-resolves unresolved geo cache entries |
| `server_service.py` | Reads and writes fail2ban server-level settings (log level, log target, syslog socket, DB location, purge age) |
| `health_service.py` | Probes fail2ban socket connectivity, retrieves server version and global stats, reports online/offline status |

View File

@@ -246,7 +246,9 @@ The router knows the internal job ID string and directly manipulates the schedul
---
### TASK-08 — Remove inverted layer dependency: `utils/fail2ban_db_utils.py` importing a service 🟠
### TASK-08 — Remove inverted layer dependency: `utils/fail2ban_db_utils.py` importing a service
**Status:** Completed ✅
**Where:**
`backend/app/utils/fail2ban_db_utils.py` — line 8:
@@ -275,7 +277,9 @@ A util importing a service creates an implicit upward dependency that the archit
---
### TASK-09 — Move `re_resolve_geo` orchestration into `geo_service` 🟠
### TASK-09 — Move `re_resolve_geo` orchestration into `geo_service`
**Status:** Completed ✅
**Where:**
`backend/app/routers/geo.py` — `async def re_resolve_geo()` (lines ~142174).