checksum

package
v3.1.7 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2024 License: Apache-2.0 Imports: 13 Imported by: 3

Documentation

Overview

Package checksum implements methods for obtaining and verifying the checksum of binary files.

Index

Constants

This section is empty.

Variables

View Source
var (
	// FileSha256 is a hash table the storage the checksum of the binary files. It is parsed from 'version/components.json'.
	FileSha256 = map[string]map[string]map[string]string{}
)

Functions

This section is empty.

Types

type Checksums

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

Checksums is a list of checksums.

func NewChecksums

func NewChecksums(checksums ...Interface) *Checksums

NewChecksums returns a new Checksums.

func (*Checksums) Append

func (c *Checksums) Append(checksums ...Interface)

Append appends checksums.

func (*Checksums) Get

func (c *Checksums) Get() error

Get gets the checksums. It will iterate through the Get() of the []Interface array and store the first fetched value.

func (*Checksums) Value

func (c *Checksums) Value() string

Value returns the checksums.

type HTTPChecksum

type HTTPChecksum struct {
	FileName string
	// contains filtered or unexported fields
}

HTTPChecksum is a checksum that is downloaded from a URL.

func NewHTTPChecksum

func NewHTTPChecksum(url *url.URL, isoName string, fs rootfs.Interface) *HTTPChecksum

NewHTTPChecksum returns a new HTTPChecksum.

func (*HTTPChecksum) Get

func (h *HTTPChecksum) Get() error

Get downloads the checksum file and parses it.

func (*HTTPChecksum) SetHost

func (h *HTTPChecksum) SetHost(host string)

SetHost sets the host of the URL.

func (*HTTPChecksum) SetPath

func (h *HTTPChecksum) SetPath(pathStr string)

SetPath sets the URL path of the binary.

func (*HTTPChecksum) Value

func (h *HTTPChecksum) Value() string

Value returns the checksum value.

type Interface

type Interface interface {
	Get() error
	Value() string
}

Interface is the interface for checksum.

type InternalChecksum

type InternalChecksum struct {
	ID      string
	Version string
	Arch    string
	// contains filtered or unexported fields
}

InternalChecksum is the internal checksum implementation.

func NewInternalChecksum

func NewInternalChecksum(id, version, arch string) *InternalChecksum

NewInternalChecksum returns a new internal checksum implementation given the binary information.

func (*InternalChecksum) Get

func (i *InternalChecksum) Get() error

Get gets the internal checksum.

func (*InternalChecksum) Value

func (i *InternalChecksum) Value() string

Value returns the internal checksum value.

type List

type List interface {
	Interface
	Append(checksum ...Interface)
}

List is the interface of a list of checksums.

type StringChecksum

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

StringChecksum is a simple checksum implementation for given strings.

func NewStringChecksum

func NewStringChecksum(value string) *StringChecksum

NewStringChecksum returns a new StringChecksum for the given string.

func (*StringChecksum) Get

func (s *StringChecksum) Get() error

Get the StringChecksum Get() method will do nothing.

func (*StringChecksum) Value

func (s *StringChecksum) Value() string

Value returns the value of the StringChecksum.

Jump to

Keyboard shortcuts

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