arti: Add a feature flag for dns-proxy.
It remains on-by-default, so users shouldn't notice a difference, but it may help when we want to save a few bytes of binary size. Closes #532
This commit is contained in:
parent
bf2b444c06
commit
79c609e4f1
|
@ -12,11 +12,12 @@ categories = ["command-line-utilities", "cryptography"]
|
|||
repository = "https://gitlab.torproject.org/tpo/core/arti.git/"
|
||||
|
||||
[features]
|
||||
default = ["tokio", "native-tls"]
|
||||
default = ["tokio", "native-tls", "dns-proxy"]
|
||||
|
||||
full = ["async-std", "tokio", "native-tls", "journald", "arti-client/full"]
|
||||
full = ["async-std", "tokio", "native-tls", "journald", "arti-client/full", "dns-proxy"]
|
||||
|
||||
async-std = ["arti-client/async-std", "tor-rtcompat/async-std", "async-ctrlc", "once_cell"]
|
||||
dns-proxy = ["trust-dns-proto"]
|
||||
tokio = ["tokio-crate", "arti-client/tokio", "tor-rtcompat/tokio"]
|
||||
native-tls = ["arti-client/native-tls", "tor-rtcompat/native-tls"]
|
||||
rustls = ["arti-client/rustls", "tor-rtcompat/rustls"]
|
||||
|
@ -57,7 +58,7 @@ tracing = "0.1.18"
|
|||
tracing-appender = "0.2.0"
|
||||
tracing-journald = { version = "0.3.0", optional = true }
|
||||
tracing-subscriber = { version = "0.3.0", features = ["env-filter"] }
|
||||
trust-dns-proto = "0.21.1"
|
||||
trust-dns-proto = { version = "0.21.1", optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
itertools = "0.10.1"
|
||||
|
|
|
@ -52,6 +52,8 @@
|
|||
//! (default)
|
||||
//! * `journald` -- Build with support for logging to the `journald` logging
|
||||
//! backend (available as part of systemd.)
|
||||
//! * `dns-proxy` (default) -- Build with support for proxying certain simple
|
||||
//! DNS queries over the Tor network.
|
||||
//!
|
||||
//! * `full` -- Build with all features above, along with all stable additive
|
||||
//! features from other arti crates. (This does not include experimental
|
||||
|
@ -150,6 +152,7 @@
|
|||
#![allow(clippy::print_stdout)]
|
||||
|
||||
pub mod cfg;
|
||||
#[cfg(feature = "dns-proxy")]
|
||||
pub mod dns;
|
||||
pub mod exit;
|
||||
pub mod logging;
|
||||
|
@ -246,6 +249,7 @@ pub async fn run<R: Runtime>(
|
|||
}));
|
||||
}
|
||||
|
||||
#[cfg(feature = "dns-proxy")]
|
||||
if dns_port != 0 {
|
||||
let runtime = runtime.clone();
|
||||
let client = client.isolated_client();
|
||||
|
@ -255,6 +259,12 @@ pub async fn run<R: Runtime>(
|
|||
}));
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "dns-proxy"))]
|
||||
if dns_port != 0 {
|
||||
warn!("Tried to specify a DNS proxy port, but Arti was built without dns-proxy support.");
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
if proxy.is_empty() {
|
||||
warn!("No proxy port set; specify -p PORT (for `socks_port`) or -d PORT (for `dns_port`). Alternatively, use the `socks_port` or `dns_port` configuration option.");
|
||||
return Ok(());
|
||||
|
|
Loading…
Reference in New Issue