util

package
v0.0.0-...-dc266b9 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const DigestPrefix = "sha256:"
View Source
const FormatDigest = "%s@%s"
View Source
const FormatName = "%s:%s"

Variables

This section is empty.

Functions

func CompareSHA1

func CompareSHA1(a, b []byte) bool

func CompileRegex

func CompileRegex(v string, lineMatch bool) (*regexp.Regexp, error)

func ComputeSHA1

func ComputeSHA1(file string) ([]byte, error)

func DecodeJSONAuth

func DecodeJSONAuth(authBase64 string) string

func HasDigest

func HasDigest(tag string) bool

HasDigest returns true if tag HAS or IS a digest

func HasName

func HasName(tag string) bool

HasName returns true if tag HAS or IS a name

func IsDigest

func IsDigest(d string) bool

IsDigest returns true if d is a digest string. For performance reasons, this currently only checks for the presence of the `sha256:` prefix, and does not run a regex against d for full compliance check. This way, incorrect digests lead to errors, but correct digests do not incur a computational overhead.

func JoinRefAndTag

func JoinRefAndTag(ref, tag string) string

JoinRefAndTag joins ref with tag, inserting the correct separator ':' or '@', depending on whether tag contains a name part or is purely a digest.

func JoinRefsAndTag

func JoinRefsAndTag(srcRef, trgtRef, tag string) (src, trgt string)

JoinRefsAndTag joins the source and target ref for a sync action each with tag, according to these rules:

  • If tag contains a digest, srcRef is joined with only the digest as tag, and trgtRef with either only the name part of tag (if present), or the digest.

- Otherwise, srcRef and trgtRef are joined with tag.

This ensures that if a digest is present, we always use that when pulling an image, but still use the name if present when pushing.

func JoinTag

func JoinTag(name, digest string) string

func SplitPlatform

func SplitPlatform(p string) (os, arch, variant string)

func SplitRef

func SplitRef(ref string) (reg, repo, tag string)

func SplitTag

func SplitTag(tag string) (name, digest string)

Types

type Regex

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

func NewRegex

func NewRegex(r string) (*Regex, error)

func (*Regex) Matches

func (r *Regex) Matches(s string) bool

Jump to

Keyboard shortcuts

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