services

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2024 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

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

Auth is a service for authentication it breaks into 2 "modes" - allowed and trusted allowed mode is for "read" requests (GET, HEAD, OPTIONS) trusted mode is for "write" requests (PATCH, POST, PUT, DELETE)

func NewAuth

func NewAuth(allowedIPs, allowedUAs, trustedIPs []string, cacheTTL, cacheSize int, provider *AuthProvider) *Auth

NewAuth creates a new Auth service

func (*Auth) Middleware

func (a *Auth) Middleware() echo.MiddlewareFunc

Middleware returns a middleware for echo

type AuthProvider added in v1.1.0

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

AuthProvider is an interface for authorization providers

func NewAuthProvider added in v1.1.0

func NewAuthProvider(url, login, password string) *AuthProvider

NewAuthProvider creates a new AuthProvider

func (*AuthProvider) IsAllowed added in v1.1.0

func (a *AuthProvider) IsAllowed(ctx context.Context, ip string) (bool, error)

IsAuthorized checks if the IP is allowed

type Cache

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

Cache is a middleware that caches responses according to the Docker Registry API v2 specification, cacheable endpoints and status codes.

func NewCache

func NewCache(ttl, size int) *Cache

NewCache returns a new Cache instance.

func (*Cache) Middleware

func (cache *Cache) Middleware() echo.MiddlewareFunc

Middleware returns a new echo.MiddlewareFunc that caches responses according to the Docker Registry API v2 specification, cacheable endpoints and status codes.

Jump to

Keyboard shortcuts

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