From 18dd7538b5a0f6fa2d3b161b954bed0e20aeaeea Mon Sep 17 00:00:00 2001 From: YX Hao Date: Sun, 19 Jun 2022 15:45:02 +0800 Subject: [PATCH 1/2] Add compiling condition for Windows --- Cargo.toml | 4 +++- src/main.rs | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index dbf06c2..74d4c0b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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" diff --git a/src/main.rs b/src/main.rs index 310d563..0248da3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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; From cb2944ca409406a7a13fd67188bf011e4b765f7e Mon Sep 17 00:00:00 2001 From: YX Hao Date: Sun, 19 Jun 2022 16:06:15 +0800 Subject: [PATCH 2/2] Update readme.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3464133..ba500d9 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,7 @@ Make a copy of the `example-encrypted-dns.toml` configuration file named `encryp Then, review the [`encrypted-dns.toml`](https://raw.githubusercontent.com/jedisct1/encrypted-dns-server/master/example-encrypted-dns.toml) file. This is where all the parameters can be configured, including the IP addresses to listen to. -You should probably at least change the `listen_addresses` and `provider_name` settings. +You should probably at least change the `listen_addrs` and `provider_name` settings. Start the proxy. It will automatically create a new provider key pair if there isn't any.