IpCodeMap

Type Alias IpCodeMap 

Source
pub type IpCodeMap = IpTree<CountryRegionCode>;

Aliased Type§

pub struct IpCodeMap {
    pub ipv4: IntervalTreeMap<IPv4, CountryRegionCode>,
    pub ipv6: IntervalTreeMap<IPv6, CountryRegionCode>,
}

Fields§

§ipv4: IntervalTreeMap<IPv4, CountryRegionCode>§ipv6: IntervalTreeMap<IPv6, CountryRegionCode>

Implementations§

Source§

impl IpCodeMap

Source

pub fn add_entity(&mut self, entity: Entity) -> Result<(), Box<dyn Error>>

Source

pub fn load_from_dir( &mut self, dir_path: impl AsRef<Path>, ) -> Result<(), Box<dyn Error>>

Source

pub fn load_from_file( &mut self, file_path: impl AsRef<Path>, ) -> Result<(), Box<dyn Error>>

Source§

impl IpCodeMap

Source

pub fn query(&self, ip: IpAddr) -> Option<CountryRegionCode>

query CountryRegionCode of ip