apply new maxminddb api version

This commit is contained in:
yggverse 2025-04-07 22:02:19 +03:00
parent 54260eb27f
commit 05b467bb1b

View File

@ -121,7 +121,7 @@ impl Dialog for PreferencesDialog {
/// Lookup [MaxMind](https://www.maxmind.com) database /// Lookup [MaxMind](https://www.maxmind.com) database
fn l(profile: &Profile, socket_address: &SocketAddress) -> Option<String> { fn l(profile: &Profile, socket_address: &SocketAddress) -> Option<String> {
use maxminddb::{ use maxminddb::{
MaxMindDBError, Reader, MaxMindDbError, Reader,
geoip2::{/*City,*/ Country}, geoip2::{/*City,*/ Country},
}; };
if !matches!( if !matches!(
@ -138,11 +138,11 @@ impl Dialog for PreferencesDialog {
.ok()?; .ok()?;
let lookup = { let lookup = {
let a: std::net::SocketAddr = socket_address.to_string().parse().unwrap(); let a: std::net::SocketAddr = socket_address.to_string().parse().unwrap();
let lookup: std::result::Result<Country, MaxMindDBError> = let lookup: std::result::Result<Option<Country>, MaxMindDbError> =
db.lookup(a.ip()); db.lookup(a.ip());
lookup lookup
} }
.ok()?; .ok()??;
lookup.country.map(|c| { lookup.country.map(|c| {
let mut b = Vec::new(); let mut b = Vec::new();
if let Some(iso_code) = c.iso_code { if let Some(iso_code) = c.iso_code {