browserrouting

package
v0.158.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 2, 2026 License: Apache-2.0 Imports: 10 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DirectVMRoutingMiddleware

func DirectVMRoutingMiddleware(cache *RouteCache, subresources []string) option.Middleware

DirectVMRoutingMiddleware rewrites allowlisted browser subresource requests to the browser VM using cached base_url and jwt data.

func NewHTTPClient

func NewHTTPClient(browserBaseURL, jwt string, underlying *http.Client) *http.Client

NewHTTPClient returns an http.Client that performs browser egress HTTP via the browser session base_url and internal /curl/raw path.

Types

type RawCURLRoundTripper

type RawCURLRoundTripper struct {
	// contains filtered or unexported fields
}

RawCURLRoundTripper implements browser-egress HTTP by tunneling through the browser session base_url /curl/raw endpoint.

func (*RawCURLRoundTripper) RoundTrip

func (t *RawCURLRoundTripper) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip implements http.RoundTripper.

type Ref

type Ref struct {
	SessionID string
	BaseURL   string
	JWT       string
	CdpWsURL  string
}

Ref identifies a browser session for direct-to-VM HTTP calls. SessionID is reserved for future client-side routing; allowlisted requests rewrite the /browsers/{SessionID}/ path segment against the returned base_url.

func (Ref) Normalize

func (r Ref) Normalize() (Ref, error)

Normalize validates fields and fills JWT from CdpWsURL when JWT is empty.

type Route

type Route struct {
	SessionID string
	BaseURL   string
	JWT       string
}

Route identifies a cached direct-to-VM transport for one browser session.

type RouteCache

type RouteCache struct {
	// contains filtered or unexported fields
}

RouteCache stores browser session transport details keyed by session_id.

func NewRouteCache

func NewRouteCache() *RouteCache

NewRouteCache returns an empty browser route cache.

func (*RouteCache) Delete

func (c *RouteCache) Delete(sessionID string)

Delete removes a cached route.

func (*RouteCache) DeleteIfJWT added in v0.94.0

func (c *RouteCache) DeleteIfJWT(sessionID, jwt string) bool

DeleteIfJWT removes the cached route only when its JWT still matches.

func (*RouteCache) Load

func (c *RouteCache) Load(sessionID string) (Route, bool)

Load returns the cached route for the given session id.

func (*RouteCache) Store

func (c *RouteCache) Store(route Route)

Store normalizes and caches the given route.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL