Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddLicenseHooks ¶
func AddLicenseHooks()
AddLicenseHooks - adds the validation and cache clear hooks
func ClearLicenseCache ¶
func ClearLicenseCache() error
ClearLicenseCache - clears the cached validate response
func FetchApiServerKeys ¶
FetchApiServerKeys - fetches netmaker license keys for identification as well as secure communication with API if none present, it generates a new pair
func ValidateLicense ¶
func ValidateLicense() (err error)
ValidateLicense - the initial and periodic license check for netmaker server checks if a license is valid + limits are not exceeded if license is free_tier and limits exceeds, then function should error if license is not valid, function should error
Types ¶
type LicenseKey ¶
type LicenseKey struct {
LicenseValue string `json:"license_value"` // actual (public) key and the unique value for the key
Expiration int64 `json:"expiration" swaggertype:"primitive,integer" format:"int64"`
UsageServers int `json:"limit_servers"`
UsageUsers int `json:"limit_users"`
UsageClients int `json:"limit_clients"`
UsageHosts int `json:"limit_hosts"`
UsageNetworks int `json:"limit_networks"`
UsageIngresses int `json:"limit_ingresses"`
UsageEgresses int `json:"limit_egresses"`
Metadata string `json:"metadata"`
IsActive bool `json:"is_active"` // yes if active
}
LicenseKey - the license key struct representation with associated data
type LicenseSecret ¶
type LicenseSecret struct {
AssociatedID string `json:"associated_id" binding:"required"` // UUID for user foreign key to User table
Usage models.Usage `json:"limits" binding:"required"`
}
LicenseSecret - the encrypted struct for sending user-id
type ValidateLicenseRequest ¶
type ValidateLicenseRequest struct {
LicenseKey string `json:"license_key" binding:"required"`
NmServerPubKey string `json:"nm_server_pub_key" binding:"required"` // Netmaker server public key used to send data back to Netmaker for the Netmaker server to decrypt (eg output from validating license)
EncryptedPart string `json:"secret" binding:"required"`
NmBaseDomain string `json:"nm_base_domain"`
}
ValidateLicenseRequest - used for request to validate license endpoint
type ValidatedLicense ¶
type ValidatedLicense struct {
LicenseValue string `json:"license_value" binding:"required"` // license that validation is being requested for
EncryptedLicense string `json:"encrypted_license" binding:"required"` // to be decrypted by Netmaker using Netmaker server's private key
DeploymentMode string `json:"deployment_mode"`
FeatureFlags models.FeatureFlags `json:"feature_flags" binding:"required"`
}
ValidatedLicense - the validated license struct