middleware

package
v1.39.3 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package middleware provides HTTP middleware functions for Packhorse.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Allowlist

func Allowlist(list *allowlist.Allowlist, fallback http.Handler) func(http.Handler) http.Handler

Allowlist wraps allowlist.Allowlist in a HTTP middleware. Requests for repositories not on the list are sent to fallback, which proxies them straight to the upstream without consulting the cache.

When list is nil or its disabled flag is set, every request flows through to next — see allowlist.Allowlist.Allowed.

func ProtocolV2

func ProtocolV2(next http.Handler) http.Handler

ProtocolV2 is HTTP middleware that enforces Git Protocol v2. It checks for the Git-Protocol header with value "version=2". Returns 400 Bad Request if missing or has different value.

This middleware should be applied to Git protocol routes but not to API routes that don't require Git protocol headers.

Types

This section is empty.

Jump to

Keyboard shortcuts

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