mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-08-26 14:32:26 +00:00
apply new maxminddb
api version
This commit is contained in:
parent
54260eb27f
commit
05b467bb1b
@ -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 {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user