program

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2023 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Archive

type Archive struct {
	Name string
	Data []byte
	// contains filtered or unexported fields
}

func (*Archive) BinaryChecksum

func (a *Archive) BinaryChecksum(binaryName string) ([]byte, error)

BinaryChecksum retrieves checksum value of binary in archive. Returned value is base64-encoded []byte. TODO: maybe we should just return string(checksumSHA256(binary))?

func (*Archive) Extract

func (a *Archive) Extract(binaryName string) ([]byte, error)

Extract returns the binary data from archive with checksum guarantee. That is, if checksum fails, then the binary will not be returned.

type ArchiveChecksum

type ArchiveChecksum struct {
	Archive string `json:"archive"`
	Binary  string `json:"binary"`
}

type Base

type Base struct {
	Overlay map[string]map[string]string `json:"overlay,omitempty"`
	Name    string                       `json:"name"`
	Version string                       `json:"version"`
}

Base is a minimal structure which exists in every program variations

func (*Base) Vars

func (b *Base) Vars(goOS, goArch string) map[string]string

Vars returns a map of variables to be used in templates, with overlays applied.

type ChecksumCalculator

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

ChecksumCalculator calculates checksum by passing in data through io.Writer

func (*ChecksumCalculator) Error

func (c *ChecksumCalculator) Error(expect []byte) error

Error compares the Base64 encoded checksum

func (*ChecksumCalculator) SHA256

func (c *ChecksumCalculator) SHA256(dst io.Writer) io.Writer

SHA256 takes in io.Writer and returns a io.Writer which writes to the original io.Writer as well as the hash calculator

type ChecksumPaths added in v0.0.3

type ChecksumPaths struct {
	Artifact    string `json:"artifact"`
	Certificate string `json:"certificate,omitempty"`
	Signature   string `json:"signature,omitempty"`
}

type Config

type Config struct {
	Base

	Paths     *RemotePath       `json:"paths"`
	Checksums map[string]string `json:"checksums"`
	Provider  string            `json:"provider"`
}

Config is a program declaration in configuration file (default: bindl.yaml)

func (*Config) Lock

func (c *Config) Lock(ctx context.Context, platforms map[string][]string, useCache bool) (*Lock, error)

Lock converts current configuration to Lock, which is the format used by lockfile.

type CosignBundle added in v0.0.3

type CosignBundle struct {
	Artifact    string `json:"artifact"`
	Certificate string `json:"certificate"`
	Signature   string `json:"signature"`
}

func (*CosignBundle) Signed added in v0.0.3

func (c *CosignBundle) Signed() bool

func (*CosignBundle) VerifySignature added in v0.0.3

func (c *CosignBundle) VerifySignature(ctx context.Context) error

type Lock

type Lock struct {
	Base

	Checksums map[string]*ArchiveChecksum `json:"checksums,omitempty"`
	Paths     *RemotePath                 `json:"paths"`
	Cosign    []*CosignBundle             `json:"cosign,omitempty"`
}

Lock is a configuration used by lockfile to explicitly state the expected validations of each program.

func NewLock

func NewLock(ctx context.Context, c *Config, platforms map[string][]string, useCache bool) (*Lock, error)

func (*Lock) ArchiveName

func (p *Lock) ArchiveName(os, arch string) (string, error)

ArchiveName returns the archive name with OS and Arch interpolated if necessary, i.e. someprogram-linux-amd64.tar.gz. This reads from URL and assumes that contains the archive name.

func (*Lock) DownloadArchive

func (p *Lock) DownloadArchive(ctx context.Context, d download.Downloader, goOS, goArch string) (*Archive, error)

DownloadArchive returns Archive which has the archive data in-memory, with guarantees on archive checksum. That is, if checksum fails, no data will be made available to caller.

func (*Lock) URL

func (p *Lock) URL(goOS, goArch string) (string, error)

URL returns the download URL with variables interpolated as necessary.

type RemotePath added in v0.0.3

type RemotePath struct {
	Base   string `json:"base"`
	Target string `json:"target"`

	Checksums *ChecksumPaths `json:"checksums,omitempty"`

	Cosign []*CosignBundle `json:"-"`
	// contains filtered or unexported fields
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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