Add GeoIP support for unique IP aggregation
- 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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user