diff --git a/explorer-api/README.md b/explorer-api/README.md index a60b941f7d..0555275f14 100644 --- a/explorer-api/README.md +++ b/explorer-api/README.md @@ -5,13 +5,13 @@ An API that provides data for the [Network Explorer](../explorer). Features: - - geolocates mixnodes using https://freegeoip.app/ + - geolocates mixnodes using https://app.ipbase.com/ - calculates how many nodes are in each country - proxies mixnode API requests to add HTTPS ## Running -Supply the environment variable `GEO_IP_SERVICE_API_KEY` with a key from https://freegeoip.app/. +Supply the environment variable `GEO_IP_SERVICE_API_KEY` with a key from https://app.ipbase.com/. Run as a service and reverse proxy with `nginx` to add `https` with Lets Encrypt. diff --git a/explorer-api/src/country_statistics/geolocate.rs b/explorer-api/src/country_statistics/geolocate.rs index 170d4f5cc1..81e0944dc0 100644 --- a/explorer-api/src/country_statistics/geolocate.rs +++ b/explorer-api/src/country_statistics/geolocate.rs @@ -129,7 +129,7 @@ enum LocateError { async fn locate(ip: &str) -> Result { let api_key = ::std::env::var("GEO_IP_SERVICE_API_KEY") .expect("Env var GEO_IP_SERVICE_API_KEY is not set"); - let uri = format!("{}/{}?apikey={}", crate::GEO_IP_SERVICE, ip, api_key); + let uri = format!("{}/?apikey={}&ip={}", crate::GEO_IP_SERVICE, api_key, ip); match reqwest::get(uri.clone()).await { Ok(response) => { if response.status() == 429 { diff --git a/explorer-api/src/main.rs b/explorer-api/src/main.rs index e46a0cbeae..ed96dd4fff 100644 --- a/explorer-api/src/main.rs +++ b/explorer-api/src/main.rs @@ -18,7 +18,7 @@ mod state; mod tasks; mod validators; -const GEO_IP_SERVICE: &str = "https://api.freegeoip.app/json"; +const GEO_IP_SERVICE: &str = "https://api.ipbase.com/json"; const COUNTRY_DATA_REFRESH_INTERVAL: u64 = 60 * 15; // every 15 minutes #[tokio::main]