pub struct EngineKey {
pub engine: VendorId,
pub version: Option<String>,
pub target_class: TargetClass,
pub tls_profile: Option<String>,
}Expand description
Durable identity of a scraping target’s anti-bot engine.
Two EngineKey values are equal iff every field is equal
— including the optional version and tls_profile. This is
deliberate: an Akamai Bot Manager v3 patch must not silently
apply to a v4 deployment, and a Chrome-136 TLS-profile patch
must not silently apply to a Firefox-130 profile.
The field layout matches the T110 spec: engine is the
anti-bot engine family, version is the vendor’s revision
(e.g. bot-manager-v3), target_class is the site’s posture,
and tls_profile is the client-side TLS fingerprint (e.g.
chrome136).
§Example
use stygian_charon::challenge_feedback::EngineKey;
use stygian_charon::types::TargetClass;
use stygian_charon::vendor_classifier::VendorId;
let key = EngineKey {
engine: VendorId::Cloudflare,
version: Some("bot-manager-v3".to_string()),
target_class: TargetClass::Api,
tls_profile: Some("chrome136".to_string()),
};
assert_eq!(key.engine, VendorId::Cloudflare);
assert_eq!(key.version.as_deref(), Some("bot-manager-v3"));Fields§
§engine: VendorIdAnti-bot engine family. Use VendorId::Unknown only when
no engine could be classified.
version: Option<String>Optional vendor version (e.g. "bot-manager-v3").
None means the version is unknown or unversioned.
target_class: TargetClassTarget class (api / content_site / high_security / unknown).
tls_profile: Option<String>Optional client TLS profile (e.g. "chrome136").
None means the TLS profile was not recorded.
Implementations§
Source§impl EngineKey
impl EngineKey
Sourcepub const fn engine_label(&self) -> &'static str
pub const fn engine_label(&self) -> &'static str
Engine component of the key, used for display and stable
hashing. Returns VendorId::label.
Sourcepub fn validate(&self) -> Result<(), EngineKeyParseError>
pub fn validate(&self) -> Result<(), EngineKeyParseError>
Validate the key has no empty optional fields. Returns
Ok(()) for well-formed keys; otherwise a
EngineKeyParseError::EmptyModifier.
This is primarily a helper for FromStr but is also
useful when constructing keys from user-supplied config.
§Errors
Returns EngineKeyParseError::EmptyModifier if either
optional component is an empty string.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for EngineKey
impl<'de> Deserialize<'de> for EngineKey
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for EngineKey
Source§impl Ord for EngineKey
impl Ord for EngineKey
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for EngineKey
impl PartialOrd for EngineKey
impl StructuralPartialEq for EngineKey
Auto Trait Implementations§
impl Freeze for EngineKey
impl RefUnwindSafe for EngineKey
impl Send for EngineKey
impl Sync for EngineKey
impl Unpin for EngineKey
impl UnsafeUnpin for EngineKey
impl UnwindSafe for EngineKey
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.