Expand description
Per-vendor session stickiness policy.
The 2026 scraping guide (see
docs/dev/project/scraping-guide-2026-llm-context.md §“PROXY PROVIDERS
AND TYPES”) describes an anti-bot-specific stickiness matrix:
| Vendor | Recommended stickiness |
|---|---|
Akamai | Static / ISP IP, sticky for the lifetime of a long session. |
PerimeterX | Fresh session per domain (Camoufox + residential flow). |
DataDome | No stickiness — fresh proxy per request; mobile carrier wins. |
Kasada | Fresh session per domain. |
Cloudflare | Short (≈5 min) sticky window — cf_clearance re-issue cadence. |
Imperva | Medium (≈15 min) sticky window. |
| everything else | Fresh proxy per request (safest default for unknown vendors). |
VendorStickinessMap encodes that matrix as a typed
BTreeMap<VendorId, StickinessPolicy> so the SessionMap
and ProxyManager can pick the
correct sticky slot automatically when a session is requested for
(domain, vendor).
§Feature flag
The data types in this module are always compiled (so external
adapters can build a VendorStickinessMap without enabling the
feature). The wiring into
ProxyManager::acquire_for_domain_with_vendor
is gated behind the vendor-stickiness cargo feature (off by
default; wired into the full aggregator).
§Example
use std::time::Duration;
use stygian_proxy::stickiness::{StickinessPolicy, VendorStickinessMap};
use stygian_proxy::types::VendorId;
// Built-in defaults from the 2026 guide.
let defaults = VendorStickinessMap::with_builtin_defaults();
assert_eq!(
defaults.for_vendor(VendorId::Akamai),
StickinessPolicy::StickyForTtl { ttl: Duration::from_mins(30) }
);
assert_eq!(
defaults.for_vendor(VendorId::DataDome),
StickinessPolicy::FreshPerRequest
);
assert_eq!(
defaults.for_vendor(VendorId::Unknown),
StickinessPolicy::FreshPerRequest
); // unknown vendors fall back to the safest default
// Operators can override individual entries before applying built-ins.
let custom = VendorStickinessMap::with_builtin_defaults()
.with_override(VendorId::Akamai, StickinessPolicy::StickyForever);
assert_eq!(custom.for_vendor(VendorId::Akamai), StickinessPolicy::StickyForever);Structs§
- Vendor
Stickiness Map BTreeMap-backed stickiness policy keyed by anti-botVendorId.
Enums§
- Stickiness
Policy - Session stickiness policy keyed by anti-bot
VendorId.