From a6fb79a2b25acda42246db5ab0132d407bdaf7dc Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Fri, 8 Nov 2019 13:06:21 +0100 Subject: [PATCH] Make the project compatible with rust-stable --- Cargo.toml | 1 + README.md | 2 +- src/anonymized_dns.rs | 3 ++- src/main.rs | 1 - 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index c816089..d03d6d4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,6 +22,7 @@ derivative = "1.0.3" dnsstamps = "0.1.2" env_logger = { version="0.7.1", default-features = false, features = ["humantime"] } futures-preview = { version = "=0.3.0-alpha.19", features = ["async-await"] } +ipext = "0.1.0" jemallocator = "0.3.2" libsodium-sys-stable="1.18.2" log = { version = "0.4.8", features = ["std", "release_max_level_debug"] } diff --git a/README.md b/README.md index 2a04a66..c0f5d31 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ In this package, the example configuration file can be found in `/usr/share/doc/ ### Option 2: compilation from source code -The proxy uses recent features of the Rust compiler, and currently requires rust-nightly. +The proxy uses recent features of the Rust compiler, and requires rust >= 1.0.39 or rust-nightly. Rust can installed with: diff --git a/src/anonymized_dns.rs b/src/anonymized_dns.rs index ab61b1c..4d854e8 100644 --- a/src/anonymized_dns.rs +++ b/src/anonymized_dns.rs @@ -2,6 +2,7 @@ use crate::errors::*; use crate::*; use byteorder::{BigEndian, ByteOrder}; +use ipext::IpExt; use siphasher::sip128::Hasher128; use std::hash::Hasher; use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6}; @@ -43,7 +44,7 @@ pub async fn handle_anonymized_dns( #[cfg(feature = "metrics")] globals.varz.anonymized_queries.inc(); - ensure!(ip.is_global(), "Forbidden upstream address"); + ensure!(IpExt::is_global(&ip), "Forbidden upstream address"); ensure!( !globals.anonymized_dns_blacklisted_ips.contains(&ip), "Blacklisted upstream IP" diff --git a/src/main.rs b/src/main.rs index 324f727..007b0be 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,7 +2,6 @@ #![allow(clippy::type_complexity)] #![allow(clippy::cognitive_complexity)] #![allow(dead_code)] -#![feature(ip)] #[global_allocator] static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;