Add compiling condition for Windows

pull/87/head
YX Hao 2 years ago
parent 69baa4020e
commit 18dd7538b5

@ -38,7 +38,6 @@ log = { version = "0.4.17", features = ["std", "release_max_level_debug"] }
mimalloc = { version = "0.1.29", default-features = false }
socket2 = "0.4.4"
parking_lot = "0.12.1"
privdrop = "0.5.2"
rand = "0.8.5"
rustc-hash = "1.1.0"
serde = "1.0.137"
@ -55,6 +54,9 @@ tokio = { version = "1.19.2", features = [
] }
toml = "0.5.9"
[target.'cfg(not(target_family = "windows"))'.dependencies]
privdrop = "0.5.2"
[dependencies.prometheus]
optional = true
version = "0.13.1"

@ -63,6 +63,7 @@ use futures::prelude::*;
use globals::*;
use parking_lot::Mutex;
use parking_lot::RwLock;
#[cfg(not(target_family = "windows"))]
use privdrop::PrivDrop;
use rand::prelude::*;
use siphasher::sip128::SipHasher13;
@ -461,6 +462,7 @@ fn bind_listeners(
Ok(sockets)
}
#[cfg(not(target_family = "windows"))]
fn privdrop(config: &Config) -> Result<(), Error> {
let mut pd = PrivDrop::default();
if let Some(user) = &config.user {
@ -552,6 +554,7 @@ fn main() -> Result<(), Error> {
runtime_builder.thread_name("encrypted-dns-");
let runtime = runtime_builder.build()?;
#[cfg(not(target_family = "windows"))]
privdrop(&config)?;
let key_cache_capacity = config.dnscrypt.key_cache_capacity;

Loading…
Cancel
Save