Add GeoIP support for unique IP aggregation
Publish telemt-api gateway Docker image / test (push) Failing after 17s
Publish telemt-api gateway Docker image / build-and-push (push) Has been skipped

- Introduced GeoIP configuration options in config.example.yaml to enable geolocation lookups for the /api/agg/unique-ips endpoint.
- Updated the aggregate handler to include optional GeoIP data in responses, enriching unique IP information with country and city details, as well as ASN data if available.
- Enhanced documentation in AGGREGATE.md and README.md to reflect the new GeoIP functionality and its usage.
- Added a dependency on the geoip2-golang library in go.mod for GeoIP lookups.
- Modified tests to accommodate the new GeoIP integration in the aggregate handler.
This commit is contained in:
Denozordec
2026-03-30 01:47:08 +07:00
parent 4a4f15bd0b
commit d7a63f0da3
15 changed files with 449 additions and 12 deletions
+2 -2
View File
@@ -35,7 +35,7 @@ func TestHandlerResolveAndFetch(t *testing.T) {
if err != nil {
t.Fatal(err)
}
h := NewHandler(parsed, up.Client())
h := NewHandler(parsed, up.Client(), nil)
req := httptest.NewRequest(http.MethodGet, "/api/agg/summary?aliases=test", nil)
rec := httptest.NewRecorder()
h.ServeHTTP(rec, req)
@@ -65,7 +65,7 @@ func TestHandlerMethodNotAllowed(t *testing.T) {
if err != nil {
t.Fatal(err)
}
h := NewHandler(parsed, http.DefaultClient)
h := NewHandler(parsed, http.DefaultClient, nil)
req := httptest.NewRequest(http.MethodPost, "/api/agg/summary", nil)
rec := httptest.NewRecorder()
h.ServeHTTP(rec, req)