proxywhirl.enrichment

Offline proxy metadata enrichment using local databases.

This module provides 100% offline enrichment of proxy data using: 1. MaxMind GeoLite2 local database (optional, requires download) 2. Python stdlib ipaddress for IP property analysis 3. Port signature analysis

No external API calls - all lookups are local.

Classes

OfflineEnricher

Enrich proxies using local databases only - no API calls.

Functions

get_default_geoip_path()

Get the default path for GeoIP database.

is_geoip_available()

Check if GeoIP database is available.

Module Contents

class proxywhirl.enrichment.OfflineEnricher(geoip_path=None)[source]

Enrich proxies using local databases only - no API calls.

Initialize the enricher.

Parameters:

geoip_path (pathlib.Path | None) – Path to MaxMind GeoLite2-City.mmdb file. If None, looks in default locations.

close()[source]

Close the GeoIP reader if open.

Return type:

None

enrich(ip, port)[source]

Enrich a proxy with metadata.

Parameters:
  • ip (str) – IP address string

  • port (int) – Port number

Returns:

Dictionary of enrichment fields (all may be None if lookup fails)

Return type:

dict[str, Any]

enrich_batch(proxies, ip_field='ip', port_field='port')[source]

Enrich a batch of proxies in place.

Parameters:
  • proxies (list[dict[str, Any]]) – List of proxy dictionaries to enrich

  • ip_field (str) – Field name containing IP address

  • port_field (str) – Field name containing port

Returns:

The same list with enrichment fields added

Return type:

list[dict[str, Any]]

proxywhirl.enrichment.get_default_geoip_path()[source]

Get the default path for GeoIP database.

Return type:

pathlib.Path

proxywhirl.enrichment.is_geoip_available()[source]

Check if GeoIP database is available.

Return type:

bool