Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( errors.New("provider not available") // ErrFileNotFound is a generic error when a file is not found ErrFileNotFound = errors.New("file not found") // ErrNotOpenned is a generic error when a provider have been called while it is not openned ErrNotOpenned = errors.New("provider have not been openned") )ErrProviderUnavailable =
Functions ¶
func GetLatestVersionFromPath ¶
GetLatestVersionFromPath finds the latest version from a path This is used by provider zip and gzip Example: /example/binaries-v1.4.53.zip is going to match "v1.4.53"
func GlobNewestFile ¶
GlobNewestFile same as filepath.Glob but returns only one file with the latest modification time
Types ¶
type AccessProvider ¶
type AccessProvider interface { GetLatestVersion() (string, error) // Get the latest version (Should be accessible even if Open() was not called) Walk(walkFn WalkFunc) error Retrieve(srcPath string, destPath string) error }
AccessProvider describes the access methods of a Provider This methods shouldn't change the state of the provider
type BitBucket ¶
type BitBucket struct { RepositoryURL string // The URL of the BitBucket repository, e.g. bitbucket.org/BenTomsett/go-rocket-update-example ArchiveName string // The name of the archive file uploaded to BitBucket Downloads, e.g. project-v0.0.1.tar.gz // contains filtered or unexported fields }
BitBucket provider finds an archive file in the repository's downloads to provide updated binaries As BitBucket does not have a releases feature, we use the downloads feature instead.
func (*BitBucket) GetLatestVersion ¶
type Github ¶
type Github struct { RepositoryURL string // Repository URL, example github.com/mouuff/go-rocket-update ArchiveName string // Archive name (the zip/tar.gz you upload for a release on github), example: binaries.zip // contains filtered or unexported fields }
Github provider finds a archive file in the repository's releases to provide files
func (*Github) GetLatestVersion ¶
GetLatestVersion gets the latest version
type Gitlab ¶
type Gitlab struct { ProjectID int ArchiveName string // ArchiveName (the archive you upload for a release on gitlab), example: binaries.zip // contains filtered or unexported fields }
Gitlab provider finds a archive file in the repository's releases to provide files
func (*Gitlab) GetLatestVersion ¶
GetLatestVersion gets the latest version
type Gzip ¶
type Gzip struct { Path string // Path of the Gzip file (provider.GlobNewestFile might help) // contains filtered or unexported fields }
Gzip provider
func (*Gzip) GetLatestVersion ¶
GetLatestVersion gets the latest version
type Local ¶
type Local struct { Path string // Path of the folder // contains filtered or unexported fields }
A Local provider use a local directory to provide files This provider is mainly here for mocking and testing but it could be used on a shared network folder
func (*Local) GetLatestVersion ¶
GetLatestVersion gets the latest version
type Provider ¶
type Provider interface { AccessProvider Open() error Close() error }
A Provider describes an interface for providing files
func Decompress ¶
Decompress gets a provider to decompress zip or tar.gz files
type Secure ¶
type Secure struct { BackendProvider Provider PublicKeyPEM []byte PublicKey *rsa.PublicKey // contains filtered or unexported fields }
Secure is a provider which uses another provider and verifies the signatures when Retrieve() is called If you pass a nil PublicKey, then it will try to load the PublicKeyPEM. PublicKeyPEM must be a public key in the PEM format
func (*Secure) GetLatestVersion ¶
GetLatestVersion gets the latest version
type WalkFunc ¶
WalkFunc is the type of the function called for each file or directory visited by Walk. path is relative
type Zip ¶
type Zip struct { Path string // Path of the zip file (provider.GlobNewestFile might help) // contains filtered or unexported fields }
Zip provider
func (*Zip) GetLatestVersion ¶
GetLatestVersion gets the latest version