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 fetcher;
29pub mod health;
30pub mod manager;
31pub mod session;
32pub mod storage;
33pub mod strategy;
34pub mod types;
35
36#[cfg(feature = "graph")]
37pub mod graph;
38
39#[cfg(feature = "browser")]
40pub mod browser;
41
42/// MCP (Model Context Protocol) server — exposes proxy pool tools
43#[cfg(feature = "mcp")]
44pub mod mcp;
45
46// Top-level re-exports
47pub use circuit_breaker::{CircuitBreaker, STATE_CLOSED, STATE_HALF_OPEN, STATE_OPEN};
48pub use error::{ProxyError, ProxyResult};
49pub use fetcher::{FreeListFetcher, FreeListSource, ProxyFetcher, load_from_fetcher};
50pub use health::{HealthChecker, HealthMap};
51pub use manager::{PoolStats, ProxyHandle, ProxyManager, ProxyManagerBuilder};
52pub use session::{SessionMap, StickyPolicy};
53pub use storage::MemoryProxyStore;
54pub use strategy::{
55    BoxedRotationStrategy, LeastUsedStrategy, ProxyCandidate, RandomStrategy, RotationStrategy,
56    RoundRobinStrategy, WeightedStrategy,
57};
58pub use types::{Proxy, ProxyConfig, ProxyMetrics, ProxyRecord, ProxyType};
59
60#[cfg(feature = "graph")]
61pub use graph::{BoxedProxyManager, NoopProxyManager, ProxyManagerPort};
62
63#[cfg(feature = "browser")]
64pub use browser::{BrowserProxySource, ProxyManagerBridge};