Documentation ¶
Index ¶
- func Checksum(r io.Reader) (string, error)
- func ExpandTag(tag string) string
- func ParsePublicKey(key []byte) (pubKey *ecdsa.PublicKey, err error)
- func Tag(tag, goos, goarch string) string
- func UpdateFilename(tag string, versionIndex int) string
- type BundleInfo
- type ECDSASignature
- type Index
- type IndexVersion
- type IndexVersions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParsePublicKey ¶
ParsePublicKey parses a PEM encoded public key.
func UpdateFilename ¶
UpdateFilename returns the update filename for the specified tag and version.
Types ¶
type BundleInfo ¶
type BundleInfo struct { // Checksum of the new binary in the gup patch bundle. Checksum string // DecodedChecksum of the binary in the gup patch bundle. DecodedChecksum []byte // Signature is the ECDSA signature of the new binary in the gup patch // bundle. Signature ECDSASignature }
BundleInfo represents information about a gup patch bundle.
func Diff ¶
func Diff(key *ecdsa.PrivateKey, old, new io.Reader, patch io.Writer) (*BundleInfo, error)
Diff computes a diff between old and new and writes out a gup patch bundle to patch. The ECDSA binary signature for new is written into the gup patch bundle using the provided private key.
func Patch ¶
func Patch(pub *ecdsa.PublicKey, old io.Reader, new io.Writer, patch io.Reader) (*BundleInfo, error)
Patch applies the gup patch bundle, patch, to old, and writes the result to new. The provided public key is used to verify the ECDSA binary signature previously encoded into the gup patch bundle.
func (*BundleInfo) String ¶
func (b *BundleInfo) String() string
type ECDSASignature ¶
type Index ¶
type Index struct { // Tags is a map of all tags (or "release channels") to their respective // versions. Tags map[string]*IndexVersions }
Index represents a index.json file.
type IndexVersion ¶
type IndexVersion struct {
// From and To represent the SHA256 hash of the old (from) file and the new
// (to) file. For example, if a user's binary is currently SHA256="foo"
// then any version where From="foo" would be the next update for that
// user.
From, To string
// Replacement indicates that the version is a full binary replacement,
// i.e. not an incremental patch.
Replacement bool
}
IndexVersion represents a single version found in a index.json file.
The first version in a chain will always have an empty From value equal to the To value and will be a Replacement binary.
type IndexVersions ¶
type IndexVersions struct { // List is a list of all versions available, in order of most recent (index // zero) to oldest (last index). List []IndexVersion }
IndexVersions represents versions found in a index.json file for a specific tag.
func (IndexVersions) FindCurrentVersion ¶
func (v IndexVersions) FindCurrentVersion(x string) (*IndexVersion, int)
FindCurrentVersion finds the current version for x; i.e. the version whose To specifies x.
func (IndexVersions) FindNextVersion ¶
func (v IndexVersions) FindNextVersion(from string) (*IndexVersion, int)
FindNextVersion returns the next logical version to upgrade to when coming from the given SHA256. If nil is returned, there is no next version.