use serde::{Deserialize, Serialize};
mod validate;
pub use validate::{ja4_counts_match_ja3, validate_target_fields};
#[cfg(feature = "tier-b-toml")]
mod tier_b;
#[cfg(feature = "tier-b-toml")]
pub use tier_b::{load_targets_from_toml, TargetLoadError};
#[cfg(test)]
#[path = "tls_targets/tests.rs"]
mod tests;
#[cfg(all(test, feature = "tier-b-toml"))]
#[path = "tls_targets/tier_b_tests.rs"]
mod tier_b_tests;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
pub struct FingerprintTarget {
pub label: &'static str,
pub ja3: &'static str,
pub ja4: &'static str,
pub akamai_h2: &'static str,
pub peet_h2: &'static str,
}
pub const FINGERPRINT_TARGETS: &[FingerprintTarget] = &[
FingerprintTarget {
label: "firefox-150-linux",
ja3: "771,4865-4867-4866-49195-49199-52393-52392-49196-49200-49162-49161-49171-49172-156-157-47-53,0-23-65281-10-11-16-5-34-18-51-43-13-45-28-27-65037-41,4588-29-23-24-25-256-257,0",
ja4: "t13d1717h2_5b57614c22b0_e6dcd7ae0a9e",
akamai_h2: "1:65536;2:0;4:131072;5:16384|12517377|0|m,p,a,s",
peet_h2: "6ea73faa8fc5aac76bded7bd238f6433",
},
FingerprintTarget {
label: "firefox-151-linux",
ja3: "771,4865-4867-4866-49195-49199-52393-52392-49196-49200-49162-49171-49172-156-157-47-53,0-23-65281-10-11-16-5-34-18-51-43-13-45-28-27-65037-41,4588-29-23-24-25-256-257,0",
ja4: "t13d1617h2_86a278354501_e6dcd7ae0a9e",
akamai_h2: "1:65536;2:0;4:131072;5:16384|12517377|0|m,p,a,s",
peet_h2: "6ea73faa8fc5aac76bded7bd238f6433",
},
FingerprintTarget {
label: "chrome-146-linux",
ja3: "771,4865-4866-4867-49195-49199-49196-49200-52393-52392-49171-49172-156-157-47-53,0-5-45-18-27-10-35-16-43-65281-65037-11-23-51-13-17613-41,4588-29-23-24,0",
ja4: "t13d1517h2_8daaf6152771_b6f405a00624",
akamai_h2: "1:65536;2:0;4:6291456;6:262144|15663105|0|m,a,s,p",
peet_h2: "52d84b11737d980aef856699f885ca86",
},
];
#[must_use]
pub fn lookup(label: &str) -> Option<&'static FingerprintTarget> {
FINGERPRINT_TARGETS.iter().find(|t| t.label == label)
}
#[must_use]
pub fn all_labels() -> Vec<&'static str> {
FINGERPRINT_TARGETS.iter().map(|t| t.label).collect()
}
#[must_use]
pub fn builtin_with(extra: &[FingerprintTarget]) -> Vec<FingerprintTarget> {
FINGERPRINT_TARGETS
.iter()
.copied()
.chain(extra.iter().copied())
.collect()
}