Documentation ¶
Index ¶
Constants ¶
const HMACKeyForLimitsEncryption = "HMACKeyForLimitsEncryption"
HMACKeyForLimitsEncryption
const PublicKeyBase64 = "" /* 132-byte string literal not displayed */
the public key b64 encoded from the private key using: lkgen pub my_private_key_file`.
const TestLicense = "" /* 544-byte string literal not displayed */
TestLicense used in unit tests
Variables ¶
var ErrOverLimit = errors.New("limit is over")
ErrOverLimit contains error for over limit
var TotalLimitDuration = "864000h"
TotalLimitDuration is a time duration to be used for total time range in a string representation 864000h is equal to 100 years
Functions ¶
func Initialize ¶
Initialize extracts license from the bytes provided to LD variable and stores it inside the db
Types ¶
type LicenseData ¶
type LicenseData struct { // Name represents the name license assigned to Name string `json:"n"` // Email represents email address of the license owner Email string `json:"e"` // End represents the date when license ends End time.Time `json:"end"` // Limits represents limits assigned to the license Limits []*ratelimiter.Limit `json:"l"` // MaxDirectoryWatchers represents maximum allowed directories to watch with watch and sign service MaxDirectoryWatchers int `json:"d"` // RL contains rate limiter RL *ratelimiter.RateLimiter `json:"-"` // contains filtered or unexported fields }
LicenseData represents all the license related data
var LD LicenseData
LD stores all the license related data
func (*LicenseData) Info ¶
func (ld *LicenseData) Info() string
Info returns formatted information about the license
func (*LicenseData) SaveLimitState ¶
func (ld *LicenseData) SaveLimitState() error
SaveLimitState saves the limit state to the db
func (*LicenseData) Wait ¶
func (ld *LicenseData) Wait() error
Wait validates license end data and limits, if one of the limits are reached, waits the time till the work is allowed again
Directories ¶
Path | Synopsis |
---|---|
Package ratelimiter implements rate limiting functionality.
|
Package ratelimiter implements rate limiting functionality. |