lexfloatclient

package module
v0.0.0-...-d927052 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 15, 2024 License: MIT Imports: 2 Imported by: 0

README

Build package

lexfloatclient-go

Cryptlex lets you license your software apps effortlessly. You can easily generate license keys using the REST API or Dashboard and validate the license keys in your software apps using LexFloatClient (Cryptlex client library).

Additionally, you can offer trials, subscriptions, floating licenses and much more.

lexfloatclient-go is a Go wrapper for LexFloatClient licensing library.

Installation

go get -u github.com/cryptlex/lexfloatclient-go

Note: In case you are using Windows, execute the following command after installation:

xcopy %USERPROFILE%\go\src\github.com\cryptlex\lexfloatclient-go\libs\windows_amd64\LexFloatClient.dll

Then you can include it in your code:

import "github.com/cryptlex/lexfloatclient-go"

Usage

Refer to following for documentation:

https://docs.cryptlex.com/floating-licenses/on-premise-floating-licenses/using-lexfloatclient/using-lexfloatclient-with-go

Documentation

Index

Constants

View Source
const (
	LA_USER      uint = 0
	LA_SYSTEM    uint = 1
	LA_IN_MEMORY uint = 2
)
View Source
const (
	// Success code.
	LF_OK int = 0

	// Failure code.
	LF_FAIL int = 1

	// The product id is incorrect.
	LF_E_PRODUCT_ID int = 40

	// Invalid or missing callback function.
	LF_E_CALLBACK int = 41

	// Missing or invalid server url.
	LF_E_HOST_URL int = 42

	// Ensure system date and time settings are correct.
	LF_E_TIME int = 43

	// Failed to connect to the server due to network error.
	LF_E_INET int = 44

	// License has not been leased yet.
	LF_E_NO_LICENSE int = 45

	// License has already been leased.
	LF_E_LICENSE_EXISTS int = 46

	// License does not exist on server or has already expired. This
	// happens when the request to refresh the license is delayed.
	LF_E_LICENSE_NOT_FOUND int = 47

	// License lease has expired due to network error. This
	// happens when the request to refresh the license fails due to
	// network error.
	LF_E_LICENSE_EXPIRED_INET int = 48

	// The server has reached it's allowed limit of floating licenses.
	LF_E_LICENSE_LIMIT_REACHED int = 49

	// The buffer size was smaller than required.
	LF_E_BUFFER_SIZE int = 50

	// The metadata key does not exist.
	LF_E_METADATA_KEY_NOT_FOUND int = 51

	// Metadata key length is more than 256 characters.
	LF_E_METADATA_KEY_LENGTH int = 52

	// Metadata value length is more than 4096 characters.
	LF_E_METADATA_VALUE_LENGTH int = 53

	// The floating client has reached it's metadata fields limit.
	LF_E_FLOATING_CLIENT_METADATA_LIMIT int = 54

	// The meter attribute does not exist.
	LF_E_METER_ATTRIBUTE_NOT_FOUND int = 55

	// The meter attribute has reached it's usage limit.
	LF_E_METER_ATTRIBUTE_USES_LIMIT_REACHED int = 56

	// No product version is linked with the license.
	LF_E_PRODUCT_VERSION_NOT_LINKED int = 57

	// The product version feature flag does not exist.
	LF_E_FEATURE_FLAG_NOT_FOUND int = 58

	// IP address is not allowed.
	LF_E_IP int = 60

	// Client error.
	LF_E_CLIENT int = 70

	// Server error.
	LF_E_SERVER int = 71

	// System time on server has been tampered with. Ensure
	// your date and time settings are correct on the server machine.
	LF_E_SERVER_TIME_MODIFIED int = 72

	// The server has not been activated using a license key.
	LF_E_SERVER_LICENSE_NOT_ACTIVATED int = 73

	// The server license has expired.
	LF_E_SERVER_LICENSE_EXPIRED int = 74

	// The server license has been suspended.
	LF_E_SERVER_LICENSE_SUSPENDED int = 75

	// The grace period for server license is over.
	LF_E_SERVER_LICENSE_GRACE_PERIOD_OVER int = 76
)

