Documentation ¶
Index ¶
- Variables
- func Decode(data []byte) (response []byte, err error)
- func DecodeText(text string) (response string, err error)
- func Download(url string) ([]byte, error)
- func Encode(data []byte) (response []byte, err error)
- func EncodeText(text string) (response string, err error)
- func IsJSON(bytes []byte) bool
- func IsValidPacket(bytes []byte) bool
- type License
- func (instance *License) Add(days int64)
- func (instance *License) Encode() (text string, err error)
- func (instance *License) GetDataAsString() string
- func (instance *License) GetExpireDate() time.Time
- func (instance *License) IsValid() bool
- func (instance *License) Parse(text string) error
- func (instance *License) ParseBytes(bytes []byte) error
- func (instance *License) ParseExpireDate(layout string, value string) error
- func (instance *License) ReadFromFile(filename string) (err error)
- func (instance *License) RemainingDays() int64
- func (instance *License) SaveToFile(filename string) (err error)
- func (instance *License) SetExpireDate(date time.Time)
- func (instance *License) String() string
- type LicenseConfig
Constants ¶
This section is empty.
Variables ¶
View Source
var ( LicenseNotFoundError = errors.New("license_not_found_error") LicenseConfigurationFileNotFoundError = errors.New("license_config_not_found_error") LicenseExpiredError = errors.New("license_expired_error") )
View Source
var KEY = "G&G-license-key-fake______________"
Functions ¶
func DecodeText ¶
func EncodeText ¶
func IsValidPacket ¶
Types ¶
type License ¶
type License struct { Uid string `json:"uid"` CreationTime time.Time `json:"creation_time"` DurationDays int64 `json:"duration_days"` Name string `json:"name"` Email string `json:"email"` Lang string `json:"lang"` Enabled bool `json:"enabled"` Params map[string]interface{} `json:"params"` }
func NewLicense ¶
func (*License) GetDataAsString ¶
func (*License) GetExpireDate ¶
func (*License) ParseBytes ¶
func (*License) ParseExpireDate ¶
func (*License) ReadFromFile ¶
func (*License) RemainingDays ¶
func (*License) SaveToFile ¶
func (*License) SetExpireDate ¶
type LicenseConfig ¶
type LicenseConfig struct { Host string `json:"host"` Port int `json:"port"` Path string `json:"path"` UseSSL bool `json:"use_ssl"` }
func (*LicenseConfig) GetRequestFileName ¶
func (instance *LicenseConfig) GetRequestFileName() string
GetRequestFileName ---- Return file name if 'Path' is a static file, otherwise returns empty string. Path can be both a static file ("/licenses/lic.json") or url invoking a remote endpoint ("/endpoint?uid=123&act=get") ----
func (*LicenseConfig) Parse ¶
func (instance *LicenseConfig) Parse(text string) error
func (*LicenseConfig) ToString ¶
func (instance *LicenseConfig) ToString() string
Click to show internal directories.
Click to hide internal directories.