gg_license

package
v0.2.105 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: BSD-3-Clause Imports: 10 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LicenseBuilder

type LicenseBuilder struct {
}

func NewLicenseBuilder

func NewLicenseBuilder() (instance *LicenseBuilder)

func (*LicenseBuilder) EncodeLicenseToBytes

func (instance *LicenseBuilder) EncodeLicenseToBytes(license *license_commons.License) (bytes []byte, err error)

func (*LicenseBuilder) EncodeLicenseToText

func (instance *LicenseBuilder) EncodeLicenseToText(license *license_commons.License) (text string, err error)

func (*LicenseBuilder) EncodeToBytes

func (instance *LicenseBuilder) EncodeToBytes(uid, name, email, lang string, durationDays int64, params map[string]interface{}) (bytes []byte, err error)

func (*LicenseBuilder) EncodeToText

func (instance *LicenseBuilder) EncodeToText(uid, name, email, lang string, durationDays int64, params map[string]interface{}) (text string, err error)

func (*LicenseBuilder) NewLicense

func (instance *LicenseBuilder) NewLicense(uid string) (license *license_commons.License)

func (*LicenseBuilder) SaveLicenseToFile

func (instance *LicenseBuilder) SaveLicenseToFile(license *license_commons.License, dir string) (filename string, err error)

func (*LicenseBuilder) SaveLicenseToFileName

func (instance *LicenseBuilder) SaveLicenseToFileName(license *license_commons.License, filename string) (err error)

func (*LicenseBuilder) SaveLicenseToTempFile

func (instance *LicenseBuilder) SaveLicenseToTempFile(license *license_commons.License) (filename string, err error)

func (*LicenseBuilder) SaveToFile

func (instance *LicenseBuilder) SaveToFile(uid, name, email, lang string, durationDays int64, params map[string]interface{}, filename string) error

func (*LicenseBuilder) SaveToTempFile

func (instance *LicenseBuilder) SaveToTempFile(uid, name, email, lang string, durationDays int64, params map[string]interface{}) (string, error)

func (*LicenseBuilder) ToText

func (instance *LicenseBuilder) ToText(uid, name, email, lang string, durationDays int64, params map[string]interface{}) (text string)

type LicenseClient

type LicenseClient struct {
	Config *license_commons.LicenseConfig
	// contains filtered or unexported fields
}

func NewLicenseClient

func NewLicenseClient(config *license_commons.LicenseConfig) *LicenseClient

func (*LicenseClient) GetUrl

func (instance *LicenseClient) GetUrl() string

func (*LicenseClient) RequestLicense

func (instance *LicenseClient) RequestLicense(path string) (license *license_commons.License, err error)

type LicenseErrorCallback

type LicenseErrorCallback func(license *license_commons.License, err error)

type LicenseHelper

type LicenseHelper struct {
	OnFail LicenseErrorCallback
	// contains filtered or unexported fields
}
var License *LicenseHelper

func (*LicenseHelper) AddErrorListener

func (instance *LicenseHelper) AddErrorListener(callback LicenseErrorCallback) *LicenseHelper

func (*LicenseHelper) Builder

func (instance *LicenseHelper) Builder() (*LicenseBuilder, error)

func (*LicenseHelper) Check

func (instance *LicenseHelper) Check() (err error)

func (*LicenseHelper) SetConfigFile

func (instance *LicenseHelper) SetConfigFile(filename string)

func (*LicenseHelper) SetRoot

func (instance *LicenseHelper) SetRoot(root string)

func (*LicenseHelper) SetSecret

func (instance *LicenseHelper) SetSecret(key string)

func (*LicenseHelper) SetTolerance

func (instance *LicenseHelper) SetTolerance(duration time.Duration)

func (*LicenseHelper) Start

func (instance *LicenseHelper) Start(interval time.Duration) (err error)

func (*LicenseHelper) StartWithCallback

func (instance *LicenseHelper) StartWithCallback(interval time.Duration, onFail LicenseErrorCallback) (err error)

type LicenseTicker

type LicenseTicker struct {

	// ticker interval
	Interval time.Duration
	// optional path for license (usually is defined in configuration)
	LicensePath string

	// [run only if expired] override default action (send email if expired)
	ExpiredLicenseHook LicenseTickerCallback
	// [run always] notify action on license
	RequestLicenseHook LicenseTickerCallback
	ErrorLicenseHook   LicenseTickerCallback

	Email *LicenseTickerEmail
	// count number of time the license expire email was sent
	CountWarnings int
	// internal utility data storage
	Data map[string]interface{}
	// contains filtered or unexported fields
}

func NewLicenseTicker

func NewLicenseTicker(config *license_commons.LicenseConfig) *LicenseTicker

NewLicenseTicker

  • Creates new License Ticker.
  • @param config
  • @param callback Pass is want override default (send email to license owner)

func (*LicenseTicker) IsRunning

func (instance *LicenseTicker) IsRunning() bool

func (*LicenseTicker) Join

func (instance *LicenseTicker) Join()

func (*LicenseTicker) Start

func (instance *LicenseTicker) Start()

func (*LicenseTicker) Stop

func (instance *LicenseTicker) Stop()

type LicenseTickerCallback

type LicenseTickerCallback func(*LicenseTickerContext)

type LicenseTickerContext

type LicenseTickerContext struct {
	Error   error
	License *license_commons.License
	Ticker  *LicenseTicker
}

func NewLicenseTickerContext

func NewLicenseTickerContext() *LicenseTickerContext

func (*LicenseTickerContext) HasError404

func (instance *LicenseTickerContext) HasError404() bool

type LicenseTickerEmail

type LicenseTickerEmail struct {
	Enabled bool

	SmtpHost     string // smtp.gmail.com
	SmtpPort     int    // 587
	SmtpUser     string
	SmtpPassword string

	From    string
	Subject string
	Message string

	Target []string

	Errors []error
	// contains filtered or unexported fields
}

func (*LicenseTickerEmail) CanSend

func (instance *LicenseTickerEmail) CanSend() bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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