Skip to main content

Crate proxybroker

Crate proxybroker 

Source
Expand description

§proxybroker

Find, check, and serve public HTTP(S) and SOCKS4/5 proxies.

A Rust rewrite of proxybroker2. See NOTICE for attribution and a statement of changes.

The three core capabilities are complete: Broker::grab scrapes providers, Broker::find checks them and classifies anonymity, and server::serve runs a local rotating proxy server (behind the server feature).

use proxybroker::{Broker, FindQuery, Proto, TypeSpec};
use futures_util::StreamExt;

let broker = Broker::builder().build();
let mut stream = broker.find(
    FindQuery::builder()
        .types(vec![TypeSpec::any(Proto::Http)])
        .limit(10)
        .build(),
).await?;
while let Some(proxy) = stream.next().await {
    println!("{}", proxy.addr());
}

Re-exports§

pub use broker::Broker;
pub use broker::FindQuery;
pub use broker::FindQueryBuilder;
pub use broker::GrabQuery;
pub use broker::ProxyStream;
pub use checker::Checker;
pub use checker::CheckerConfig;
pub use checker::RetryPolicy;
pub use checker::TrustReport;
pub use checker::TrustSignal;
pub use error::Error;
pub use error::ProxyError;
pub use geo::GeoDb;
pub use negotiator::Stream;
pub use negotiator::Target;
pub use parse::parse_proxy_lines;
pub use provider::config_template;
pub use provider::load_provider_dir;
pub use provider::Candidate;
pub use provider::ProviderSpec;
pub use proxy::read_ndjson;
pub use proxy::write_ndjson;
pub use proxy::Asn;
pub use proxy::Capabilities;
pub use proxy::Country;
pub use proxy::Credentials;
pub use proxy::Proxy;
pub use resolver::Resolver;
pub use server::serve;
pub use server::ClientKey;
pub use server::Pool;
pub use server::PoolConfig;
pub use server::PoolSnapshot;
pub use server::ServerHandle;
pub use server::Strategy;
pub use stats::Stats;
pub use types::AnonLevel;
pub use types::Caps;
pub use types::JudgeScheme;
pub use types::ParseProtoError;
pub use types::Proto;
pub use types::Scheme;
pub use types::TypeSpec;

Modules§

broker
The Broker: orchestrates providers into a stream of proxies.
checker
The Checker: validate one proxy across the requested protocols, and classify its anonymity. checker.py:Checker.
error
The error taxonomy: two enums split by whether the caller can act.
geo
Country lookup for IP addresses, backed by a MaxMind-format database.
judge
Judges: endpoints that echo back the request headers and the client IP, used to measure a proxy’s anonymity.
negotiator
Per-protocol negotiation: turning a raw TCP connection to a proxy into a stream tunnelled to a target (a judge), ready for an HTTP request.
parse
IP:port scanning. The one home for extracting proxy addresses from text.
provider
Proxy providers: where candidate proxies come from.
proxy
The Proxy value type: an address, the protocols it is expected to (and confirmed to) support, timing/error statistics, and geolocation.
resolver
DNS resolution and this host’s external-IP discovery.
server
A local rotating proxy server: accepts client connections and relays each through a pool of checked proxies, retrying on a different proxy when one fails. server.py.
stats
Aggregate statistics over a set of found proxies. api.py:Broker.show_stats.
types
The canonical shared vocabulary.
utils
Small helpers shared across modules — the module every other module assumed someone else would write (design critique #39). Ported from utils.py.

Functions§

install_default_crypto_provider
Install the ring crypto provider as rustls’ process default, exactly once (idempotent).