Skip to main content

stygian_proxy/
lib.rs

1//! # stygian-proxy
2//!
3//! High-performance, resilient proxy rotation for the Stygian scraping ecosystem.
4//!
5//! ## Features
6//!
7//! - Pluggable rotation strategies: round-robin, random, weighted, least-used
8//! - Per-proxy latency and success-rate tracking via atomics
9//! - Async health checker with configurable intervals
10//! - Per-proxy circuit breaker (Closed → Open → HalfOpen)
11//! - In-memory proxy pool (no external DB required)
12//! - `graph` feature: [`ProxyManagerPort`] trait for stygian-graph HTTP adapters
13//! - `browser` feature: per-context proxy binding for stygian-browser
14//!
15//! ## Quick start
16//!
17//! ```rust,no_run
18//! use stygian_proxy::error::ProxyResult;
19//!
20//! fn main() -> ProxyResult<()> {
21//!     // ProxyManager construction added in T12 (proxy-manager task)
22//!     Ok(())
23//! }
24//! ```
25
26pub mod circuit_breaker;
27pub mod error;
28pub mod health;
29pub mod manager;
30pub mod session;
31pub mod storage;
32pub mod strategy;
33pub mod types;
34
35#[cfg(feature = "graph")]
36pub mod graph;
37
38#[cfg(feature = "browser")]
39pub mod browser;
40
41// Top-level re-exports
42pub use circuit_breaker::{CircuitBreaker, STATE_CLOSED, STATE_HALF_OPEN, STATE_OPEN};
43pub use error::{ProxyError, ProxyResult};
44pub use health::{HealthChecker, HealthMap};
45pub use manager::{PoolStats, ProxyHandle, ProxyManager, ProxyManagerBuilder};
46pub use session::{SessionMap, StickyPolicy};
47pub use storage::MemoryProxyStore;
48pub use strategy::{
49    BoxedRotationStrategy, LeastUsedStrategy, ProxyCandidate, RandomStrategy, RotationStrategy,
50    RoundRobinStrategy, WeightedStrategy,
51};
52pub use types::{Proxy, ProxyConfig, ProxyMetrics, ProxyRecord, ProxyType};
53
54#[cfg(feature = "graph")]
55pub use graph::{BoxedProxyManager, NoopProxyManager, ProxyManagerPort};
56
57#[cfg(feature = "browser")]
58pub use browser::{BrowserProxySource, ProxyManagerBridge};