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