Expand description
§Bao — unified library
Single consumer-facing package. Full stack is always linked:
SpiderMonkey (bao_engine) + servo browser (bao_browser) + Node/Bun API
(bun_runtime) + CDP (bao_cdp / bao_cdp_client) + Stealth (bao_stealth).
There are no Cargo product features that disable browser, CDP, stealth,
or Node API. Runtime knobs (e.g. StealthProfile, permissions) select
behaviour without changing the link set.
§Quick start
use bao::{BaoConfig, BaoRuntime, PageConfig, StealthProfile};
fn main() -> Result<(), bao::BrowserError> {
let runtime = BaoRuntime::new(BaoConfig::default())?;
let _pool = runtime.page_pool();
let _ = StealthProfile::firefox_default();
let _ = PageConfig::default();
Ok(())
}§CDP (Playwright-style)
use bao::Browser;
fn main() -> Result<(), bao::ConnectError> {
let browser = Browser::connect("memory://bao")?;
let _ = browser;
Ok(())
}@trace REQ-LIB-001 [level:library] @trace REQ-LIB-003 [level:library] @trace REQ-BRW-003 [level:library]
Modules§
- browser
- Browser runtime, PagePool, PageHandle, permissions, screenshots.
- cdp
- CDP server / router / WS codec surface.
- cdp_
client - Playwright-style CDP client (
Browser::connect, Page, …). - engine
- SpiderMonkey engine surface (via
bao_enginere-exports). - runtime
- Node.js / Bun API compatibility runtime (
bun_runtimecrate). - stealth
- Anti-fingerprint profiles and engine (runtime configuration).
- uloop
- Event loop (epoll tick shared with FilePoll).
Structs§
- Audio
Profile - BaoConfig
- BaoRuntime
- Behavior
Config - Behavior
Simulator - Browser
- CDP Browser 实例。
- Browser
Config - Canvas
Noise - CdpRouter
- CdpServer
- CdpSession
- Connection
- Connection — CDP JSON-RPC 命令收发 + 事件分发核心。
- Connection
Config - Connection 配置(超时、重试、session_id 等)。
- Cookie
- HTTP Cookie 表示(对应 CDP
Network.Cookie/Network.setCookie)。 - Device
Descriptor - 设备描述符(用于
Page.emulate设备模拟)。 - Font
Config - Font fingerprint protection configuration.
- Http2
Fingerprint - Navigator
Profile - Page
Config - Page
Handle - Page
Pool - Permission
- Permission
Denied - Permission
Guard - Screen
Profile - Stealth
Engine - Stealth
Hooks - Stealth
Profile - Stealth
TlsWire Config - Wire-level TLS/HTTP2 configuration for servo’s network layer.
- TlsFingerprint
- Viewport
- Viewport(viewport 配置)。
- WebGL
Profile
Enums§
- Backend
Kind - Browser
Error - CdpError
- 通信阶段错误(
Transport使用,具体实现在 TASK-2)。 - Connect
Error - 连接阶段错误(
Browser::connect入口返回)。 - Page
State - Screenshot
Format - Wait
Until State - 等待页面就绪的状态(对应 Puppeteer
waitUntil选项)。