proxy

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

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

Handler is the main HTTP handler: intercepts downloads, applies SC filter, caches, proxies.

func NewHandler

func NewHandler(cfg HandlerConfig) *Handler

NewHandler creates a new ProxyHandler.

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type HandlerConfig

type HandlerConfig struct {
	Adapter    gate.RegistryAdapter
	Filter     gate.SCFilter
	Cache      gate.ArtifactCache
	Logger     zerolog.Logger
	CVEScanner gate.CVEScanner    // optional; nil disables CVE scanning
	Policy     gate.PolicyDecider // optional; nil allows all when CVEScanner is set
	AVScanner  gate.AVScanner     // optional; nil disables malware scanning
	Recorder   gate.Recorder      // optional; nil disables telemetry
	// CVERecheckTTL / MalwareRecheckTTL: a cache hit whose respective check is
	// older than this re-runs that gate before serving (0 disables). A scanner
	// failure serves the stale entry and leaves the timestamp untouched.
	CVERecheckTTL     time.Duration
	MalwareRecheckTTL time.Duration
	// HTTPClient downloads artifacts and serves transparent proxy requests.
	// Optional; nil uses a private client with a 60s timeout. Pass a client whose
	// transport caps per-host concurrency (shared with the adapters) so artifact
	// downloads count against the same upstream rate limit as metadata fetches.
	HTTPClient *http.Client
}

HandlerConfig groups dependencies for the ProxyHandler.

type Mux

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

Mux routes requests to per-registry handlers by URL path prefix. A request to /<prefix>/... is dispatched to the handler registered for <prefix> with the prefix stripped, so each registry adapter sees the same paths it would without the proxy wrapper.

func NewMux

func NewMux(handlers map[string]*Handler, raw map[string]http.Handler, logger zerolog.Logger) *Mux

NewMux creates a Mux. raw may be nil; it holds prefixes served by a plain http.Handler (e.g. the Docker V2 proxy).

func (*Mux) ServeHTTP

func (m *Mux) ServeHTTP(w http.ResponseWriter, r *http.Request)

Directories

Path Synopsis
Package adapters implements per-registry RegistryAdapter implementations.
Package adapters implements per-registry RegistryAdapter implementations.
Package dockerproxy implements a pull-through Docker Registry V2 proxy that gates images on Trivy (CVE/secrets) and ClamAV (signature malware) before serving them.
Package dockerproxy implements a pull-through Docker Registry V2 proxy that gates images on Trivy (CVE/secrets) and ClamAV (signature malware) before serving them.

Jump to

Keyboard shortcuts

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