Documentation
¶
Overview ¶
Package release provides helpers to download and verify binaries released on GitHub.
The downloader knows how to construct a release download URL, fetch the tarball, validate its checksum and extract the contained name to a destination path.
Index ¶
- type BinaryProvider
- type GithubReleaseBinaryLocator
- type GithubReleaseCachePather
- type GithubReleaseChecksummer
- type GithubReleaseChecksummerFactory
- type GithubReleaseDownloader
- type GithubReleaseDownloaderOption
- func WithBinaryLocator(l GithubReleaseBinaryLocator) GithubReleaseDownloaderOption
- func WithCachePather(c GithubReleaseCachePather) GithubReleaseDownloaderOption
- func WithChecksummerFactory(c GithubReleaseChecksummerFactory) GithubReleaseDownloaderOption
- func WithLogger(l *log.Logger) GithubReleaseDownloaderOption
- func WithMaxDownloadSize(size int64) GithubReleaseDownloaderOption
- func WithOSGetter(c GithubReleaseOSGetter) GithubReleaseDownloaderOption
- func WithProgressor(p ioutil.Progressor) GithubReleaseDownloaderOption
- func WithURLGetter(c GithubReleaseURLGetter) GithubReleaseDownloaderOption
- type GithubReleaseOSGetter
- type GithubReleaseURLGetter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BinaryProvider ¶
BinaryProvider is a small abstraction around downloading a specific name for a given version. Implementations should return the path of the downloaded name on success.
type GithubReleaseBinaryLocator ¶
type GithubReleaseBinaryLocator func(releaseDir string, name string, version string, os string, arch string) (string, error)
func NewDefaultBinaryLocator ¶
func NewDefaultBinaryLocator() GithubReleaseBinaryLocator
func NewOPStackBinaryLocator ¶
func NewOPStackBinaryLocator() GithubReleaseBinaryLocator
type GithubReleaseCachePather ¶
func NewHomeDirCachePather ¶
func NewHomeDirCachePather(namespace string) GithubReleaseCachePather
type GithubReleaseChecksummer ¶
GithubReleaseChecksummer reads the downloaded archive data and validates its checksum. It should return an error if the checksum does not match.
func NewDefaultChecksummer ¶
func NewDefaultChecksummer(expectedChecksum string) GithubReleaseChecksummer
type GithubReleaseChecksummerFactory ¶
type GithubReleaseChecksummerFactory func(os string, arch string) (GithubReleaseChecksummer, error)
GithubReleaseChecksummerFactory returns a GithubReleaseChecksummer for a specific OS/architecture pair. This allows providing precomputed checksums for different release artifacts.
func NewStaticChecksummerFactory ¶
func NewStaticChecksummerFactory(checksums map[string]string) GithubReleaseChecksummerFactory
type GithubReleaseDownloader ¶
type GithubReleaseDownloader struct {
// contains filtered or unexported fields
}
func NewGithubReleaseDownloader ¶
func NewGithubReleaseDownloader(owner string, repo string, name string, opts ...GithubReleaseDownloaderOption) *GithubReleaseDownloader
type GithubReleaseDownloaderOption ¶
type GithubReleaseDownloaderOption func(*GithubReleaseDownloader)
func WithBinaryLocator ¶
func WithBinaryLocator(l GithubReleaseBinaryLocator) GithubReleaseDownloaderOption
func WithCachePather ¶
func WithCachePather(c GithubReleaseCachePather) GithubReleaseDownloaderOption
func WithChecksummerFactory ¶
func WithChecksummerFactory(c GithubReleaseChecksummerFactory) GithubReleaseDownloaderOption
func WithLogger ¶
func WithLogger(l *log.Logger) GithubReleaseDownloaderOption
func WithMaxDownloadSize ¶
func WithMaxDownloadSize(size int64) GithubReleaseDownloaderOption
func WithOSGetter ¶
func WithOSGetter(c GithubReleaseOSGetter) GithubReleaseDownloaderOption
func WithProgressor ¶
func WithProgressor(p ioutil.Progressor) GithubReleaseDownloaderOption
func WithURLGetter ¶
func WithURLGetter(c GithubReleaseURLGetter) GithubReleaseDownloaderOption
type GithubReleaseOSGetter ¶
GithubReleaseOSGetter returns the OS and architecture string used to select the appropriate release artifact (e.g. "linux", "amd64"). The function may inspect the runtime or be overridden for testing.
func NewDefaultOSGetter ¶
func NewDefaultOSGetter() GithubReleaseOSGetter
type GithubReleaseURLGetter ¶
type GithubReleaseURLGetter func(owner string, repo string, name string, version string, os string, arch string) (string, error)
GithubReleaseURLGetter constructs the download URL for a given owner/repo and version for the provided os/arch pair.
func NewDefaultURLGetter ¶
func NewDefaultURLGetter() GithubReleaseURLGetter
func NewOPStackURLGetter ¶
func NewOPStackURLGetter() GithubReleaseURLGetter