int enumeration from lexfloatclient/int.h int =4

Variables

This section is empty.

Functions

func DecrementFloatingClientMeterAttributeUses

func DecrementFloatingClientMeterAttributeUses(name string, decrement uint) int

FUNCTION: DecrementFloatingClientMeterAttributeUses()

PURPOSE: Decrements the meter attribute uses of the floating client.

PARAMETERS: * name - name of the meter attribute * decrement - the decrement value

RETURN CODES: LF_OK, LF_E_PRODUCT_ID, LF_E_NO_LICENSE, LF_E_HOST_URL, LF_E_METER_ATTRIBUTE_NOT_FOUND, LF_E_INET, LF_E_LICENSE_NOT_FOUND, LF_E_CLIENT, LF_E_IP, LF_E_SERVER, LF_E_SERVER_LICENSE_NOT_ACTIVATED, LF_E_SERVER_TIME_MODIFIED, LF_E_SERVER_LICENSE_SUSPENDED, LF_E_SERVER_LICENSE_GRACE_PERIOD_OVER, LF_E_SERVER_LICENSE_EXPIRED

NOTE: If the decrement is more than the current uses, it resets the uses to 0.

func DropFloatingLicense

func DropFloatingLicense() int

FUNCTION: DropFloatingLicense()

PURPOSE: Sends the request to the LexFloatServer to free the license.

Call this function before you exit your application to prevent zombie licenses.

RETURN CODES: LF_OK, LF_E_PRODUCT_ID, LF_E_NO_LICENSE, LF_E_HOST_URL, LF_E_CALLBACK, LF_E_INET, LF_E_LICENSE_NOT_FOUND, LF_E_CLIENT, LF_E_IP, LF_E_SERVER, LF_E_SERVER_LICENSE_NOT_ACTIVATED, LF_E_SERVER_TIME_MODIFIED, LF_E_SERVER_LICENSE_SUSPENDED, LF_E_SERVER_LICENSE_GRACE_PERIOD_OVER, LF_E_SERVER_LICENSE_EXPIRED

func GetFloatingClientLibraryVersion

func GetFloatingClientLibraryVersion(libraryVersion *string) int

FUNCTION: GetFloatingClientLibraryVersion()

PURPOSE: Gets the version of this library.

PARAMETERS: * libraryVersion - pointer to a buffer that receives the value of the string * length - size of the buffer pointed to by the libraryVersion parameter

RETURN CODES: LF_OK, LF_E_BUFFER_SIZE

func GetFloatingClientMeterAttributeUses

func GetFloatingClientMeterAttributeUses(name string, uses *uint) int

FUNCTION: GetFloatingClientMeterAttributeUses()

PURPOSE: Gets the meter attribute uses consumed by the floating client.

PARAMETERS: * name - name of the meter attribute * uses - pointer to the integer that receives the value

RETURN CODES: LF_OK, LF_E_PRODUCT_ID, LF_E_NO_LICENSE, LF_E_METER_ATTRIBUTE_NOT_FOUND

func GetHostLicenseExpiryDate

func GetHostLicenseExpiryDate(expiryDate *uint) int

FUNCTION: GetHostLicenseExpiryDate()

PURPOSE: Gets the license expiry date timestamp of the LexFloatServer license.

PARAMETERS: * expiryDate - pointer to the integer that receives the value

RETURN CODES: LF_OK, LF_E_PRODUCT_ID, LF_E_NO_LICENSE

func GetHostLicenseMetadata

func GetHostLicenseMetadata(key string, value *string) int

FUNCTION: GetHostLicenseMetadata()

PURPOSE: Get the value of the license metadata field associated with the LexFloatServer license.

PARAMETERS: * key - key of the metadata field whose value you want to get * value - pointer to a buffer that receives the value of the string * length - size of the buffer pointed to by the value parameter

RETURN CODES: LF_OK, LF_E_PRODUCT_ID, LF_E_NO_LICENSE, LF_E_BUFFER_SIZE, LF_E_METADATA_KEY_NOT_FOUND

