Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: By default, impersonate from a string is disabled #206

Merged
merged 5 commits into from
Dec 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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"

Expand Down
3 changes: 2 additions & 1 deletion src/tls/mimic/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Self, Self::Err> {
Expand Down
3 changes: 2 additions & 1 deletion src/tls/mimic/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -169,6 +169,7 @@ pub enum Impersonate {
Firefox133,
}

#[cfg(feature = "impersonate_str")]
impl_from_str! {
// Chrome
(Chrome100, "chrome_100"),
Expand Down