Skip to main content

Crate antibot_rs

Crate antibot_rs 

Source
Expand description

Auto-managed Byparr/FlareSolverr client for bypassing bot detection.

Provides a unified client for the FlareSolverr-compatible API used by both Byparr and FlareSolverr.

§Features

  • Automatic Docker container lifecycle (pull, start, health-wait, restart, drop)
  • Provider-agnostic: Byparr, FlareSolverr, or any compatible image
  • Builder-style SolveRequest with GET/POST, headers, cookies, proxy, sessions, fingerprint
  • Per-domain session/cookie cache so repeat solves are free
  • Concurrent-solve coalescer that dedupes parallel solves
  • Retry policy with exponential backoff
  • Lock-free MetricsSnapshot for observability
  • Optional disk-replay sink for debugging
  • Round-robin across multiple instances
  • solve_stream for batch use with bounded concurrency
  • Standalone detect helpers for cheap challenge fingerprinting

§Quick start

use antibot_rs::{Antibot, Provider};

let client = Antibot::builder()
    .provider(Provider::Byparr)
    .auto_start(true)
    .enable_session_cache()
    .build()
    .await?;

let solution = client.solve("https://example.com").await?;
println!("Got {} bytes of HTML", solution.html().len());
use antibot_rs::{
    Antibot, CoalesceKey, Cookie, DebugConfig, DockerLimits, ProxyConfig,
    Provider, RetryPolicy, SolveRequest,
};
use std::time::Duration;

let client = Antibot::builder()
    .provider(Provider::Byparr)
    .auto_start(true)
    .docker_limits(DockerLimits::default().memory("2g").cpus("1.5").shm_size("1g"))
    .enable_session_cache()
    .coalesce_solves(CoalesceKey::Domain)
    .retry(RetryPolicy::default())
    .default_proxy(ProxyConfig::http("http://proxy.example:8080"))
    .debug(DebugConfig::new("./antibot-replay"))
    .health_watch(Duration::from_secs(30))
    .manage_lifecycle(true)
    .build()
    .await?;

let solution = client.execute(
    SolveRequest::post("https://site.com/api/login")
        .json(serde_json::json!({"user": "alice"}))
        .with_header("X-Custom", "value")
        .with_cookie(Cookie::new("session", "abc123"))
).await?;

Re-exports§

pub use detect::detect_challenge;
pub use detect::ChallengeKind;
pub use detect::DetectionInput;

Modules§

detect
Cheap challenge detection — decide whether to invoke the (expensive) solver.

Structs§

Antibot
Client for solving bot-detection challenges via Byparr/FlareSolverr.
AntibotBuilder
Builder for configuring and initializing an Antibot client.
BrowserFingerprint
CachedSession
Cookie
HTTP cookie used in solve requests and returned in solutions.
DebugConfig
DockerLimits
Resource caps applied to the spawned container.
MetricsSnapshot
Read-only point-in-time view of the client’s metrics.
ProxyConfig
HTTP/SOCKS proxy passed through to the underlying solver (Byparr/FlareSolverr).
RetryPolicy
SessionCacheConfig
SessionHandle
Handle to a provider-side persistent session. Drops auto-destroy the session on a background task; call SessionHandle::destroy explicitly to await.
Solution
Result of a solve. response is None for cache hits when only the cookies/user-agent were preserved; check SolutionSource to disambiguate.
SolveRequest
A request to solve a challenge.
Viewport

Enums§

AntibotError
CoalesceKey
Strategy for grouping in-flight solves.
PostBody
Provider
Docker image provider for the challenge-solving proxy.
SameSite
SolutionSource
Where this solution came from.
SolveMethod

Traits§

StreamExt
Re-export of futures::StreamExt so callers don’t need a direct dep just to consume Antibot::solve_stream. An extension trait for Streams that provides a variety of convenient combinator functions.

Functions§

merge_cookies
Apply additional cookies to an existing solution.

Type Aliases§

SolveStream