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 ¶
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 ¶
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 (*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.