pub struct VendorQuirk {
pub host_suffix: &'static str,
pub port: Option<u16>,
pub required_scheme: Scheme,
pub description: &'static str,
pub severity: QuirkSeverity,
}Expand description
A vendor-specific proxy URL rule, declared as a const table record.
Quirks match on host_suffix:port (no credentials). The semantics
are severity-driven:
- For
QuirkSeverity::Error, the quirk fires when the URL’sscheme != required_scheme(e.g.Crawlera8011 +https://). - For
QuirkSeverity::WarningandQuirkSeverity::Info, the quirk fires on everyhost_suffix:portmatch (therequired_schemefield is informational and not used for the trigger).
Copy so the VENDOR_QUIRKS const slice can be iterated without
moving records out.
§Example
use stygian_proxy::vendor_quirks::{Scheme, VendorQuirk, QuirkSeverity, VENDOR_QUIRKS};
let crawlera = VENDOR_QUIRKS
.iter()
.find(|q| q.host_suffix == "crawlera.com")
.expect("Crawlera quirk seeded");
assert_eq!(crawlera.port, Some(8011));
assert_eq!(crawlera.required_scheme, Scheme::Http);
assert_eq!(crawlera.severity, QuirkSeverity::Error);
// Quirk descriptions never include the password component.
assert!(!crawlera.description.contains("pass"));
assert!(!crawlera.description.contains('@'));
let _: VendorQuirk = *crawlera; // `Copy` for const-slice iterationFields§
§host_suffix: &'static strHost suffix that triggers the quirk (e.g. "crawlera.com",
"brd.superproxy.io"). Matched as an exact host name OR as a
subdomain boundary (e.g. proxy.crawlera.com matches
crawlera.com).
port: Option<u16>Port that triggers the quirk. None matches any port.
required_scheme: SchemeScheme that the provider requires on this port. Used by
QuirkSeverity::Error quirks to detect a scheme mismatch
(the reject trigger). Ignored by Warning / Info quirks.
description: &'static strHuman-readable description of the quirk and the failure mode it
prevents. Used as the structured error reason in
validate_proxy_url.
severity: QuirkSeveritySeverity classification — drives whether the URL is rejected, warned, or just recorded.
Trait Implementations§
Source§impl Clone for VendorQuirk
impl Clone for VendorQuirk
Source§fn clone(&self) -> VendorQuirk
fn clone(&self) -> VendorQuirk
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for VendorQuirk
Source§impl Debug for VendorQuirk
impl Debug for VendorQuirk
impl Eq for VendorQuirk
Source§impl Hash for VendorQuirk
impl Hash for VendorQuirk
Source§impl PartialEq for VendorQuirk
impl PartialEq for VendorQuirk
impl StructuralPartialEq for VendorQuirk
Auto Trait Implementations§
impl Freeze for VendorQuirk
impl RefUnwindSafe for VendorQuirk
impl Send for VendorQuirk
impl Sync for VendorQuirk
impl Unpin for VendorQuirk
impl UnsafeUnpin for VendorQuirk
impl UnwindSafe for VendorQuirk
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,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.