#[non_exhaustive]pub struct Engine {
pub signals: Vec<Signal>,
pub request_headers: BTreeMap<String, String>,
pub regex_check: Option<String>,
}Expand description
Shared detection signature template for a family of sites that
run the same forum / blog / wiki software (Discourse, vBulletin,
XenForo, MediaWiki, …). Referenced from Site::engine.
Engines carry the same kinds of fields as a Site does (just
the inheritable ones — there’s no per-engine url, that comes
from the site itself). At registry load, the engine’s fields
are merged under each referring site’s own fields: site wins
on conflict.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.signals: Vec<Signal>Default detection signals for sites of this family.
Inherited only when the site itself declares no signals.
request_headers: BTreeMap<String, String>Default extra HTTP headers (e.g. a User-Agent that the platform accepts where the browser default gets blocked). Merged with the site’s own headers; site wins per-key.
regex_check: Option<String>Default username-validity regex inherited only when the site itself doesn’t declare one.
Implementations§
Source§impl Engine
impl Engine
Sourcepub fn validate(&self, name: &str) -> Result<()>
pub fn validate(&self, name: &str) -> Result<()>
Compile-check the engine’s own constraints — the inheritable fields are subject to the same validation as a site’s would be.
§Errors
Returns Error::InvalidSite when the engine name is
empty, a signal carries an empty marker, or any other
constraint a Site::validate would also flag.
Sourcepub fn merge_into(&self, site: &mut Site)
pub fn merge_into(&self, site: &mut Site)
Fill the inheritable empty / unset fields of site from
this engine. Site fields are authoritative: if the site has
any signals at all, no engine signals are merged in.
request_headers merge per-key (site wins on per-key
conflict).