browserrouting

package
v0.52.0 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

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) 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