Documentation
¶
Overview ¶
Package cdp drives an already-running stealth browser over the Chrome DevTools Protocol to extract and inject browser storage state. It connects through the serve multiplexer's ?fingerprint=<seed> routing via chromedp's RemoteAllocator and never launches Chrome itself.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Cookie ¶
type Cookie struct {
Name string `json:"name"`
Value string `json:"value"`
Domain string `json:"domain"`
Path string `json:"path"`
Expires float64 `json:"expires"`
HTTPOnly bool `json:"httpOnly"`
Secure bool `json:"secure"`
SameSite string `json:"sameSite,omitempty"`
}
Cookie mirrors a Playwright storageState cookie. Expires is seconds since the epoch, or -1 for a session cookie.
type LocalStorageItem ¶
LocalStorageItem is a single localStorage key/value pair.
type Origin ¶
type Origin struct {
Origin string `json:"origin"`
LocalStorage []LocalStorageItem `json:"localStorage"`
}
Origin is one origin's localStorage in the Playwright storageState shape.
type StorageState ¶
StorageState is the subset of the Playwright storageState JSON shape cuttle checks out and back in: global cookies plus per-origin localStorage. It is small (auth state, not full Chrome-profile fidelity) so it round-trips over CDP between the local canonical copy and an ephemeral remote seed.
func Extract ¶
func Extract(ctx context.Context, cdpBase, seed string, origins []string) (*StorageState, []string, error)
Extract connects to the seed's browser and reads its storage state. Cookies are browser-global; localStorage is origin-scoped, so each origin is visited on a scratch tab (localStorage is only readable from a document of that origin). An origin that fails to load contributes no localStorage rather than failing the whole extract; its origin string is returned in failed so the caller can tell a transient load failure apart from a genuinely-empty origin and preserve the last-known localStorage for the former.
func (*StorageState) OriginURLs ¶
func (s *StorageState) OriginURLs() []string
OriginURLs returns the origin strings the state carries, so a checkin knows which origins to re-read localStorage from.