pool

package
v0.0.0-...-e7b3cca Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2026 License: Apache-2.0 Imports: 17 Imported by: 1

Documentation

Index

Constants

View Source
const ClientProxyConnectionKey = "client-proxy"

ClientProxyConnectionKey is a constant connection key for client proxy, because we don't have to separate connection pools as we need to do when connecting to sandboxes (from orchestrator proxy) to prevent reuse of pool connections by different sandboxes cause failed connections.

View Source
const MaskRequestHostPortPlaceholder = "${PORT}"

Variables

This section is empty.

Functions

func WithDestination

func WithDestination(ctx context.Context, d *Destination) context.Context

Types

type Destination

type Destination struct {
	Url         *url.URL
	SandboxId   string
	SandboxPort uint64
	// Should we return the error about closed port if there is a problem with a connection to upstream?
	DefaultToPortError bool
	RequestLogger      logger.Logger
	// ConnectionKey uniquely identifies a single sandbox lifecycle. It is
	// used for two purposes:
	//   1. keepalive connection pool isolation, so connections to a reused
	//      IP:port pair are not accidentally shared across sandboxes;
	//   2. per-sandbox ingress connection limiter accounting.
	// Embedders should pick a value that is unique per lifecycle.
	ConnectionKey                      string
	IncludeSandboxIdInProxyErrorLogger bool
	// MaskRequestHost is used to mask the request host.
	MaskRequestHost *string
	// InsecureSkipTLSVerify is read once, when the pool builds the client for
	// ConnectionKey; later destinations sharing that key inherit the first
	// one's value. Keep it constant per ConnectionKey.
	InsecureSkipTLSVerify bool
}

Destination contains information about where to route the request.

type ProxyClient

type ProxyClient struct {
	httputil.ReverseProxy
	// contains filtered or unexported fields
}

type ProxyPool

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

func New

func New(maxClientConns int, maxConnectionAttempts int, idleTimeout time.Duration, disableKeepAlives bool) *ProxyPool

func (*ProxyPool) Close

func (p *ProxyPool) Close(connectionKey string) (err error)

func (*ProxyPool) CurrentConnections

func (p *ProxyPool) CurrentConnections() int64

func (*ProxyPool) Get

func (p *ProxyPool) Get(ctx context.Context, d *Destination) *ProxyClient

func (*ProxyPool) Size

func (p *ProxyPool) Size() int

func (*ProxyPool) TotalConnections

func (p *ProxyPool) TotalConnections() uint64

Jump to

Keyboard shortcuts

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