diff --git a/Cargo.toml b/Cargo.toml index 77f3fa05..183d2ffb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -61,6 +61,9 @@ webpki-roots = ["dep:webpki-root-certs"] # Optional disable internal proxy cache internal_proxy_sys_no_cache = [] +# Optional enable impersonate from str +impersonate_str = [] + # Internal (PRIVATE!) features used to aid testing. # Don't rely on these whatsoever. They may disappear at anytime. @@ -92,7 +95,7 @@ hyper2 = { version = "1", features = ["http1", "http2", "client"] } log = "0.4" mime = "0.3.17" percent-encoding = "2.3" -tokio = { version = "1", default-features = false, features = ["net", "time"] } +tokio = { version = "1", default-features = false, features = ["net", "time", "rt"] } pin-project-lite = "0.2.0" ipnet = "2.10.0" diff --git a/src/tls/mimic/macros.rs b/src/tls/mimic/macros.rs index 6618e497..f6edbe2e 100644 --- a/src/tls/mimic/macros.rs +++ b/src/tls/mimic/macros.rs @@ -150,9 +150,10 @@ macro_rules! impersonate_match { } } +#[cfg(feature = "impersonate_str")] macro_rules! impl_from_str { ($(($variant:ident, $string:expr)),* $(,)?) => { - impl FromStr for Impersonate { + impl std::str::FromStr for Impersonate { type Err = String; fn from_str(s: &str) -> Result { diff --git a/src/tls/mimic/mod.rs b/src/tls/mimic/mod.rs index f8616af7..23d29dd6 100644 --- a/src/tls/mimic/mod.rs +++ b/src/tls/mimic/mod.rs @@ -10,7 +10,7 @@ use chrome::*; use firefox::*; use okhttp::*; use safari::*; -use std::{fmt::Debug, str::FromStr}; +use std::fmt::Debug; use Impersonate::*; mod impersonate_imports { @@ -169,6 +169,7 @@ pub enum Impersonate { Firefox133, } +#[cfg(feature = "impersonate_str")] impl_from_str! { // Chrome (Chrome100, "chrome_100"),