Documentation
¶
Index ¶
- Constants
- func GenerateSigningKeypair(password []byte) (encryptedAndEncodedPrivateKey string, encodedPublicKey string, err error)
- func Verify(base64PublicKey string, input VerifyInput) (err error)
- func VerifyMany(base64PublicKey string, input []VerifyInput) (err error)
- type ChannelManifest
- type Config
- type CreateReleaseInput
- type Release
- type ReleaseFile
- type ReleaseManifest
- type SignInput
- type Updater
- func (updater *Updater) CheckUpdate(ctx context.Context) (manifest ChannelManifest, err error)
- func (updater *Updater) RestartRequired() bool
- func (updater *Updater) RunInBackground(ctx context.Context)
- func (updater *Updater) Update(ctx context.Context, channelManifest ChannelManifest) (err error)
- func (updater *Updater) UpdateAvailable(manifest ChannelManifest) bool
- type VerifyInput
Constants ¶
View Source
const ( SaltSize = crypto.KeySize256 ReleaseManifestFilename = "release.json" DefaultUserAgent = "Mozilla/5.0 (compatible; +autoupdate)" )
Variables ¶
This section is empty.
Functions ¶
func GenerateSigningKeypair ¶
func Verify ¶
func Verify(base64PublicKey string, input VerifyInput) (err error)
func VerifyMany ¶
func VerifyMany(base64PublicKey string, input []VerifyInput) (err error)
Types ¶
type ChannelManifest ¶
type ChannelManifest struct {
Name string `json:"name"`
Channel string `json:"channel"`
Version string `json:"version"`
}
func (ChannelManifest) ToJson ¶
func (manifest ChannelManifest) ToJson() (manifestJSON []byte, err error)
type Config ¶
type Config struct {
PublicKey string
// BaseURL is the URL of the folder containing the manifest
// e.g. https://downloads.example.com/myapp
BaseURL string
CurrentVersion string
ReleaseChannel string
// Interval to check for updates. default: 1800 seconds
Interval int64
// Verbose logs actions with the INFO level
Verbose bool
UserAgent *string
HttpClient *http.Client
}
type CreateReleaseInput ¶
type CreateReleaseInput struct {
// Name of the project. e.g. myapp
Name string
// Version of the release of the project. e.g. 1.1.52
Version string
Channel string
Files []string
// PrivateKeyPrivateKey is the base64 encoded privateKey, encrypted with password
PrivateKey string
PrivateKeyPassword string
}
type Release ¶
type Release struct {
Name string
ChannelManifest ChannelManifest
ReleaseManifest ReleaseManifest
}
func CreateRelease ¶
func CreateRelease(ctx context.Context, info CreateReleaseInput) (release Release, err error)
type ReleaseFile ¶
type ReleaseFile struct {
Filename string `json:"file"`
Sha256 byteshex.Bytes `json:"sha256"`
Signature []byte `json:"signature"`
}
type ReleaseManifest ¶
type ReleaseManifest struct {
Name string `json:"name"`
Version string `json:"version"`
Files []ReleaseFile `json:"files"`
}
func (ReleaseManifest) ToJson ¶
func (manifest ReleaseManifest) ToJson() (manifestJSON []byte, err error)
type Updater ¶
type Updater struct {
Updated chan struct{}
// contains filtered or unexported fields
}
func NewUpdater ¶
func (*Updater) CheckUpdate ¶
func (updater *Updater) CheckUpdate(ctx context.Context) (manifest ChannelManifest, err error)
func (*Updater) RestartRequired ¶
func (*Updater) RunInBackground ¶
func (*Updater) Update ¶
func (updater *Updater) Update(ctx context.Context, channelManifest ChannelManifest) (err error)
func (*Updater) UpdateAvailable ¶
func (updater *Updater) UpdateAvailable(manifest ChannelManifest) bool
UpdateAvailable returns true if the latest avaiable version is > to the latest install version
Click to show internal directories.
Click to hide internal directories.