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,
Widevine CDM, and the bundled fingerprint library from the ProxyShard
CDN into a per-user cache dir, 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 session = sdk
.session(None, 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 chromiumoxide;
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§
- Launch
Input - What to launch: a library id, a ready
Profile, or a raw config object. - Proxy
Scheme - Screen
Strategy - WebRtc
Mode
Constants§
- CHROMIUM_
VERSION - LINUX_
PLATFORM_ VERSIONS - MACOS_
PLATFORM_ VERSIONS - PUB_
BASE - WINDOWS_
PLATFORM_ VERSIONS - 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. “149.0.7827.103”) 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. - 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. - 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). - 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). - 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.