can desactive ipinfo client

This commit is contained in:
Emmanuel Garette 2022-10-16 22:21:43 +02:00
parent 83c90486d1
commit 2f3b069278

View file

@ -10,7 +10,7 @@ use crate::util::{get_client_server_distance_string, get_ip_type, Config};
#[derive(FromForm)]
pub struct GetIPOptions {
#[field(default = true)]
#[field(default = false)]
isp: bool,
#[field(default = Units::Kilometers)]
distance: Units,
@ -95,8 +95,12 @@ pub async fn get_ipinfo(ip: &str, config: &Config) -> IpDetails {
let mut ipinfo_client = IpInfo::new(ipconfig).expect("should construct");
let res = ipinfo_client.lookup(&[ip]).unwrap();
let ipinfo = res.get(ip).unwrap();
let res = ipinfo_client.lookup(&[ip]);
let r = match res {
Ok(r) => r,
Err(e) => panic!("cannot get IP info: {}", &e.to_string()),
};
let ipinfo = r.get(ip).unwrap();
ipinfo.to_owned()
}