devtoolsproxy

package
v0.0.0-...-6ba41bd Latest Latest
Warning

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

Go to latest
Published: May 28, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WebSocketProxyHandler

func WebSocketProxyHandler(mgr *UpstreamManager, logger *slog.Logger, logCDPMessages bool, ctrl scaletozero.Controller, publish EventPublisher) http.Handler

WebSocketProxyHandler returns an http.Handler that upgrades incoming connections and proxies them to the current upstream websocket URL. It expects only websocket requests. If logCDPMessages is true, all CDP messages will be logged with their direction. publish is invoked on accept (cdp_connect) and on teardown (cdp_disconnect); pass nil to disable emission.

Types

type EventPublisher

type EventPublisher func(ev events.Event)

EventPublisher publishes a telemetry event onto the in-VM events pipeline. nil disables emission.

type UpstreamManager

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

UpstreamManager tails the Chromium supervisord log and extracts the current DevTools websocket URL, updating it whenever Chromium restarts and emits a new line.

func NewUpstreamManager

func NewUpstreamManager(logFilePath string, logger *slog.Logger) *UpstreamManager

func (*UpstreamManager) Current

func (u *UpstreamManager) Current() string

Current returns the current upstream websocket URL if known, or empty string.

func (*UpstreamManager) Start

func (u *UpstreamManager) Start(ctx context.Context)

Start begins background tailing and updating the upstream URL until ctx is done.

func (*UpstreamManager) Stop

func (u *UpstreamManager) Stop()

Stop cancels the background tailer.

func (*UpstreamManager) Subscribe

func (u *UpstreamManager) Subscribe() (<-chan string, func())

Subscribe returns a channel that receives new upstream URLs as they are discovered. The returned cancel function should be called to unsubscribe and release resources.

func (*UpstreamManager) WaitForInitial

func (u *UpstreamManager) WaitForInitial(timeout time.Duration) (string, error)

WaitForInitial blocks until an initial upstream URL has been discovered or the timeout elapses.

Jump to

Keyboard shortcuts

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