Documentation ¶
Overview ¶
Package keygen allows programs to license and remotely update themselves using the keygen.sh service.
Index ¶
- Constants
- Variables
- func VerifyWebhook(request *http.Request) error
- type Artifact
- type Client
- func (c *Client) Delete(path string, params interface{}, model interface{}) (*Response, error)
- func (c *Client) Get(path string, params interface{}, model interface{}) (*Response, error)
- func (c *Client) Patch(path string, params interface{}, model interface{}) (*Response, error)
- func (c *Client) Post(path string, params interface{}, model interface{}) (*Response, error)
- func (c *Client) Put(path string, params interface{}, model interface{}) (*Response, error)
- type Entitlement
- type EntitlementCode
- type Entitlements
- type Error
- type ErrorCode
- type HeartbeatStatusCode
- type LeveledLogger
- type License
- func (l *License) Activate(fingerprint string) (*Machine, error)
- func (l *License) Checkout() (*LicenseFile, error)
- func (l *License) Deactivate(id string) error
- func (l *License) Entitlements() (Entitlements, error)
- func (l *License) Machine(id string) (*Machine, error)
- func (l *License) Machines() (Machines, error)
- func (l *License) SetData(to func(target interface{}) error) error
- func (l *License) SetID(id string) error
- func (l *License) SetRelationships(relationships map[string]interface{}) error
- func (l *License) SetType(t string) error
- func (l *License) Validate(fingerprints ...string) error
- func (l *License) Verify() ([]byte, error)
- type LicenseFile
- func (lic *LicenseFile) Decrypt(key string) (*LicenseFileDataset, error)
- func (lic *LicenseFile) SetData(to func(target interface{}) error) error
- func (lic *LicenseFile) SetID(id string) error
- func (lic *LicenseFile) SetRelationships(relationships map[string]interface{}) error
- func (lic *LicenseFile) SetType(t string) error
- func (lic *LicenseFile) Verify() error
- type LicenseFileDataset
- type LicenseFileError
- type LicenseKeyError
- type LicenseTokenError
- type LogLevel
- type LoggerInterface
- type Machine
- func (m *Machine) Checkout() (*MachineFile, error)
- func (m *Machine) Deactivate() error
- func (m Machine) GetData() interface{}
- func (m Machine) GetID() string
- func (m Machine) GetType() string
- func (m *Machine) Monitor() error
- func (m *Machine) Processes() (Processes, error)
- func (m *Machine) SetData(to func(target interface{}) error) error
- func (m *Machine) SetID(id string) error
- func (m *Machine) SetType(t string) error
- func (m *Machine) Spawn(pid string) (*Process, error)
- type MachineFile
- func (lic *MachineFile) Decrypt(key string) (*MachineFileDataset, error)
- func (lic *MachineFile) SetData(to func(target interface{}) error) error
- func (lic *MachineFile) SetID(id string) error
- func (lic *MachineFile) SetRelationships(relationships map[string]interface{}) error
- func (lic *MachineFile) SetType(t string) error
- func (lic *MachineFile) Verify() error
- type MachineFileDataset
- type MachineFileError
- type Machines
- type NotAuthorizedError
- type NotFoundError
- type Process
- type ProcessStatusCode
- type Processes
- type RateLimitError
- type Release
- type Response
- type SchemeCode
- type UpgradeOptions
- type ValidationCode
Constants ¶
const (
// The current version of the SDK.
SDKVersion = "2.0.0-beta.5"
)
Variables ¶
var ( ErrReleaseLocationMissing = errors.New("release has no download URL") ErrUpgradeNotAvailable = errors.New("no upgrades available (already up-to-date)") ErrResponseSignatureMissing = errors.New("response signature is missing") ErrResponseSignatureInvalid = errors.New("response signature is invalid") ErrResponseDigestMissing = errors.New("response digest is missing") ErrResponseDigestInvalid = errors.New("response digest is invalid") ErrResponseDateMissing = errors.New("response date is missing") ErrResponseDateInvalid = errors.New("response date is invalid") ErrResponseDateTooOld = errors.New("response date is too old") ErrRequestSignatureMissing = errors.New("request signature is missing") ErrRequestSignatureInvalid = errors.New("request signature is invalid") ErrRequestDigestMissing = errors.New("request digest is missing") ErrRequestDigestInvalid = errors.New("request digest is invalid") ErrRequestDateMissing = errors.New("request date is missing") ErrRequestDateInvalid = errors.New("request date is invalid") ErrRequestDateTooOld = errors.New("request date is too old") ErrPublicKeyMissing = errors.New("public key is missing") ErrPublicKeyInvalid = errors.New("public key is invalid") ErrValidationFingerprintMissing = errors.New("validation fingerprint scope is missing") ErrValidationProductMissing = errors.New("validation product scope is missing") ErrHeartbeatPingFailed = errors.New("heartbeat ping failed") ErrHeartbeatRequired = errors.New("heartbeat is required") ErrHeartbeatDead = errors.New("heartbeat is dead") ErrMachineAlreadyActivated = errors.New("machine is already activated") ErrMachineLimitExceeded = errors.New("machine limit has been exceeded") ErrMachineNotFound = errors.New("machine no longer exists") ErrProcessNotFound = errors.New("process no longer exists") ErrMachineFileNotSupported = errors.New("machine file is not supported") ErrMachineFileNotEncrypted = errors.New("machine file is not encrypted") ErrMachineFileNotGenuine = errors.New("machine file is not genuine") ErrMachineFileExpired = errors.New("machine file is expired") ErrProcessLimitExceeded = errors.New("process limit has been exceeded") ErrLicenseSchemeNotSupported = errors.New("license scheme is not supported") ErrLicenseSchemeMissing = errors.New("license scheme is missing") ErrLicenseKeyMissing = errors.New("license key is missing") ErrLicenseKeyNotGenuine = errors.New("license key is not genuine") ErrLicenseNotActivated = errors.New("license is not activated") ErrLicenseExpired = errors.New("license is expired") ErrLicenseSuspended = errors.New("license is suspended") ErrLicenseTooManyMachines = errors.New("license has too many machines") ErrLicenseTooManyCores = errors.New("license has too many cores") ErrLicenseNotSigned = errors.New("license is not signed") ErrLicenseInvalid = errors.New("license is invalid") ErrLicenseFileNotSupported = errors.New("license file is not supported") ErrLicenseFileNotEncrypted = errors.New("license file is not encrypted") ErrLicenseFileNotGenuine = errors.New("license file is not genuine") ErrLicenseFileExpired = errors.New("license file is expired") ErrLicenseFileSecretMissing = errors.New("license file secret is missing") ErrSystemClockUnsynced = errors.New("system clock is out of sync") )
General errors
var ( // APIURL is the URL of the API service backend. APIURL = "https://api.keygen.sh" // APIVersion is the currently supported API version. APIVersion = "1.1" // Account is the Keygen account ID used globally in the binding. Account string // Product is the Keygen product ID used globally in the binding. Product string // LicenseKey is the end-user's license key used in the binding. LicenseKey string // Token is the end-user's API token used in the binding. Token string // PublicKey is the Keygen public key used for verifying license keys // and API response signatures. PublicKey string // UserAgent defines the user-agent string sent to the API backend, // uniquely identifying an integration. UserAgent string // Logger is a leveled logger implementation used for printing debug, // informational, warning, and error messages. Logger LoggerInterface = &LeveledLogger{Level: LogLevelError} // Program is the name of the current program, used when installing // upgrades. Defaults to the current program name. Program = filepath.Base(os.Args[0]) // MaxClockDrift is the maximum allowable difference between the // server time Keygen's API sent a request or response and the // current system time, to prevent replay attacks. MaxClockDrift = time.Duration(5) * time.Minute )
var ( // Ext is the release artifact filename extension used when installing // upgrades. By default, binaries do not have an extension. Ext = "" )
Functions ¶
func VerifyWebhook ¶
VerifyWebhook verifies the signature of a webhook request sent from Keygen. The webhook event should be considered invalid if an error is returned.
Example:
func main() { http.HandleFunc("/webhooks", func(w http.ResponseWriter, r *http.Request) { if err := keygen.VerifyWebhook(r); err != nil { w.WriteHeader(http.StatusBadRequest) return } w.WriteHeader(http.StatusNoContent) }) http.ListenAndServe(":8081", nil) }
Types ¶
type Artifact ¶
type Artifact struct { ID string `json:"-"` Type string `json:"-"` Filename string `json:"filename"` Filetype string `json:"filetype"` Filesize int64 `json:"filesize"` Platform string `json:"platform"` Arch string `json:"arch"` Signature string `json:"signature"` Checksum string `json:"checksum"` Created time.Time `json:"created"` Updated time.Time `json:"updated"` ReleaseId string `json:"-"` URL string `json:"-"` }
Artifact represents a Keygen artifact object.
func (*Artifact) SetRelationships ¶
SetRelationships implements the jsonapi.UnmarshalRelationship interface.
type Client ¶
type Client struct { Account string LicenseKey string Token string PublicKey string UserAgent string }
type Entitlement ¶
type Entitlement struct { ID string `json:"-"` Type string `json:"-"` Code EntitlementCode `json:"code"` Created time.Time `json:"created"` Updated time.Time `json:"updated"` Metadata map[string]interface{} `json:"metadata"` }
Entitlement represents a Keygen entitlement object.
func (*Entitlement) SetData ¶
func (e *Entitlement) SetData(to func(target interface{}) error) error
SetData implements the jsonapi.UnmarshalData interface.
func (*Entitlement) SetID ¶
func (e *Entitlement) SetID(id string) error
SetID implements the jsonapi.UnmarshalResourceIdentifier interface.
func (*Entitlement) SetType ¶
func (e *Entitlement) SetType(t string) error
SetType implements the jsonapi.UnmarshalResourceIdentifier interface.
type EntitlementCode ¶
type EntitlementCode string
type Entitlements ¶
type Entitlements []Entitlement
Entitlements represents an array of entitlement objects.
func (*Entitlements) SetData ¶
func (e *Entitlements) SetData(to func(target interface{}) error) error
SetData implements the jsonapi.UnmarshalData interface.
type ErrorCode ¶
type ErrorCode string
ErrorCode defines various error codes that are handled explicitly.
const ( ErrorCodeTokenInvalid ErrorCode = "TOKEN_INVALID" ErrorCodeLicenseInvalid ErrorCode = "LICENSE_INVALID" ErrorCodeFingerprintTaken ErrorCode = "FINGERPRINT_TAKEN" ErrorCodeMachineLimitExceeded ErrorCode = "MACHINE_LIMIT_EXCEEDED" ErrorCodeProcessLimitExceeded ErrorCode = "MACHINE_PROCESS_LIMIT_EXCEEDED" ErrorCodeMachineHeartbeatDead ErrorCode = "MACHINE_HEARTBEAT_DEAD" ErrorCodeProcessHeartbeatDead ErrorCode = "PROCESS_HEARTBEAT_DEAD" ErrorCodeNotFound ErrorCode = "NOT_FOUND" )
type HeartbeatStatusCode ¶
type HeartbeatStatusCode string
const ( HeartbeatStatusCodeNotStarted HeartbeatStatusCode = "NOT_STARTED" HeartbeatStatusCodeAlive HeartbeatStatusCode = "ALIVE" HeartbeatStatusCodeDead HeartbeatStatusCode = "DEAD" HeartbeatStatusCodeResurrected HeartbeatStatusCode = "RESURRECTED" )
type LeveledLogger ¶
type LeveledLogger struct {
Level LogLevel
}
func (*LeveledLogger) Debugf ¶
func (l *LeveledLogger) Debugf(format string, v ...interface{})
func (*LeveledLogger) Errorf ¶
func (l *LeveledLogger) Errorf(format string, v ...interface{})
func (*LeveledLogger) Infof ¶
func (l *LeveledLogger) Infof(format string, v ...interface{})
func (*LeveledLogger) Warnf ¶
func (l *LeveledLogger) Warnf(format string, v ...interface{})
type License ¶
type License struct { ID string `json:"-"` Type string `json:"-"` Name string `json:"name"` Key string `json:"key"` Expiry *time.Time `json:"expiry"` Scheme SchemeCode `json:"scheme"` RequireHeartbeat bool `json:"requireHeartbeat"` LastValidated *time.Time `json:"lastValidated"` Created time.Time `json:"created"` Updated time.Time `json:"updated"` Metadata map[string]interface{} `json:"metadata"` PolicyId string `json:"-"` }
License represents a Keygen license object.
func Validate ¶
Validate performs a license validation using the current Token, scoped to any provided fingerprints. It returns a License, and an error if the license is invalid, e.g. ErrLicenseNotActivated or ErrLicenseExpired.
func (*License) Activate ¶
Activate performs a machine activation for the license, identified by the provided fingerprint. If the activation is successful, the new machine will be returned. An error will be returned if the activation fails, e.g. ErrMachineLimitExceeded or ErrMachineAlreadyActivated.
func (*License) Checkout ¶
func (l *License) Checkout() (*LicenseFile, error)
Checkout generates an encrypted license file. Returns a LicenseFile.
func (*License) Deactivate ¶
Deactivate performs a machine deactivation, identified by the provided ID. The ID can be the machine's UUID or the machine's fingerprint. An error will be returned if the machine deactivation fails.
func (*License) Entitlements ¶
func (l *License) Entitlements() (Entitlements, error)
Machines lists up to 100 entitlements for the license.
func (*License) Machine ¶
Machine retreives a machine, identified by the provided ID. The ID can be the machine's UUID or the machine's fingerprint. An error will be returned if it does not exist.
func (*License) SetRelationships ¶
SetRelationships implements the jsonapi.UnmarshalRelationship interface.
func (*License) Validate ¶
Validate performs a license validation, scoped to any provided fingerprints. It returns an error if the license is invalid, e.g. ErrLicenseNotActivated, ErrLicenseExpired or ErrLicenseTooManyMachines.
func (*License) Verify ¶
Verify checks if the license's key is genuine by cryptographically verifying the key using your PublicKey. If the license is genuine, the decoded dataset from the key will be returned. An error will be returned if the license is not genuine, or if the key is not signed, e.g. ErrLicenseNotGenuine or ErrLicenseNotSigned.
type LicenseFile ¶
type LicenseFile struct { ID string `json:"-"` Type string `json:"-"` Certificate string `json:"certificate"` Issued time.Time `json:"issued"` Expiry time.Time `json:"expiry"` TTL int `json:"ttl"` LicenseID string `json:"-"` }
LicenseFile represents a Keygen license file.
func (*LicenseFile) Decrypt ¶
func (lic *LicenseFile) Decrypt(key string) (*LicenseFileDataset, error)
Decrypt decrypts the license file's encrypted dataset. It returns the decrypted dataset and any errors that occurred during decryption, e.g. ErrLicenseFileNotEncrypted.
func (*LicenseFile) SetData ¶
func (lic *LicenseFile) SetData(to func(target interface{}) error) error
SetData implements the jsonapi.UnmarshalData interface.
func (*LicenseFile) SetID ¶
func (lic *LicenseFile) SetID(id string) error
SetID implements the jsonapi.UnmarshalResourceIdentifier interface.
func (*LicenseFile) SetRelationships ¶
func (lic *LicenseFile) SetRelationships(relationships map[string]interface{}) error
SetRelationships implements the jsonapi.UnmarshalRelationship interface.
func (*LicenseFile) SetType ¶
func (lic *LicenseFile) SetType(t string) error
SetType implements the jsonapi.UnmarshalResourceIdentifier interface.
func (*LicenseFile) Verify ¶
func (lic *LicenseFile) Verify() error
Decrypt verifies the license file's signature. It returns any errors that occurred during verification, e.g. ErrLicenseFileInvalid.
type LicenseFileDataset ¶
type LicenseFileDataset struct { License License `json:"-"` Entitlements Entitlements `json:"-"` Issued time.Time `json:"issued"` Expiry time.Time `json:"expiry"` TTL int `json:"ttl"` }
LicenseFileDataset represents a decrypted license file object.
func (*LicenseFileDataset) SetData ¶
func (lic *LicenseFileDataset) SetData(to func(target interface{}) error) error
SetData implements the jsonapi.UnmarshalData interface.
func (*LicenseFileDataset) SetIncluded ¶
func (lic *LicenseFileDataset) SetIncluded(relationships []*jsonapi.ResourceObject, unmarshal func(res *jsonapi.ResourceObject, target interface{}) error) error
SetIncluded implements jsonapi.UnmarshalIncluded interface.
func (*LicenseFileDataset) SetMeta ¶
func (lic *LicenseFileDataset) SetMeta(to func(target interface{}) error) error
SetMeta implements jsonapi.UnmarshalMeta interface.
type LicenseFileError ¶
type LicenseFileError struct{ Err error }
LicenseFileError represents an invalid license file error.
func (*LicenseFileError) Error ¶
func (e *LicenseFileError) Error() string
func (*LicenseFileError) Unwrap ¶
func (e *LicenseFileError) Unwrap() error
type LicenseKeyError ¶
type LicenseKeyError struct{ Err *Error }
LicenseKeyError represents an API authentication error due to an invalid license key.
func (*LicenseKeyError) Error ¶
func (e *LicenseKeyError) Error() string
func (*LicenseKeyError) Unwrap ¶
func (e *LicenseKeyError) Unwrap() error
type LicenseTokenError ¶
type LicenseTokenError struct{ Err *Error }
LicenseTokenError represents an API authentication error due to an invalid license token.
func (*LicenseTokenError) Error ¶
func (e *LicenseTokenError) Error() string
func (*LicenseTokenError) Unwrap ¶
func (e *LicenseTokenError) Unwrap() error
type LoggerInterface ¶
type LoggerInterface interface { // Debugf logs a debug message using Printf conventions. Debugf(format string, v ...interface{}) // Errorf logs a warning message using Printf conventions. Errorf(format string, v ...interface{}) // Infof logs an informational message using Printf conventions. Infof(format string, v ...interface{}) // Warnf logs a warning message using Printf conventions. Warnf(format string, v ...interface{}) }
LoggerInterface provides a basic leveled logging interface for printing debug, informational, warning, and error messages.
type Machine ¶
type Machine struct { ID string `json:"-"` Type string `json:"-"` Name string `json:"name"` Fingerprint string `json:"fingerprint"` Hostname string `json:"hostname"` Platform string `json:"platform"` Cores int `json:"cores"` RequireHeartbeat bool `json:"requireHeartbeat"` HeartbeatStatus HeartbeatStatusCode `json:"heartbeatStatus"` HeartbeatDuration int `json:"heartbeatDuration"` Created time.Time `json:"created"` Updated time.Time `json:"updated"` Metadata map[string]interface{} `json:"metadata"` LicenseID string `json:"-"` }
Machine represents a Keygen machine object.
func (*Machine) Checkout ¶
func (m *Machine) Checkout() (*MachineFile, error)
Checkout generates an encrypted machine file. Returns a MachineFile.
func (*Machine) Deactivate ¶
Deactivate performs a machine deactivation for the current Machine. An error will be returned if the machine deactivation fails.
func (Machine) GetData ¶
func (m Machine) GetData() interface{}
GetData implements the jsonapi.MarshalData interface.
func (*Machine) Monitor ¶
Monitor performs, on a loop, a machine hearbeat ping for the current Machine. An error channel will be returned, where any ping errors will be emitted. Pings are sent according to the machine's required heartbeat window, minus 30 seconds to account for any network lag. Panics if a heartbeat ping fails after first ping.
func (*Machine) Spawn ¶
Spawn creates a new process for a machine, identified by the provided pid. If successful, the new Process will be returned. When unsuccessful, as error will be returned, e.g. ErrProcessLimitExceeded. Automatically starts a loop that sends heartbeat pings according to the process's Interval. Panics if a heartbeat ping fails after first ping.
type MachineFile ¶
type MachineFile struct { ID string `json:"-"` Type string `json:"-"` Certificate string `json:"certificate"` Issued time.Time `json:"issued"` Expiry time.Time `json:"expiry"` TTL int `json:"ttl"` MachineID string `json:"-"` LicenseID string `json:"-"` }
MachineFile represents a Keygen license file.
func (*MachineFile) Decrypt ¶
func (lic *MachineFile) Decrypt(key string) (*MachineFileDataset, error)
Decrypt decrypts the machine file's encrypted dataset. It returns the decrypted dataset and any errors that occurred during decryption, e.g. ErrMachineFileNotEncrypted.
func (*MachineFile) SetData ¶
func (lic *MachineFile) SetData(to func(target interface{}) error) error
SetData implements the jsonapi.UnmarshalData interface.
func (*MachineFile) SetID ¶
func (lic *MachineFile) SetID(id string) error
SetID implements the jsonapi.UnmarshalResourceIdentifier interface.
func (*MachineFile) SetRelationships ¶
func (lic *MachineFile) SetRelationships(relationships map[string]interface{}) error
SetRelationships implements the jsonapi.UnmarshalRelationship interface.
func (*MachineFile) SetType ¶
func (lic *MachineFile) SetType(t string) error
SetType implements the jsonapi.UnmarshalResourceIdentifier interface.
func (*MachineFile) Verify ¶
func (lic *MachineFile) Verify() error
Decrypt verifies the machine file's signature. It returns any errors that occurred during verification, e.g. ErrMachineFileInvalid.
type MachineFileDataset ¶
type MachineFileDataset struct { Machine Machine `json:"-"` License License `json:"-"` Entitlements Entitlements `json:"-"` Issued time.Time `json:"issued"` Expiry time.Time `json:"expiry"` TTL int `json:"ttl"` }
MachineFileDataset represents a decrypted machine file object.
func (*MachineFileDataset) SetData ¶
func (lic *MachineFileDataset) SetData(to func(target interface{}) error) error
SetData implements the jsonapi.UnmarshalData interface.
func (*MachineFileDataset) SetIncluded ¶
func (lic *MachineFileDataset) SetIncluded(relationships []*jsonapi.ResourceObject, unmarshal func(res *jsonapi.ResourceObject, target interface{}) error) error
SetIncluded implements jsonapi.UnmarshalIncluded interface.
func (*MachineFileDataset) SetMeta ¶
func (lic *MachineFileDataset) SetMeta(to func(target interface{}) error) error
SetMeta implements jsonapi.UnmarshalMeta interface.
type MachineFileError ¶
type MachineFileError struct{ Err error }
MachineFileError represents an invalid machine file error.
func (*MachineFileError) Error ¶
func (e *MachineFileError) Error() string
func (*MachineFileError) Unwrap ¶
func (e *MachineFileError) Unwrap() error
type NotAuthorizedError ¶
type NotAuthorizedError struct{ Err *Error }
NotAuthorizedError represents an API permission error.
func (*NotAuthorizedError) Error ¶
func (e *NotAuthorizedError) Error() string
func (*NotAuthorizedError) Unwrap ¶
func (e *NotAuthorizedError) Unwrap() error
type NotFoundError ¶
type NotFoundError struct{ Err *Error }
NotFoundError represents an API not found error.
func (*NotFoundError) Error ¶
func (e *NotFoundError) Error() string
func (*NotFoundError) Unwrap ¶
func (e *NotFoundError) Unwrap() error
type Process ¶
type Process struct { ID string `json:"-"` Type string `json:"-"` Pid string `json:"pid"` Status ProcessStatusCode `json:"status"` Interval int `json:"interval"` Created time.Time `json:"created"` Updated time.Time `json:"updated"` Metadata map[string]interface{} `json:"metadata"` MachineID string `json:"-"` }
Process represents a Keygen process object.
func (Process) GetData ¶
func (p Process) GetData() interface{}
GetData implements the jsonapi.MarshalData interface.
func (*Process) Kill ¶
Kill deletes the current Process. An error will be returned if the process deletion fails.
type ProcessStatusCode ¶
type ProcessStatusCode string
const ( ProcessStatusCodeAlive ProcessStatusCode = "ALIVE" ProcessStatusCodeDead ProcessStatusCode = "DEAD" )
type RateLimitError ¶
type RateLimitError struct { Window string Count int Limit int Remaining int Reset time.Time RetryAfter int Err error }
RateLimitError represents an API rate limiting error.
func (*RateLimitError) Error ¶
func (e *RateLimitError) Error() string
func (*RateLimitError) Unwrap ¶
func (e *RateLimitError) Unwrap() error
type Release ¶
type Release struct { ID string `json:"-"` Type string `json:"-"` Name string `json:"name"` Description string `json:"description"` Version string `json:"version"` Channel string `json:"channel"` Created time.Time `json:"created"` Updated time.Time `json:"updated"` Metadata map[string]interface{} `json:"metadata"` // contains filtered or unexported fields }
Release represents a Keygen release object.
func Upgrade ¶
func Upgrade(options UpgradeOptions) (*Release, error)
Upgrade checks if an upgrade is available for the provided version. Returns a Release and any errors that occurred, e.g. ErrUpgradeNotAvailable.
type UpgradeOptions ¶
type UpgradeOptions struct { // CurrentVersion is the current version of the program. This will be used by // Keygen to determine if an upgrade is available. CurrentVersion string // Constraint is a version constraint to use when checking for upgrades. For // example, to pin upgrades to v1, you would pass a "1.0" constraint. Constraint string // Channel is the release channel. One of: stable, rc, beta, alpha or dev. Channel string // PublicKey is your personal Ed25519ph public key, generated using Keygen's CLI // or using ssh-keygen. This will be used to verify the release's signature // before install. This MUST NOT be your Keygen account's public key. PublicKey string // Filename is the template string used when retrieving an artifact during // install. This should compile to a valid artifact identifier, e.g. a // filename for the current platform and arch. // // The default template is below: // // {{.program}}_{{.platform}}_{{.arch}}{{if .ext}}.{{.ext}}{{end}} // // Available template variables: // // program // the name of the currently running program (i.e. basename of os.Args[0]) // ext // the extension based on current platform (i.e. exe on Windows) // platform // the current platform (i.e. GOOS) // arch // the current architecture (i.e. GOARCH) // channel // the release channel (e.g. stable) // version // the release version (e.g. 1.0.0-beta.3) // // If more control is needed, provide a string. Filename string }
type ValidationCode ¶
type ValidationCode string
const ( ValidationCodeValid ValidationCode = "VALID" ValidationCodeNotFound ValidationCode = "NOT_FOUND" ValidationCodeSuspended ValidationCode = "SUSPENDED" ValidationCodeExpired ValidationCode = "EXPIRED" ValidationCodeOverdue ValidationCode = "OVERDUE" ValidationCodeNoMachine ValidationCode = "NO_MACHINE" ValidationCodeNoMachines ValidationCode = "NO_MACHINES" ValidationCodeTooManyMachines ValidationCode = "TOO_MANY_MACHINES" ValidationCodeTooManyCores ValidationCode = "TOO_MANY_CORES" ValidationCodeFingerprintScopeRequired ValidationCode = "FINGERPRINT_SCOPE_REQUIRED" ValidationCodeFingerprintScopeMismatch ValidationCode = "FINGERPRINT_SCOPE_MISMATCH" ValidationCodeFingerprintScopeEmpty ValidationCode = "FINGERPRINT_SCOPE_EMPTY" ValidationCodeHeartbeatNotStarted ValidationCode = "HEARTBEAT_NOT_STARTED" ValidationCodeHeartbeatDead ValidationCode = "HEARTBEAT_DEAD" ValidationCodeProductScopeRequired ValidationCode = "PRODUCT_SCOPE_REQUIRED" ValidationCodeProductScopeEmpty ValidationCode = "PRODUCT_SCOPE_MISMATCH" ValidationCodePolicyScopeRequired ValidationCode = "POLICY_SCOPE_REQUIRED" ValidationCodePolicyScopeMismatch ValidationCode = "POLICY_SCOPE_MISMATCH" ValidationCodeMachineScopeRequired ValidationCode = "MACHINE_SCOPE_REQUIRED" ValidationCodeMachineScopeMismatch ValidationCode = "MACHINE_SCOPE_MISMATCH" ValidationCodeEntitlementsMissing ValidationCode = "ENTITLEMENTS_MISSING" ValidationCodeEntitlementsEmpty ValidationCode = "ENTITLEMENTS_SCOPE_EMPTY" )