Crate ip_alloc_lookup

Crate ip_alloc_lookup 

Source
Expand description

§Offline RIPE-based IP Allocation Lookup

This crate provides fast, offline lookups for IPv4 and IPv6 addresses based on RIPE NCC delegated allocation data. It maps IP address ranges to ISO-3166 country codes and includes a built-in classification for European Union (EU) membership.

§What this crate does

  • Performs purely offline IP lookups using pre-generated range tables.
  • Supports IPv4 and IPv6 with logarithmic-time lookups.
  • Uses RIPE delegated statistics, not active geolocation or probing.
  • Associates each IP range with a country code and an EU membership flag.

§What this crate does NOT do

  • It does not determine the physical location of hosts or users.
  • It does not track BGP routing, anycast behavior, or traffic paths.
  • It does not provide legal or regulatory compliance guarantees.

The country and EU information reflect the RIR allocation or assignment metadata published by RIPE NCC. In real-world networks, traffic may be served from different locations due to CDNs, anycast, tunneling, or routing policies.

§Design goals

  • Predictable performance (no syscalls or I/O on lookup).
  • Deterministic results (static data, no runtime mutation).
  • Minimal memory overhead and no mandatory external dependencies.

§Typical use cases

  • High-throughput IP classification in hot paths (firewalls, proxies, logging).
  • Allocation-based policy checks (e.g. EU vs non-EU).
  • Offline or restricted environments where external services are unavailable.

This crate should be understood as an IP allocation lookup, not a geolocation service.

Structs§

DbStats
GeoInfo
GeoIpDb
IpRange

Functions§

parse_ripe_delegated
Parses RIPE delegated stats format for both IPv4 and IPv6 This is exposed for advanced users who want to process RIPE data themselves