ccf8063a52
* explorer-api: decorate mix nodes with locations from the geoip service and keep mix node cache in a hash map instead of a vec * explorer-api: add `lat` and `lng` for map views * explorer-api: remove function and simplify code * explorer-api: review feedback * network-explorer: format
16 lines
502 B
Rust
16 lines
502 B
Rust
use crate::mix_nodes::GeoLocation;
|
|
use isocountry::CountryCode;
|
|
|
|
pub(crate) fn map_2_letter_to_3_letter_country_code(geo: &GeoLocation) -> String {
|
|
match CountryCode::for_alpha2(&geo.country_code) {
|
|
Ok(three_letter_country_code) => three_letter_country_code.alpha3().to_string(),
|
|
Err(_e) => {
|
|
warn!(
|
|
"❌ Oh no! map_2_letter_to_3_letter_country_code failed for '{:#?}'",
|
|
geo
|
|
);
|
|
"???".to_string()
|
|
}
|
|
}
|
|
}
|