ip2region 0.1.0

ip2region for rust
Documentation
  • Coverage
  • 40%
    8 out of 20 items documented0 out of 0 items with examples
  • Size
  • Source code size: 13.79 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.91 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 15s Average build duration of successful builds.
  • all releases: 15s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • openmynet/ip2region-rs
    4 1 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • openmynet

ip2region-rs

ip2region 的rust非官实现版本

ip2region官方地址: https://github.com/lionsoul2014/ip2region


ip2region数据格式

数据格式:xdb 格式版本:2.0


使用方式

fn main(){
    let searcher = ip2region::Searcher::new("./data/ip2region.xdb").unwrap();
    let ip_v4 = "120.24.78.129";
    let info  = searcher.search(ip_v4).unwrap();
    println!("{}", info)
    // => `中国|0|广东省|深圳市|阿里云`
    let info  = searcher.std_search(ip_v4).unwrap();
    println("{:?}", info)
    // => `Location { contry: Some("中国"), region: None, province: Some("广东省"), city: Some("深圳市"), isp: Some("阿里云") }`
}

并发查询

现已经将整个xdb加载到内存进行安全并发使用。