ociref

package
v0.0.0-...-eedc705 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Overview

Package ociref supports parsing cross-registry OCI registry references.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsValidHost

func IsValidHost(s string) bool

IsValidHost reports whether s is a valid host (or host:port) part of a reference string.

func IsValidRepository

func IsValidRepository(s string) bool

IsValidHost reports whether s is a valid repository part of a reference string.

func IsValidTag

func IsValidTag(s string) bool

IsValidTag reports whether s is a valid reference tag.

Types

type Reference

type Reference struct {
	// Host holds the host name of the registry
	// within which the repository is stored, optionally in
	// the form host:port. This might be empty.
	Host string

	// Repository holds the repository name.
	Repository string

	// Tag holds the TAG part of a :TAG or :TAG@DIGEST reference.
	// When Digest is set as well as Tag, the tag will be verified
	// to exist and have the expected digest.
	Tag string

	// Digest holds the DIGEST part of an @DIGEST reference
	// or of a :TAG@DIGEST reference.
	Digest ociregistry.Digest
}

Reference represents an entry in an OCI repository.

func Parse

func Parse(refStr string) (Reference, error)

Parse parses a reference string that must include a host name (or host:port pair) component.

It is represented in string form as HOST[:PORT]/NAME[:TAG|@DIGEST] form: the same syntax accepted by "docker pull". Unlike "docker pull" however, there is no default registry: when presented with a bare repository name, Parse will return an error.

func ParseRelative

func ParseRelative(refStr string) (Reference, error)

ParseRelative parses a reference string that may or may not include a host name component.

It is represented in string form as [HOST[:PORT]/]NAME[:TAG|@DIGEST] form: the same syntax accepted by "docker pull". Unlike "docker pull" however, there is no default registry: when presented with a bare repository name, the Host field will be empty.

func (Reference) String

func (ref Reference) String() string

String returns the string form of a reference in the form

[HOST/]NAME[:TAG|@DIGEST]

Jump to

Keyboard shortcuts

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