proxy

package
v0.0.0-...-c80058d Latest Latest
Warning

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

Go to latest
Published: May 15, 2026 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const TrimmedManifestlist = "trimmedmanifestlist:"

TrimmedManifestlist - key prefix for trimmed manifest

Variables

This section is empty.

Functions

func GetRemoteRepo

func GetRemoteRepo(art lib.ArtifactInfo) string

GetRemoteRepo get the remote repository name, used in proxy cache

func NewCacheHandlerRegistry

func NewCacheHandlerRegistry(local localInterface) map[string]ManifestCacheHandler

NewCacheHandlerRegistry ...

func SendPullEvent

func SendPullEvent(ctx context.Context, a *artifact.Artifact, tag, operator string)

SendPullEvent send a pull image event

Types

type Controller

type Controller interface {
	// UseLocalBlob check if the blob should use local copy
	UseLocalBlob(ctx context.Context, art lib.ArtifactInfo) bool
	// UseLocalManifest check manifest should use local copy
	UseLocalManifest(ctx context.Context, art lib.ArtifactInfo, remote RemoteInterface, p *proModels.Project) (bool, *ManifestList, error)
	// ProxyBlob proxy the blob request to the remote server, p is the proxy project
	// art is the ArtifactInfo which includes the digest of the blob
	ProxyBlob(ctx context.Context, p *proModels.Project, art lib.ArtifactInfo) (int64, io.ReadCloser, error)
	// ProxyManifest proxy the manifest request to the remote server, p is the proxy project,
	// art is the ArtifactInfo which includes the tag or digest of the manifest
	ProxyManifest(ctx context.Context, art lib.ArtifactInfo, remote RemoteInterface) (distribution.Manifest, error)
	// HeadManifest send manifest head request to the remote server
	HeadManifest(ctx context.Context, art lib.ArtifactInfo, remote RemoteInterface) (bool, *distribution.Descriptor, error)
	// EnsureTag ensure tag for digest
	EnsureTag(ctx context.Context, art lib.ArtifactInfo, tagName string) error
}

Controller defines the operations related with pull through proxy

func ControllerInstance

func ControllerInstance() Controller

ControllerInstance -- Get the proxy controller instance

type ManifestCache

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

ManifestCache default Manifest handler

func (*ManifestCache) CacheContent

func (m *ManifestCache) CacheContent(ctx context.Context, remoteRepo string, man distribution.Manifest, art lib.ArtifactInfo, r RemoteInterface, _ string)

CacheContent ...

type ManifestCacheHandler

type ManifestCacheHandler interface {
	// CacheContent - cache the content of the manifest
	CacheContent(ctx context.Context, remoteRepo string, man distribution.Manifest, art lib.ArtifactInfo, r RemoteInterface, contentType string)
}

ManifestCacheHandler define how to cache manifest content

type ManifestList

type ManifestList struct {
	Content     []byte
	Digest      string
	ContentType string
}

ManifestList ...

type ManifestListCache

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

ManifestListCache handle Manifest list type and index type

func (*ManifestListCache) CacheContent

func (m *ManifestListCache) CacheContent(ctx context.Context, _ string, man distribution.Manifest, art lib.ArtifactInfo, _ RemoteInterface, contentType string)

CacheContent ...

type Option

type Option func(*Options)

func WithSpeed

func WithSpeed(speed int32) Option

type Options

type Options struct {
	// Speed is the data transfer speed for proxy cache from Harbor to upstream registry, no limit by default.
	Speed int32
}

func NewOptions

func NewOptions(opts ...Option) *Options

type RemoteInterface

type RemoteInterface interface {
	// BlobReader create a reader for remote blob
	BlobReader(repo, dig string) (int64, io.ReadCloser, error)
	// Manifest get manifest by reference
	Manifest(repo string, ref string) (distribution.Manifest, string, error)
	// ManifestExist checks manifest exist, if exist, returns digest
	ManifestExist(repo string, ref string) (bool, *distribution.Descriptor, error)
	// ListTags returns all tags of the repo
	ListTags(repo string) ([]string, error)
	// ListReferrers returns all referrers
	ListReferrers(repo string, digest string, rawQuery string) (*ocispec.Index, map[string][]string, error)
}

RemoteInterface defines operations related to remote repository under proxy

func NewRemoteHelper

func NewRemoteHelper(ctx context.Context, regID int64, opts ...Option) (RemoteInterface, error)

NewRemoteHelper create a remote interface

Jump to

Keyboard shortcuts

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