Trait tor_geoip::HasCountryCode

source ·
pub trait HasCountryCode {
    // Required method
    fn country_code(&self) -> Option<CountryCode>;
}
Expand description

A (representation of a) host on the network which may have a known country code.

Required Methods§

source

fn country_code(&self) -> Option<CountryCode>

Return the country code in which this server is most likely located.

This is usually implemented by simple GeoIP lookup on the addresses provided by HasAddrs. It follows that the server might not actually be in the returned country, but this is a halfway decent estimate for what other servers might guess the server’s location to be (and thus useful for e.g. getting around simple geo-blocks, or having webpages return the correct localised versions).

Returning None signifies that no country code information is available. (Conflicting GeoIP lookup results might also cause None to be returned.)

Implementors§