diff --git a/wallguard-common/src/protobuf/mod.rs b/wallguard-common/src/protobuf/mod.rs index 1eee568c..7431046e 100644 --- a/wallguard-common/src/protobuf/mod.rs +++ b/wallguard-common/src/protobuf/mod.rs @@ -1,6 +1,7 @@ #![allow(clippy::pedantic)] #![allow(clippy::large_enum_variant)] #![allow(clippy::result_large_err)] +#![allow(clippy::double_must_use)] #[allow(clippy::enum_variant_names)] #[rustfmt::skip] diff --git a/wallguard-server/README.md b/wallguard-server/README.md index 8b3a5dcc..f993dfce 100644 --- a/wallguard-server/README.md +++ b/wallguard-server/README.md @@ -18,4 +18,3 @@ | `CONTROL_SERVICE_PORT` | Port to bind control service to | | `HTTP_PROXY_HOST` | HTTP proxy host | | `HTTP_PROXY_PORT` | HTTP proxy port | -| `IP_INFO_API_KEY` | API key for IP info service | diff --git a/wallguard-server/src/datastore/generated/mod.rs b/wallguard-server/src/datastore/generated/mod.rs index 3e04cfba..2996a923 100644 --- a/wallguard-server/src/datastore/generated/mod.rs +++ b/wallguard-server/src/datastore/generated/mod.rs @@ -1,6 +1,7 @@ #![allow(clippy::pedantic)] #![allow(clippy::large_enum_variant)] #![allow(clippy::result_large_err)] +#![allow(clippy::double_must_use)] #[allow(clippy::enum_variant_names)] #[rustfmt::skip] #[allow(dead_code)] diff --git a/wallguard-server/src/traffic_handler/ip_info.rs b/wallguard-server/src/traffic_handler/ip_info.rs index 297dda6e..4b7dd739 100644 --- a/wallguard-server/src/traffic_handler/ip_info.rs +++ b/wallguard-server/src/traffic_handler/ip_info.rs @@ -1,7 +1,7 @@ use crate::app_context::AppContext; use indexmap::IndexSet; use nullnet_liberror::Error; -use nullnet_libipinfo::{ApiFields, IpInfoHandler, IpInfoProvider}; +use nullnet_libipinfo::IpInfoHandler; use std::net::IpAddr; use std::sync::mpsc::Receiver; use tokio::runtime::Handle; @@ -41,13 +41,6 @@ async fn get_and_store_ip_info(ip: IpAddr, context: AppContext) -> Result<(), Er log::info!("Looking up IP information for {ip}"); let ip_info = HANDLER.lookup(&ip).await?; log::info!("Looked up IP information for {ip}: {ip_info:?}"); - let ip_info = if ip_info.country.is_none() && ip_info.asn.is_none() && ip_info.org.is_none() - { - log::warn!("IP info API lookup returned empty result for {ip}, falling back to MMDB"); - MMDB_HANDLER.lookup(&ip).await? - } else { - ip_info - }; context .datastore .create_ip_info(&token.jwt, &ip_info, &ip) @@ -82,33 +75,6 @@ impl IpCache { } } -static HANDLER: std::sync::LazyLock = std::sync::LazyLock::new(|| { - #[cfg(not(debug_assertions))] - let url = "https://ipapi.co/{ip}/json/?key={api_key}"; - #[cfg(debug_assertions)] - let url = "https://ipapi.co/{ip}/json"; - - let api_key = std::env::var("IP_INFO_API_KEY").unwrap_or_else(|_| { - log::warn!("IP_INFO_API_KEY environment variable not set"); - String::new() - }); - - IpInfoHandler::new(vec![IpInfoProvider::new_api_provider( - url, - &api_key, - ApiFields { - country: Some("/country"), - asn: Some("/asn"), - org: Some("/org"), - continent_code: Some("/continent_code"), - city: Some("/city"), - region: Some("/region"), - postal: Some("/postal"), - timezone: Some("/timezone"), - }, - )]) - .unwrap() -}); - -static MMDB_HANDLER: std::sync::LazyLock = +// No API providers: lookups always use the free db-ip.com lite MMDB databases +static HANDLER: std::sync::LazyLock = std::sync::LazyLock::new(|| IpInfoHandler::new(vec![]).unwrap());