func GetHostLicenseMeterAttribute

func GetHostLicenseMeterAttribute(name string, allowedUses *uint, totalUses *uint, grossUses *uint) int

FUNCTION: GetHostLicenseMeterAttribute()

PURPOSE: Gets the license meter attribute allowed uses and total uses associated with the LexFloatServer license.

PARAMETERS: * name - name of the meter attribute * allowedUses - pointer to the integer that receives the value * totalUses - pointer to the integer that receives the value * grossUses - pointer to the integer that receives the value

RETURN CODES: LF_OK, LF_E_PRODUCT_ID, LF_E_NO_LICENSE, LF_E_METER_ATTRIBUTE_NOT_FOUND

func GetHostProductVersionDisplayName

func GetHostProductVersionDisplayName(displayName *string) int

FUNCTION: GetHostProductVersionDisplayName()

PURPOSE: Gets the product version display name.

PARAMETERS: * displayName - pointer to a buffer that receives the value of the string * length - size of the buffer pointed to by the displayName parameter

RETURN CODES: LF_OK, LF_E_PRODUCT_ID, LF_E_NO_LICENSE, LF_E_PRODUCT_VERSION_NOT_LINKED, LF_E_BUFFER_SIZE

func GetHostProductVersionFeatureFlag

func GetHostProductVersionFeatureFlag(name string, enabled *bool, data *string) int

FUNCTION: GetHostProductVersionFeatureFlag()

PURPOSE: Gets the product version feature flag.

PARAMETERS: * name - name of the feature flag * enabled - pointer to the integer that receives the value - 0 or 1 * data - pointer to a buffer that receives the value of the string * length - size of the buffer pointed to by the data parameter

RETURN CODES: LF_OK, LF_E_PRODUCT_ID, LF_E_PRODUCT_VERSION_NOT_LINKED, LF_E_FEATURE_FLAG_NOT_FOUND, LF_E_BUFFER_SIZE

func GetHostProductVersionName

func GetHostProductVersionName(name *string) int

FUNCTION: GetHostProductVersionName()

PURPOSE: Gets the product version name.

PARAMETERS: * name - pointer to a buffer that receives the value of the string * length - size of the buffer pointed to by the name parameter

RETURN CODES: LF_OK, LF_E_PRODUCT_ID, LF_E_NO_LICENSE, LF_E_PRODUCT_VERSION_NOT_LINKED, LF_E_BUFFER_SIZE

func HasFloatingLicense

func HasFloatingLicense() int

FUNCTION: HasFloatingLicense()

PURPOSE: Checks whether any license has been leased or not. If yes, it retuns LF_OK.

RETURN CODES: LF_OK, LF_E_PRODUCT_ID, LF_E_NO_LICENSE

func IncrementFloatingClientMeterAttributeUses

func IncrementFloatingClientMeterAttributeUses(name string, increment uint) int

FUNCTION: IncrementFloatingClientMeterAttributeUses()

PURPOSE: Increments the meter attribute uses of the floating client.

PARAMETERS: * name - name of the meter attribute * increment - the increment value

RETURN CODES: LF_OK, LF_E_PRODUCT_ID, LF_E_NO_LICENSE, LF_E_HOST_URL, LF_E_METER_ATTRIBUTE_NOT_FOUND, LF_E_INET, LF_E_LICENSE_NOT_FOUND, LF_E_CLIENT, LF_E_IP, LF_E_SERVER, LF_E_METER_ATTRIBUTE_USES_LIMIT_REACHED, LF_E_SERVER_LICENSE_NOT_ACTIVATED, LF_E_SERVER_TIME_MODIFIED, LF_E_SERVER_LICENSE_SUSPENDED, LF_E_SERVER_LICENSE_GRACE_PERIOD_OVER, LF_E_SERVER_LICENSE_EXPIRED

func RequestFloatingLicense

func RequestFloatingLicense() int

FUNCTION: RequestFloatingLicense()

PURPOSE: Sends the request to lease the license from the LexFloatServer.

