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
Motiondomain — 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
- Browser
Session - A running engine process + the decisions made at launch.
- Fingerprint
Library - The bundled fingerprint library (JSON files under the cache dir).
- GeoInfo
- Host
Spec - Per-host archive set + extracted paths.
- Launch
Options - Parsed
Proxy - Profile
- Proxy
Check Result - 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
ShardXclass / NodeShardX. - ShardX
Options - Construction options for
ShardX.
Enums§
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 — bumpsnavigator.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
modetocfgin place. No-op forProfileor 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_strategyleaves it. - geo_
check_ via - Probe the geo
proxyexits at, or direct geo whenproxyisNone. - 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.
Noneon failure. - host_
screen_ size - Primary monitor
(width, height), orNoneon 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-serverargument (URL-encodeduser:pass@when present). Mirrors the launcher’sProxyEntry::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
GeoInfothat fed it, orNonewhen 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_versionChrome 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§
- Progress
Cb - Download-progress callback:
(label, received_bytes, total_bytes). - Size
- Primary monitor size in CSS pixels.