[package]
name        = "stygian-proxy"
description = "High-performance, resilient proxy rotation for the Stygian scraping ecosystem."
version.workspace     = true
edition.workspace     = true
rust-version.workspace = true
authors.workspace     = true
license.workspace     = true
repository.workspace  = true
readme      = "README.md"
keywords = ["proxy", "rotation", "scraping", "http", "socks"]
categories = ["network-programming", "web-programming"]

[features]
default = []
socks        = ["reqwest/socks"]
graph        = []
browser      = ["dep:stygian-browser"]
tls-profiled = ["dep:stygian-browser", "stygian-browser/tls-config"]
# MCP (Model Context Protocol) server — exposes proxy pool tools over stdin/stdout JSON-RPC 2.0
mcp = []
dns-fetcher  = ["dep:hickory-resolver"]
## Bayesian multi-armed-bandit rotation (Thompson sampling) backed by
## per-proxy `Beta(α, β)` counters and a fast xorshift64 RNG. Off by
## default so existing deployments retain deterministic round-robin.
## Wires into the `full` aggregator below.
bayesian-rotation = []
## Network-identity coherence validator. Detects the "US residential
## proxy + Pakistani DNS resolver + WebRTC local IP" mismatch cited by
## the 2026 guide (L3135-3138). Adds the `CoherencePort` trait plus a
## `DefaultCoherenceValidator` covering country + DNS + WebRTC public
## IP /16 + timezone vectors. Off by default so existing pipelines are
## unaffected. Wires into the `full` aggregator below.
coherence-validation = []
## Per-vendor session stickiness policy. Translates the 2026 guide's
## anti-bot-specific stickiness matrix (`Akamai` → 30min sticky,
## `PerimeterX` / `Kasada` → fresh per domain, `DataDome` → fresh per
## request, `Cloudflare` → 5min sticky, `Imperva` → 15min sticky,
## everything else → fresh per request) into a typed policy keyed by
## [`VendorId`](crate::types::VendorId). Wires into
## [`SessionMap::acquire_session`](crate::session::SessionMap::acquire_session)
## and [`ProxyManager::acquire_for_domain_with_vendor`](crate::manager::ProxyManager::acquire_for_domain_with_vendor).
## Off by default so existing deployments that rely on the current
## per-domain-only sticky policy are unaffected. Wires into the `full`
## aggregator below.
vendor-stickiness = []
## Aggregator — every feature in the crate compiled in. Used by CI and
## downstream `stygian-graph` integration tests.
full = ["socks", "graph", "browser", "tls-profiled", "mcp", "dns-fetcher", "bayesian-rotation", "coherence-validation", "vendor-stickiness"]


[dependencies] 
# Workspace deps
tokio       = { workspace = true }
tokio-util  = { workspace = true }
thiserror   = { workspace = true }
tracing     = { workspace = true }
serde       = { workspace = true }
serde_json  = { workspace = true }
uuid        = { workspace = true }
ulid        = { workspace = true }
async-trait = { workspace = true }

# reqwest — socks feature is unlocked via the "socks" cargo feature
reqwest = { workspace = true }

# Async concurrency utilities
futures = { workspace = true }

# Random strategy
rand = { workspace = true }

# Browser integration (optional)
stygian-browser = { path = "../stygian-browser", version = "0.14.2", optional = true }

# DNS TXT proxy discovery (optional)
hickory-resolver = { version = "0.26.1", features = ["tokio"], optional = true }

[dev-dependencies]
tokio       = { workspace = true }
tokio-test  = "0.4"
wiremock    = "0.6"
toml        = { workspace = true }

[lints]
workspace = true