RETURN CODES: LF_OK, LF_FAIL, LF_E_PRODUCT_ID, LF_E_LICENSE_EXISTS, LF_E_HOST_URL, LF_E_CALLBACK, LF_E_LICENSE_LIMIT_REACHED, LF_E_INET, LF_E_TIME, LF_E_CLIENT, LF_E_IP, LF_E_SERVER, LF_E_SERVER_LICENSE_NOT_ACTIVATED, LF_E_SERVER_TIME_MODIFIED, LF_E_SERVER_LICENSE_SUSPENDED, LF_E_SERVER_LICENSE_GRACE_PERIOD_OVER, LF_E_SERVER_LICENSE_EXPIRED

func ResetFloatingClientMeterAttributeUses

func ResetFloatingClientMeterAttributeUses(name string) int

FUNCTION: ResetFloatingClientMeterAttributeUses()

PURPOSE: Resets the meter attribute uses consumed by the floating client.

PARAMETERS: * name - name of the meter attribute

RETURN CODES: LF_OK, LF_E_PRODUCT_ID, LF_E_NO_LICENSE, LF_E_HOST_URL, LF_E_METER_ATTRIBUTE_NOT_FOUND, LF_E_INET, LF_E_LICENSE_NOT_FOUND, LF_E_CLIENT, LF_E_IP, LF_E_SERVER, LF_E_SERVER_LICENSE_NOT_ACTIVATED, LF_E_SERVER_TIME_MODIFIED, LF_E_SERVER_LICENSE_SUSPENDED, LF_E_SERVER_LICENSE_GRACE_PERIOD_OVER, LF_E_SERVER_LICENSE_EXPIRED

func SetFloatingClientMetadata

func SetFloatingClientMetadata(key string, value string) int

FUNCTION: SetFloatingClientMetadata()

PURPOSE: Sets the floating client metadata.

The metadata appears along with the license details of the license in LexFloatServer dashboard.

PARAMETERS: * key - string of maximum length 256 characters with utf-8 encoding. * value - string of maximum length 4096 characters with utf-8 encoding.

RETURN CODES: LF_OK, LF_E_PRODUCT_ID, LF_E_METADATA_KEY_LENGTH, LF_E_METADATA_VALUE_LENGTH, LF_E_ACTIVATION_METADATA_LIMIT

func SetFloatingLicenseCallback

func SetFloatingLicenseCallback(callbackFunction func(int)) int

FUNCTION: SetFloatingLicenseCallback()

PURPOSE: Sets the renew license callback function.

Whenever the license lease is about to expire, a renew request is sent to the server. When the request completes, the license callback function gets invoked with one of the following status codes:

LF_OK, LF_E_INET, LF_E_LICENSE_EXPIRED_INET, LF_E_LICENSE_NOT_FOUND, LF_E_CLIENT, LF_E_IP, LF_E_SERVER, LF_E_TIME, LF_E_SERVER_LICENSE_NOT_ACTIVATED,LF_E_SERVER_TIME_MODIFIED, LF_E_SERVER_LICENSE_SUSPENDED, LF_E_SERVER_LICENSE_EXPIRED, LF_E_SERVER_LICENSE_GRACE_PERIOD_OVER

PARAMETERS: * callback - name of the callback function

RETURN CODES: LF_OK, LF_E_PRODUCT_ID

func SetHostProductId

func SetHostProductId(productId string) int

FUNCTION: SetHostProductId()

PURPOSE: Sets the product id of your application.

PARAMETERS:

  • productId - the unique product id of your application as mentioned on the product page in the dashboard.

RETURN CODES: LF_OK, LF_E_PRODUCT_ID

func SetHostUrl

func SetHostUrl(hostUrl string) int

FUNCTION: SetHostUrl()

PURPOSE: Sets the network address of the LexFloatServer.

The url format should be: http://[ip or hostname]:[port]

PARAMETERS: * hostUrl - url string having the correct format

RETURN CODES: LF_OK, LF_E_PRODUCT_ID, LF_E_HOST_URL

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL