Skip to content

Commit

Permalink
artifacts: Update GeoLite database (#551)
Browse files Browse the repository at this point in the history
* Update GeoLite city database

Signed-off-by: Alexandru Vasile <[email protected]>

* core: Update DB download link and add copyright link

Signed-off-by: Alexandru Vasile <[email protected]>

* core/tests: Adjust location for random IP address

Signed-off-by: Alexandru Vasile <[email protected]>

---------

Signed-off-by: Alexandru Vasile <[email protected]>
  • Loading branch information
lexnv authored Oct 17, 2023
1 parent d84947f commit 35b583d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Binary file modified backend/telemetry_core/src/GeoLite2-City.mmdb
Binary file not shown.
10 changes: 8 additions & 2 deletions backend/telemetry_core/src/find_location.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,13 @@ struct Locator {
}

impl Locator {
/// Taken from here: https://github.com/P3TERX/GeoLite.mmdb/releases/tag/2022.06.07
/// GeoLite database release data: 2023-10-13
///
/// To download the latest version visit: https://dev.maxmind.com/geoip/geolite2-free-geolocation-data.
///
/// This database incorporates GeoNames [https://www.geonames.org] geographical data, which is made available
/// under the Creative Commons Attribution 4.0 License.
/// To view a copy of this license,visit https://creativecommons.org/licenses/by/4.0/.
const CITY_DATA: &'static [u8] = include_bytes!("GeoLite2-City.mmdb");

pub fn new(cache: FxHashMap<IpAddr, Arc<NodeLocation>>) -> Self {
Expand Down Expand Up @@ -138,6 +144,6 @@ mod tests {
fn locate_random_ip() {
let ip = "12.5.56.25".parse().unwrap();
let node_location = Locator::new(Default::default()).locate(ip).unwrap();
assert_eq!(&*node_location.city, "El Paso");
assert_eq!(&*node_location.city, "Riverside");
}
}

0 comments on commit 35b583d

Please sign in to comment.