registry

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2025 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsInsecureRegistry added in v1.2.0

func IsInsecureRegistry(target string, insecureList []string) bool

IsInsecureRegistry returns true when the target registry should be accessed over plain HTTP. It compares the normalized registry host (without scheme or trailing slashes) against the configured insecure registry list.

Types

type AuthProvider

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

AuthProvider manages authentication for registries

func NewAuthProvider

func NewAuthProvider() *AuthProvider

NewAuthProvider creates a new authentication provider

func (*AuthProvider) AddCredential

func (a *AuthProvider) AddCredential(registry, username, password string)

AddCredential adds a credential for a registry

func (*AuthProvider) GetCredentials

func (a *AuthProvider) GetCredentials(registry string) (*Credentials, error)

GetCredentials returns credentials for a specific registry

func (*AuthProvider) LoadCredentials

func (a *AuthProvider) LoadCredentials(creds []Credentials)

LoadCredentials loads credentials from DS configuration

func (*AuthProvider) LoadDockerConfig

func (a *AuthProvider) LoadDockerConfig() error

LoadDockerConfig loads credentials from the default Docker config path.

func (*AuthProvider) LoadDockerConfigFrom added in v1.3.1

func (a *AuthProvider) LoadDockerConfigFrom(path string) error

LoadDockerConfigFrom loads Docker credentials from the provided config path. When path is empty, the default ~/.docker/config.json is used.

func (*AuthProvider) RefreshToken

func (a *AuthProvider) RefreshToken(ctx context.Context, registry string) error

RefreshToken refreshes an expired token (placeholder for future implementation)

type Client

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

Client represents an OCI registry client

func NewClient

func NewClient(registry string, authProvider *AuthProvider, opts ...ClientOption) (*Client, error)

NewClient creates a new OCI registry client

func (*Client) CopyDescriptor added in v1.2.0

func (c *Client) CopyDescriptor(ctx context.Context, reference string, desc ocispec.Descriptor, dest io.Writer) error

CopyDescriptor streams descriptor content into the provided writer.

func (*Client) FetchDescriptor added in v1.2.0

func (c *Client) FetchDescriptor(ctx context.Context, reference string, desc ocispec.Descriptor) ([]byte, error)

FetchDescriptor retrieves raw content for the provided descriptor referenced by the given base reference.

func (*Client) GetManifest

func (c *Client) GetManifest(ctx context.Context, reference string) ([]byte, ocispec.Descriptor, error)

GetManifest fetches the manifest for an artifact

func (*Client) List

func (c *Client) List(ctx context.Context, repository string) ([]string, error)

List returns available versions/tags for a repository

func (*Client) Pull

func (c *Client) Pull(ctx context.Context, reference string, dest io.Writer) error

Pull downloads an OCI artifact from the registry

func (*Client) Push

func (c *Client) Push(ctx context.Context, reference string, content io.Reader, contentType string) error

Push uploads an OCI artifact to the registry

type ClientOption

type ClientOption func(*Client)

ClientOption is a functional option for configuring the client

func WithHTTPClient

func WithHTTPClient(client *http.Client) ClientOption

WithHTTPClient sets a custom HTTP client

func WithInsecure

func WithInsecure(insecure bool) ClientOption

WithInsecure enables insecure (HTTP) registry connections

func WithProxy

func WithProxy(proxyURL string) ClientOption

WithProxy configures proxy settings

type Credentials

type Credentials struct {
	Registry string
	Username string
	Password string
	Token    string
}

Credentials represents registry credentials

type DockerAuth

type DockerAuth struct {
	Auth          string `json:"auth,omitempty"`
	Username      string `json:"username,omitempty"`
	Password      string `json:"password,omitempty"`
	IdentityToken string `json:"identitytoken,omitempty"`
}

DockerAuth represents authentication for a registry

type DockerConfig

type DockerConfig struct {
	Auths map[string]DockerAuth `json:"auths"`
}

DockerConfig represents the Docker config.json structure

Jump to

Keyboard shortcuts

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