allowlist

package
v1.41.1 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package allowlist provides a mechanism restrict which repos can go through Packhorse's caching mechanism. Repositories not in the allowlist would be proxied to the upstream.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Allowlist

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

Allowlist holds the set of repos that should be routed through Packhorse's caching path. If repos is empty, no repos are cached. If disabled is true, all repos will be cached.

func New

func New(repos []string, disabled bool) *Allowlist

New builds an Allowlist from a list of repositories in the form of "group/project" - e.g. "gitlab-org/gitlab".

func (*Allowlist) Allowed

func (a *Allowlist) Allowed(repo string) bool

Allowed returns whether the given repository should go through Packhorse's caching path. Note: An empty struct e.g. `var list *allowlist.Allowlist` produces the same behavior as a disabled allowlist (allows all repositories).

func (*Allowlist) Bounded added in v1.25.0

func (a *Allowlist) Bounded() bool

Bounded reports whether the allowlist limits which repos can be cached (active, not nil or disabled). When true, labelling metrics by repository is cardinality-safe.

func (*Allowlist) Contains added in v1.41.0

func (a *Allowlist) Contains(repo string) bool

Contains reports whether the repository is literally in the set, regardless of the disabled flag. Unlike Allowed, Contains does not treat a nil or disabled allowlist as matching every repo — the return is a raw set-membership check. Used by opt-in features (like dry-run mode) whose "enabled for this repo" question is the opposite of the caching path's "allow this repo" question.

Jump to

Keyboard shortcuts

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