pub mod fingerprint;
pub mod headers;
mod map;
pub mod network;
pub mod rng;
mod zip;
pub use fingerprint::{
Fingerprint, FingerprintGenerator, FingerprintOptions, FingerprintOverrides,
NavigatorFingerprint, Screen, ScreenFingerprint, VideoCard, generate_fingerprint,
generate_headers,
};
pub use headers::{
Browser, HeaderGenerator, HeaderOptions, HeaderOverrides, Headers, HttpVersion, browser_of,
get_user_agent, pascalize,
};
pub use map::{OrderedMap, Restrictions, Values};
pub use network::{BayesianNetwork, Node, fingerprint_network, header_network, input_network};
pub use rng::Rng;
const TOO_RESTRICTIVE: &str = "The current constraints are too restrictive. No possible values can be found for the given constraints.";
const NO_HEADERS: &str = "No headers based on this input can be generated. Please relax or change some of the requirements you specified.";
const NO_FINGERPRINT: &str = "Cannot generate headers. User-Agent may be invalid, or screen constraints are too restrictive.";
#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
#[non_exhaustive]
pub enum Error {
#[error("{TOO_RESTRICTIVE}")]
TooRestrictive,
#[error("unknown network node {0:?}")]
UnknownNode(String),
#[error("malformed zip archive: {0}")]
Zip(String),
#[error("malformed network definition: {0}")]
Network(String),
#[error("invalid header options: {0}")]
InvalidOptions(String),
#[error("{NO_HEADERS}")]
NoHeaders,
#[error("Failed to find User-Agent in generated response")]
MissingUserAgent,
#[error("{NO_FINGERPRINT}")]
NoFingerprint,
#[error("Failed to find browser in User-Agent {0:?}")]
UnknownBrowser(String),
#[error("malformed embedded data: {0}")]
Data(String),
#[error("operating system entropy unavailable: {0}")]
Entropy(#[source] getrandom::Error),
}
pub type Result<T> = std::result::Result<T, Error>;