proxy

package
v0.0.0-...-76384c5 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2026 License: BSD-2-Clause Imports: 17 Imported by: 0

Documentation

Overview

Package proxy implements transparent HTTP reverse proxying and connection hijacking for Docker API requests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTransport

func NewTransport(upstreamAddr string) (*http.Transport, error)

NewTransport creates an http.Transport configured to dial the specified raw upstream address. Supports "unix:///path.sock", "tcp://host:port", or plain "http://host:port".

func WithSession

func WithSession(ctx context.Context, session *ProxySession) context.Context

WithSession returns a new context carrying the provided ProxySession.

Types

type Middleware

type Middleware func(http.Handler) http.Handler

Middleware defines an HTTP interceptor wrapper around an http.Handler.

func RuleEvaluator

func RuleEvaluator(rs *rules.Ruleset) Middleware

RuleEvaluator returns a middleware that evaluates incoming requests against the policy ruleset. Denied requests are blocked with HTTP 403 Forbidden. Response list requests are transparently filtered.

type Proxy

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

Proxy routes incoming client requests to the upstream Docker daemon socket.

func New

func New(upstreamAddr string) (*Proxy, error)

New creates a new reverse proxy targeting the specified raw upstream address.

func (*Proxy) ServeHTTP

func (p *Proxy) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP handles incoming HTTP requests, session creation, middleware execution, and proxying.

func (*Proxy) Use

func (p *Proxy) Use(mw ...Middleware)

Use appends one or more middleware handlers to the proxy evaluation pipeline.

type ProxySession

type ProxySession struct {
	ID           string
	ClientAddr   string
	UpstreamAddr string
	StartTime    time.Time
	IsUpgraded   bool
}

ProxySession represents an active transaction between a client and the target daemon.

func FromContext

func FromContext(ctx context.Context) (*ProxySession, bool)

FromContext extracts a ProxySession from the context, if present.

func NewSession

func NewSession(clientAddr, upstreamAddr string) *ProxySession

NewSession creates a new ProxySession with a random 16-character hex ID.

Jump to

Keyboard shortcuts

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