diff --git a/CHANGELOG.md b/CHANGELOG.md index c0a19fe..c273224 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Change Log +# 0.18.5 +- changes for maxminddb 0.27.0 +- bump libraries + # 0.18.4 - update links and branding related to the HTTP (formerly Mozilla) Observatory - bump libraries diff --git a/Cargo.lock b/Cargo.lock index 14b452e..65cfe65 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -400,7 +400,7 @@ dependencies = [ [[package]] name = "directory" -version = "0.18.4" +version = "0.18.5" dependencies = [ "diesel", "diesel_migrations", @@ -1292,9 +1292,9 @@ dependencies = [ [[package]] name = "maxminddb" -version = "0.26.0" +version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a197e44322788858682406c74b0b59bf8d9b4954fe1f224d9a25147f1880bba" +checksum = "7ef0551fc3e7345a6c854c1026b0ddada1e443e51f4fb4cdcf86cc1a71d4b337" dependencies = [ "ipnetwork", "log", diff --git a/Cargo.toml b/Cargo.toml index 53382a9..3e37330 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "directory" -version = "0.18.4" +version = "0.18.5" authors = ["El RIDO "] edition = "2021" license = "AGPL-3.0" @@ -12,7 +12,7 @@ futures = "0.3.31" http-body-util = "0.1.3" hyper-util = "0.1.18" isocountry = "0.3.2" -maxminddb = "0.26.0" +maxminddb = "0.27.0" rand = "0.9.2" regex = "1.12.2" tokio = "1.48.0" diff --git a/Dockerfile b/Dockerfile index 2c1de47..b9a9c6e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,7 +13,7 @@ COPY . /home/rust/ RUN cargo build --release FROM scratch -ARG RELEASE=0.18.4 +ARG RELEASE=0.18.5 LABEL org.opencontainers.image.authors=support@privatebin.org \ org.opencontainers.image.vendor=PrivateBin \ org.opencontainers.image.documentation=https://github.com/PrivateBin/Directory/blob/master/README.md \ diff --git a/Dockerfile.standalone b/Dockerfile.standalone index 43f524d..c784d41 100644 --- a/Dockerfile.standalone +++ b/Dockerfile.standalone @@ -1,5 +1,5 @@ FROM rust:1.80-alpine3.20 -ARG RELEASE=0.18.4 +ARG RELEASE=0.18.5 RUN apk --no-cache update && \ apk add --no-cache \ musl-dev \ @@ -16,7 +16,7 @@ RUN wget -qO - https://github.com/PrivateBin/Directory/archive/${RELEASE}.tar.gz upx --ultra-brute target/release/directory FROM scratch -ARG RELEASE=0.18.4 +ARG RELEASE=0.18.5 LABEL org.opencontainers.image.authors=support@privatebin.org \ org.opencontainers.image.vendor=PrivateBin \ org.opencontainers.image.documentation=https://github.com/PrivateBin/Directory/blob/master/README.md \ diff --git a/LICENSE.md b/LICENSE.md index 66e11e7..503fad6 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -19,7 +19,7 @@ This document lists the licenses of the projects used in the instance directory. #### Used by -- [directory](https://crates.io/crates/directory) 0.18.4 +- [directory](https://crates.io/crates/directory) 0.18.5 ``` GNU AFFERO GENERAL PUBLIC LICENSE @@ -8212,7 +8212,7 @@ third-party/chromium/LICENSE. #### Used by -- [maxminddb](https://github.com/oschwald/maxminddb-rust) 0.26.0 +- [maxminddb](https://github.com/oschwald/maxminddb-rust) 0.27.0 ``` ISC License @@ -8321,7 +8321,7 @@ THE SOFTWARE. #### Used by -- [hyper](https://github.com/hyperium/hyper) 1.7.0 +- [hyper](https://github.com/hyperium/hyper) 1.8.1 ``` Copyright (c) 2014-2025 Sean McArthur @@ -8829,7 +8829,7 @@ DEALINGS IN THE SOFTWARE. #### Used by -- [hyper-util](https://github.com/hyperium/hyper-util) 0.1.17 +- [hyper-util](https://github.com/hyperium/hyper-util) 0.1.18 ``` Copyright (c) 2023-2025 Sean McArthur diff --git a/src/models.rs b/src/models.rs index e8663b7..8f5c4d8 100644 --- a/src/models.rs +++ b/src/models.rs @@ -321,9 +321,13 @@ impl PrivateBin { ); } let reader = opener.unwrap(); - if let Ok(Some(country)) = reader.lookup::(ip) { - if let Some(country) = country.country { - if let Some(iso_code) = country.iso_code { + if let Ok(country) = reader.lookup(ip) { + if let Ok(Some(country)) = country.decode::() { + if let Some(iso_code) = country.represented_country.iso_code { + country_code = iso_code.into(); // e.g. military base or embassy + } else if let Some(iso_code) = country.registered_country.iso_code { + country_code = iso_code.into(); // e.g. mobile networks or VPNs + } else if let Some(iso_code) = country.country.iso_code { country_code = iso_code.into(); } }