Skip to main content

compile_ip2location_lite

Function compile_ip2location_lite 

pub fn compile_ip2location_lite<R>(
    read: R,
    ip_version: IpVersion,
    kind: Ip2LocationLite,
) -> Result<MmdbReader, CsvError>
where R: Read,
Available on crate feature net only.
Expand description

Compile an IP2Location LITE CSV export into an in-memory MmdbReader.

The records are written with MaxMind-style field names, so the resulting database is queried through the usual MmdbReader::lookup path. Rows with no usable data (e.g. country code -) are skipped. ip_version selects how the decimal ip_from/ip_to columns are interpreted (u32 vs u128).

Use compile_ip2location_lite_to_file to stream a large database straight to disk instead of materialising it.

§Errors

Returns CsvError on I/O failure, a malformed row, or an invalid image.