Skip to content

Commit 678f098

Browse files
committed
Remove the with_tls feature and make it default
1 parent e8812e2 commit 678f098

File tree

6 files changed

+6
-42
lines changed

6 files changed

+6
-42
lines changed

Cargo.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,7 @@ datetime = { version = "0.5.2", default-features = false }
6969
pretty_assertions = "1.4"
7070

7171
[features]
72-
default = ["with_idna", "with_https", "with_rustls"]
72+
default = ["with_idna", "with_https"]
7373
with_idna = ["dns/with_idna"]
7474

7575
with_https = ["dns-transport/with_https"]
76-
77-
with_rustls = ["dns-transport/with_rustls"]

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,10 @@ For more information, read [the xtests README](xtests/README.md).
135135

136136
### Feature toggles
137137

138-
dog has three Cargo features that can be switched off to remove functionality.
138+
dog has two Cargo features that can be switched off to remove functionality.
139139
While doing so makes dog less useful, it results in a smaller binary that takes less time to build.
140140

141-
There are three feature toggles available, all of which are active by default:
141+
There are two feature toggles available, both of which are active by default:
142142

143143
- `with_idna`, which enables [IDNA](https://en.wikipedia.org/wiki/Internationalized_domain_name) processing
144144
- `with_https`, which enables DNS-over-HTTPS (requires built-in TLS support)

dns-transport/Cargo.toml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,13 @@ log = "0.4"
2222
# http response parsing
2323
httparse = { version = "1.10", optional = true }
2424

25-
rustls = { version = "0.23", optional = true }
25+
rustls = "0.23"
2626

27-
webpki = { version = "0.22.4", optional = true }
27+
webpki = "0.22.4"
2828

29-
webpki-roots = { version = "1.0.2", optional = true }
29+
webpki-roots = "1.0.2"
3030

3131
[features]
3232
default = [] # these are enabled in the main dog crate
3333

3434
with_https = ["httparse"]
35-
36-
with_rustls = ["rustls", "webpki-roots", "webpki"]

dns-transport/src/error.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,12 @@ pub enum Error {
1414
TruncatedResponse,
1515

1616
/// An error from the TLS library.
17-
#[cfg(feature = "with_rustls")]
1817
RustlsError(rustls::Error),
1918

2019
/// Provided dns name is not valid
21-
#[cfg(feature = "with_rustls")]
2220
RustlsInvalidDnsNameError(webpki::InvalidDnsNameError),
2321

2422
/// Provided dns name is not valid
25-
#[cfg(feature = "with_rustls")]
2623
RustlsInvalidDnsNameError2(rustls::pki_types::InvalidDnsNameError),
2724

2825
/// There was a problem decoding the response HTTP headers or body.
@@ -50,21 +47,18 @@ impl From<std::io::Error> for Error {
5047
}
5148
}
5249

53-
#[cfg(feature = "with_rustls")]
5450
impl From<rustls::Error> for Error {
5551
fn from(inner: rustls::Error) -> Self {
5652
Self::RustlsError(inner)
5753
}
5854
}
5955

60-
#[cfg(feature = "with_rustls")]
6156
impl From<webpki::InvalidDnsNameError> for Error {
6257
fn from(inner: webpki::InvalidDnsNameError) -> Self {
6358
Self::RustlsInvalidDnsNameError(inner)
6459
}
6560
}
6661

67-
#[cfg(feature = "with_rustls")]
6862
impl From<rustls::pki_types::InvalidDnsNameError> for Error {
6963
fn from(inner: rustls::pki_types::InvalidDnsNameError) -> Self {
7064
Self::RustlsInvalidDnsNameError2(inner)

src/main.rs

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ fn main() {
5353
match Options::getopts(env::args_os().skip(1)) {
5454
OptionsResult::Ok(options) => {
5555
info!("Running with options -> {:#?}", options);
56-
disabled_feature_check(&options);
5756
exit(run(options));
5857
}
5958

@@ -174,27 +173,6 @@ fn run(Options { requests, format, measure_time }: Options) -> i32 {
174173
}
175174

176175

177-
/// Checks whether the options contain parameters that will cause dog to fail
178-
/// because the feature is disabled by exiting if so.
179-
#[allow(unused)]
180-
fn disabled_feature_check(options: &Options) {
181-
use std::process::exit;
182-
use crate::connect::TransportType;
183-
184-
#[cfg(not(feature = "with_rustls"))]
185-
if options.requests.inputs.transport_types.contains(&TransportType::TLS) {
186-
eprintln!("dog: Cannot use '--tls': This version of dog has been compiled without TLS support");
187-
exit(exits::OPTIONS_ERROR);
188-
}
189-
190-
#[cfg(all(not(feature = "with_https"), not(feature = "with_rustls")))]
191-
if options.requests.inputs.transport_types.contains(&TransportType::HTTPS) {
192-
eprintln!("dog: Cannot use '--https': This version of dog has been compiled without HTTPS support");
193-
exit(exits::OPTIONS_ERROR);
194-
}
195-
}
196-
197-
198176
/// The possible status numbers dog can exit with.
199177
mod exits {
200178

src/output.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,6 @@ fn erroneous_phase(error: &TransportError) -> &'static str {
648648
TransportError::WireError(_) => "protocol",
649649
TransportError::TruncatedResponse |
650650
TransportError::NetworkError(_) => "network",
651-
#[cfg(feature = "with_rustls")]
652651
TransportError::RustlsInvalidDnsNameError(_) |
653652
TransportError::RustlsError(_) |
654653
TransportError::RustlsInvalidDnsNameError2(_) => "tls", // TODO: Actually wrong, could be https
@@ -664,11 +663,8 @@ fn error_message(error: TransportError) -> String {
664663
TransportError::WireError(e) => wire_error_message(e),
665664
TransportError::TruncatedResponse => "Truncated response".into(),
666665
TransportError::NetworkError(e) => e.to_string(),
667-
#[cfg(any(feature = "with_rustls"))]
668666
TransportError::RustlsInvalidDnsNameError(e) => e.to_string(),
669-
#[cfg(any(feature = "with_rustls"))]
670667
TransportError::RustlsError(e) => e.to_string(),
671-
#[cfg(any(feature = "with_rustls"))]
672668
TransportError::RustlsInvalidDnsNameError2(e) => e.to_string(),
673669
#[cfg(feature = "with_https")]
674670
TransportError::HttpError(e) => e.to_string(),

0 commit comments

Comments
 (0)