Documentation
¶
Index ¶
- func AnonymizeKey(key string) string
- func ConvertTimeToInterval(timeToWait time.Duration) string
- func CronJobStarter(ctx context.Context, handler func(), timeToCall time.Duration)
- func GenerateKey() string
- func GetAllPerformanceIntervals() []string
- func NewKeyCounter() *keyCounter
- func NewKeysQueue(keys ...string) *keysQueue
- func ProcessUserDetails(userDetails *UsersDetails)
- type AccessKeyDetails
- type AccountInfo
- type AccountType
- type Claims
- type CreateAddressResponse
- type CryptoPaymentConfig
- type FileLoggingHandler
- type UsersDetails
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AnonymizeKey ¶
AnonymizeKey will anonymize the provided key
func ConvertTimeToInterval ¶
func CronJobStarter ¶
CronJobStarter is able to start a go routine that periodically calls the provided handler. The time between calls is provided as timeToCall
func GetAllPerformanceIntervals ¶
func GetAllPerformanceIntervals() []string
GetAllPerformanceIntervals will output all the intervals defined
func NewKeyCounter ¶
func NewKeyCounter() *keyCounter
NewKeyCounter creates a new instance of type key counter
func NewKeysQueue ¶
func NewKeysQueue(keys ...string) *keysQueue
NewKeysQueue will hold a unique keys queue
func ProcessUserDetails ¶
func ProcessUserDetails(userDetails *UsersDetails)
ProcessUserDetails implements a high-level logic to set 3 fields on the provided user details object: the ProcessedAccountType, CryptoPaymentInitiated and IsUnlimited
Types ¶
type AccessKeyDetails ¶
type AccessKeyDetails struct {
MaxRequests uint64
GlobalCounter uint64
KeyCounter uint64
Username string
HashedPassword string
IsAdmin bool
}
AccessKeyDetails holds details about an access key
type AccountInfo ¶
type AccountInfo struct {
PaymentID uint64 `json:"paymentID"`
Address string `json:"address"`
Credits uint64 `json:"credits"`
}
AccountInfo response from account endpoint
type AccountType ¶
type AccountType string
AccountType describes the account type
const FreeAccountType AccountType = "free"
FreeAccountType defines the free account type, usually throttled
const PremiumAccountType AccountType = "premium"
PremiumAccountType defines the premium account type, un-throttled
type Claims ¶
type Claims struct {
Username string `json:"username"`
IsAdmin bool `json:"is_admin"`
jwt.RegisteredClaims
}
Claims struct holds the JWT claims
type CreateAddressResponse ¶
type CreateAddressResponse struct {
PaymentID uint64 `json:"paymentID"`
}
CreateAddressResponse response from create-address endpoint
type CryptoPaymentConfig ¶
type CryptoPaymentConfig struct {
IsContractPaused bool `json:"isContractPaused"`
CreditsPerEGLD uint64 `json:"creditsPerEGLD"`
WalletURL string `json:"walletURL"`
ExplorerURL string `json:"explorerURL"`
ContractAddress string `json:"contractAddress"`
MinimumBalance float64 `json:"minimumBalance"`
}
CryptoPaymentConfig response from crypto-payment service
type FileLoggingHandler ¶
type FileLoggingHandler interface {
ChangeFileLifeSpan(newDuration time.Duration, newSizeInMB uint64) error
Close() error
IsInterfaceNil() bool
}
FileLoggingHandler will handle log file rotation
type UsersDetails ¶
type UsersDetails struct {
MaxRequests uint64 `json:"MaxRequests"`
GlobalCounter uint64 `json:"GlobalCounter"`
Username string `json:"Username"`
HashedPassword string `json:"HashedPassword"`
IsPremium bool `json:"IsPremium"`
ProcessedAccountType AccountType `json:"AccountType"`
CryptoPaymentInitiated bool `json:"CryptoPaymentInitiated"`
IsUnlimited bool `json:"IsUnlimited"`
IsActive bool `json:"IsActive"`
IsAdmin bool `json:"IsAdmin"`
CryptoPaymentID uint64 `json:"PaymentID"`
SCMaxRequests uint64 `json:"SCMaxRequests"`
}
UsersDetails holds details about a user