Skip to main content

Crate shardx

Crate shardx 

Source
Expand description

§ShardX Rust SDK

Self-contained SDK for the ShardX anti-detect browser. Mirrors the Python (shardx) and Node (@proxyshard/shardx) SDKs: on first use it downloads the engine and the bundled fingerprint library from the ProxyShard CDN into a per-user cache dir (the Widevine CDM from Google), then launches isolated profiles with the same spoofing flags the desktop launcher uses.

use shardx::{ShardX, ShardXOptions, LaunchOptions};

let sdk = ShardX::new(ShardXOptions::default())?;

// Launch a random profile through a proxy AND attach a CDP browser.
let profile = sdk.create_profile(None).await?;
let session = sdk
    .session(profile, LaunchOptions {
        proxy: Some("socks5://user:pass@host:1080".into()),
        ..Default::default()
    })
    .await?;

let _page = session.new_page("https://example.com").await?;
// ... drive `session.browser` (chromiumoxide) ...
session.close().await?;

Re-exports§

pub use motion::Motion;
pub use chromiumoxide;

Modules§

motion
The engine’s Motion domain — pointer movement, keystrokes, finger gestures and turning the handset. Everything is produced inside the browser process; nothing is injected into the page.

Structs§

Archive
One downloadable archive on the CDN.
Browser
BrowserSession
A running engine process + the decisions made at launch.
FingerprintLibrary
The bundled fingerprint library (JSON files under the cache dir).
GeoInfo
HostSpec
Per-host archive set + extracted paths.
LaunchOptions
ParsedProxy
Profile
ProxyCheckResult
Result of ShardX::check_proxy — the same data the launcher uses to decide QUIC + WebRTC policy.
Runtime
Session
A launched ShardX engine with a connected CDP client.
ShardX
Top-level façade — bundles the runtime, fingerprint library, and browser launcher. Mirrors the Python ShardX class / Node ShardX.
ShardXOptions
Construction options for ShardX.

Enums§

ProxyScheme
ScreenStrategy
WebRtcMode

Constants§

CHROMIUM_VERSION
LINUX_PLATFORM_VERSIONS
Chrome on Linux reports an empty version, and the engine since build 4 says so itself. A value is still written so an older engine does not pass on the host’s own.
MACOS_PLATFORM_VERSIONS
Chrome writes major.minor.patch, never two parts. Current releases as of 2026-11 (support.apple.com/100100); Sonoma ends at 14.8.9.
PUB_BASE
WINDOWS_PLATFORM_VERSIONS
Chrome reports the UniversalApiContract: 10 on Win10 2004+, 15 on Win11 22H2/23H2, 19 on 24H2/25H2. 13 and 16-18 exist only on Insider builds.
X86_CORES
Real x86 logical-core counts (SMT + Intel hybrid). Same array as the launcher.

Functions§

apply_engine_version
Normalise a profile config’s spoofed Chrome version to chromium_version (e.g. “152.0.7977.65”) so it always matches the running engine — bumps navigator.user_agent (Chrome/.0.0.0) and the version fields in client_hints: brand_version / brand_full_version / chrome_build / chrome_patch (derived from the version) plus, when supplied, grease_brand / grease_version / grease_full_version (GREASE rotates per release, so it can’t be derived — it comes from the manifest). Leaves platform_version, architecture, etc. intact. SDK equivalent of the launcher’s post-update profile migration.
apply_screen_strategy
Apply mode to cfg in place. No-op for Profile or when the host size can’t be probed, and for a phone in every mode, as in the launcher (#131).
default_cache_dir
Default per-user cache dir (mirrors the Node SDK layout, shardx-sdk).
default_screen_mode_for
Default screen mode for a navigator.platform, matching the launcher. A phone keeps its own screen whatever its platform says: apply_screen_strategy leaves it.
geo_check_via
Probe the geo proxy exits at, or direct geo when proxy is None.
has_auto_fields
True when the config still carries any unresolved "auto" sentinel.
host_logical_cores
Logical CPU count (SMT threads). Falls back to 8.
host_ram_bucket_gb
Round host RAM to Chrome’s deviceMemory bucket {8,16,32}; None → 16.
host_ram_gb
Physical RAM in GiB, best-effort per OS. None on failure.
host_screen_size
Primary monitor (width, height), or None on failure.
host_spec
Archives + layout for the current host; errors on unsupported platforms.
mac_hw_configs
Curated (hardware_concurrency, device_memory_gib) pairs per Mac profile id.
parse_proxy
probe_udp
UDP RTT (ms) through the SOCKS5 relay. Err when unavailable (caller maps to None). Only valid for SOCKS5.
proxy_to_arg
Format as the ShardX engine’s --proxy-server argument (URL-encoded user:pass@ when present). Mirrors the launcher’s ProxyEntry::to_proxy_server_arg.
randomize_hardware
Pick fresh (hardware_concurrency, device_memory).
randomize_platform_version
Pick a fresh navigator.platform_version (+ mirror to client_hints). A Mac gets only versions its claimed chip can run.
resolve_auto_fields
Apply the launcher’s “auto” resolution. Returns the GeoInfo that fed it, or None when both proxy + direct probes failed and the host fallback was used (or there was nothing to resolve).
settle_platform_version
A Windows or macOS platform_version Chrome could not report (Windows 13/16/17, a two-part macOS version, an M4 on 14.x) becomes the nearest one it can, in navigator and client_hints alike. Deterministic, so launch applies it every time; Linux is left to the engine. Whether anything changed. SDK equivalent of the launcher’s function of the same name.
user_data_dir
Per-profile state dir (cookies / IndexedDB / cache), preserved across launches. Defaults to <profiles_root>/<id>/.

Type Aliases§

ProgressCb
Download-progress callback: (label, received_bytes, total_bytes).
Size
Primary monitor size in CSS pixels.