binary

package
v0.0.0-...-88d6d00 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2024 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// URL of cloud-team binary index.
	IndexGZURL  = "https://cloud-downloads.arduino.cc/binaries/index.json.gz"
	IndexSigURL = "https://cloud-downloads.arduino.cc/binaries/index.json.sig"
)

Variables

This section is empty.

Functions

func Download

func Download(ctx context.Context, bin *IndexBin) ([]byte, error)

Download a binary file contained in the binary index.

func VerifyChecksum

func VerifyChecksum(checksum string, file io.Reader) error

VerifyChecksum has been extracted from github.com/arduino/arduino-fwupload : https://github.com/arduino/arduino-fwuploader/blob/fc20a808ece9a082e043e13e3cfa69c571721d76/indexes/download/download.go

We're not using arduino-fwuploader directly as a dependency because it indirectly depends on github.com/daaku/go.zipexe which panics during an 'init' function, causing cloud-cli to panic when compiled with go1.19. More on the issue here: https://github.com/golang/go/issues/54227 .

Types

type Index

type Index struct {
	Boards []IndexBoard `json:"boards"`
}

Index contains details about all the binaries loaded in 'cloud-downloads'.

func LoadIndex

func LoadIndex(ctx context.Context) (*Index, error)

LoadIndex downloads and verifies the index of binaries contained in 'cloud-downloads'.

func (*Index) FindProvisionBin

func (i *Index) FindProvisionBin(fqbn string) *IndexBin

FindProvisionBin looks for the provisioning binary corresponding to the passed fqbn in the index. Returns nil if the binary is not found.

type IndexBin

type IndexBin struct {
	URL      string      `json:"url"`
	Checksum string      `json:"checksum"`
	Size     json.Number `json:"size"`
}

IndexBin contains the details needed to retrieve a binary file from the cloud.

type IndexBoard

type IndexBoard struct {
	FQBN      string    `json:"fqbn"`
	Provision *IndexBin `json:"provision"`
}

IndexBoard describes all the binaries available for a specific board.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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