#proxy #ip2location #bin #format #detection #ip2proxy

ip2location-ip2proxy

IP2Proxy™ Proxy Detection Database

8 releases (4 breaking)

0.4.0 Jan 30, 2023
0.3.0 May 1, 2022
0.2.0 Apr 16, 2022
0.1.3 Apr 15, 2022
0.0.0 Apr 6, 2022

#1294 in Database interfaces

39 downloads per month

Apache-2.0 OR MIT

120KB
3K SLoC

ip2location-ip2proxy

Example

#[cfg(feature = "tokio_fs")]
{
use std::{net::Ipv4Addr};

use ip2location_ip2proxy::bin_format::{Database, TokioFile};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let runtime = tokio::runtime::Runtime::new().unwrap();

    runtime.block_on(async move {
        let db = Database::<TokioFile>::new("/path/IP2PROXY-LITE-PX11.BIN", 2).await?;

        if let Some(record) = db.lookup_ipv4(Ipv4Addr::new(8, 8, 8, 8), None).await? {
            assert_eq!(record.country_code.to_string(), "US");
        }

        Ok(())
    })
}
}

Dependencies

~5–7MB
~118K SLoC