proxy

package
v0.0.0-...-cda31bf Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: Apache-2.0 Imports: 18 Imported by: 1

Documentation

Index

Constants

View Source
const (
	ClientProxyRetries  = 1
	SandboxProxyRetries = 5
)

Variables

View Source
var (
	ErrInvalidHost      = errors.New("invalid url host")
	ErrInvalidSandboxID = errors.New("invalid sandbox ID")
)

Functions

func GetTargetFromRequest

func GetTargetFromRequest() func(r *http.Request) (sandboxId string, port uint64, err error)

func SandboxSharedHostDomain

func SandboxSharedHostDomain(host string) (string, bool)

Types

type ConnectionLimitConfig

type ConnectionLimitConfig struct {
	Limiter              *connlimit.ConnectionLimiter
	GetMaxLimit          func(ctx context.Context) int
	OnConnectionAcquired func(ctx context.Context, count int64)
	OnConnectionReleased func(ctx context.Context, durationMs int64)
	OnConnectionBlocked  func(ctx context.Context)
}

ConnectionLimitConfig bundles connection limiting and associated metric callbacks. When nil is passed, connection limiting is disabled.

type InvalidSandboxPortError

type InvalidSandboxPortError struct {
	Port string
	// contains filtered or unexported fields
}

func (InvalidSandboxPortError) Error

func (e InvalidSandboxPortError) Error() string

func (InvalidSandboxPortError) Unwrap

func (e InvalidSandboxPortError) Unwrap() error

type InvalidTrafficAccessTokenError

type InvalidTrafficAccessTokenError struct {
	SandboxId string
	Header    string
}

func NewErrInvalidTrafficAccessToken

func NewErrInvalidTrafficAccessToken(sandboxId string, header string) *InvalidTrafficAccessTokenError

func (InvalidTrafficAccessTokenError) Error

type MaxConnectionAttempts

type MaxConnectionAttempts int

type MissingHeaderError

type MissingHeaderError struct {
	Header string
}

func (MissingHeaderError) Error

func (e MissingHeaderError) Error() string

type MissingTrafficAccessTokenError

type MissingTrafficAccessTokenError struct {
	SandboxId string
	Header    string
}

func NewErrMissingTrafficAccessToken

func NewErrMissingTrafficAccessToken(sandboxId, header string) *MissingTrafficAccessTokenError

func (MissingTrafficAccessTokenError) Error

type Proxy

type Proxy struct {
	http.Server
	// contains filtered or unexported fields
}

func New

func New(
	port uint16,
	maxConnectionAttempts MaxConnectionAttempts,
	idleTimeout time.Duration,
	getDestination func(r *http.Request) (*pool.Destination, error),
	connLimitConfig *ConnectionLimitConfig,
	disableKeepAlives bool,
) *Proxy

func (*Proxy) CurrentPoolConnections

func (p *Proxy) CurrentPoolConnections() int64

func (*Proxy) CurrentPoolSize

func (p *Proxy) CurrentPoolSize() int

func (*Proxy) CurrentServerConnections

func (p *Proxy) CurrentServerConnections() int64

CurrentServerConnections returns the current number of connections that are alive across whole pool.

func (*Proxy) ListenAndServe

func (p *Proxy) ListenAndServe(ctx context.Context) error

func (*Proxy) RemoveFromPool

func (p *Proxy) RemoveFromPool(connectionKey string) error

func (*Proxy) Serve

func (p *Proxy) Serve(l net.Listener) error

func (*Proxy) TotalPoolConnections

func (p *Proxy) TotalPoolConnections() uint64

TotalPoolConnections returns the total number of connections that have been established across whole pool.

type SandboxNotFoundError

type SandboxNotFoundError struct {
	SandboxId string
}

func NewErrSandboxNotFound

func NewErrSandboxNotFound(sandboxId string) *SandboxNotFoundError

func (SandboxNotFoundError) Error

func (e SandboxNotFoundError) Error() string

type SandboxResourceExhaustedError

type SandboxResourceExhaustedError struct {
	SandboxId string
	Message   string
}

func NewErrSandboxResourceExhausted

func NewErrSandboxResourceExhausted(sandboxId string, message string) *SandboxResourceExhaustedError

func (SandboxResourceExhaustedError) Error

type SandboxResumePermissionDeniedError

type SandboxResumePermissionDeniedError struct {
	SandboxId string
}

func NewErrSandboxResumePermissionDenied

func NewErrSandboxResumePermissionDenied(sandboxId string) *SandboxResumePermissionDeniedError

func (SandboxResumePermissionDeniedError) Error

type SandboxStillTransitioningError

type SandboxStillTransitioningError struct {
	SandboxId string
}

func NewErrSandboxStillTransitioning

func NewErrSandboxStillTransitioning(sandboxId string) *SandboxStillTransitioningError

func (SandboxStillTransitioningError) Error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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