tuf

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TufFileNameAnnotation = "tuf.io/filename"
)

Variables

Functions

func NewMockTufClient

func NewMockTufClient(srcPath string, dstPath string) *mockTufClient

Types

type ImageCache

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

func NewImageCache

func NewImageCache() *ImageCache

func (*ImageCache) Get

func (c *ImageCache) Get(imgRef string) ([]byte, bool)

Get image from cache

func (*ImageCache) Put

func (c *ImageCache) Put(imgRef string, img []byte)

Add image to cache

type Layer

type Layer struct {
	Annotations map[string]string `json:"annotations"`
	Digest      string            `json:"digest"`
}

type Layers

type Layers struct {
	Layers    []Layer `json:"layers"`
	Manifests []Layer `json:"manifests"`
	MediaType string  `json:"mediaType"`
}

type RegistryFetcher

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

RegistryFetcher implements Fetcher

func NewRegistryFetcher

func NewRegistryFetcher(metadataRepo, metadataTag, targetsRepo string) *RegistryFetcher

func (*RegistryFetcher) DownloadFile

func (d *RegistryFetcher) DownloadFile(urlPath string, maxLength int64, timeout time.Duration) ([]byte, error)

DownloadFile downloads a file from an OCI registry, errors out if it failed, its length is larger than maxLength or the timeout is reached.

type TUFClient

type TUFClient interface {
	DownloadTarget(target, filePath string) (actualFilePath string, data []byte, err error)
}

type TufClient

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

func NewTufClient

func NewTufClient(initialRoot []byte, tufPath, metadataSource, targetsSource string) (*TufClient, error)

NewTufClient creates a new TUF client

func (*TufClient) DownloadTarget

func (t *TufClient) DownloadTarget(target string, filePath string) (actualFilePath string, data []byte, err error)

DownloadTarget downloads the target file using Updater. The Updater gets the target information, verifies if the target is already cached, and if it is not cached, downloads the target file.

func (*TufClient) GetMetadata

func (t *TufClient) GetMetadata() trustedmetadata.TrustedMetadata

func (*TufClient) GetPriorRoots

func (t *TufClient) GetPriorRoots(metadataURL string) (map[string][]byte, error)

func (*TufClient) LoadDelegatedTargets

func (t *TufClient) LoadDelegatedTargets(roleName, parentName string) (*metadata.Metadata[metadata.TargetsType], error)

Derived from updater.loadTargets() in theupdateframework/go-tuf

func (*TufClient) MaxRootLength

func (t *TufClient) MaxRootLength() int64

func (*TufClient) SetRemoteTargetsURL

func (t *TufClient) SetRemoteTargetsURL(url string)

type TufRole

type TufRole string

type TufSource

type TufSource string
const (
	HttpSource TufSource = "http"
	OciSource  TufSource = "oci"
)

Jump to

Keyboard shortcuts

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