Documentation ¶
Index ¶
- Variables
- func Check(ctx echo.Context) error
- func CheckSiteURL(siteURL string, recordAvailableDomain ...bool) error
- func Domain() string
- func Download(ctx echo.Context) error
- func DownloadOnce(ctx echo.Context) error
- func DownloadTime() time.Time
- func EqDomain(fullDomain string, rootDomain string) bool
- func Error() error
- func FileName() string
- func FilePath() string
- func FireSetLicense(data *lib.LicenseData)
- func FullDomain() string
- func FullLicenseURL(ctx echo.Context) string
- func Generate(privBytes []byte, pemSaveDirs ...string) error
- func GetOrLoadPublicKey() string
- func License() lib.LicenseData
- func LoadPublicKey()
- func MachineID() (string, error)
- func Ok(ctx echo.Context) bool
- func OnSetLicense(fn func(*lib.LicenseData))
- func Package() string
- func ProductDetailURL() (url string)
- func ProductURL() string
- func PublicKey() string
- func ReadLicenseKeyFile() ([]byte, error)
- func Save(b []byte) error
- func SetDomain(_domain string)
- func SetError(err error)
- func SetLicense(data *lib.LicenseData)
- func SetPackage(pkg string)
- func SetProductDomain(domain string)
- func SetProductName(name string, domains ...string)
- func SetPublicKey(pubkey string)
- func SetServerURL(s *ServerURL)
- func SetVersion(ver string)
- func TrackerHTML() template.HTML
- func TrackerURL() string
- func URLValues(ctx echo.Context) url.Values
- func Validate(content ...[]byte) (err error)
- func VerifyPostLicenseContent(ctx echo.Context, content []byte) error
- func Version() string
- type Mode
- type OfficialData
- type OfficialResponse
- type ProductVersion
- type ServerURL
- type ValidateResponse
- type ValidateResult
- type Validation
- type Validator
- type VersionResponse
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrLicenseNotFound 授权证书不存在 ErrLicenseNotFound = errors.New(`License does not exist`) // SkipLicenseCheck 跳过授权检测 SkipLicenseCheck = true )
View Source
var ( MachineIDEncode = func(v string) string { return com.MakePassword(v, `coscms`, 3, 8, 19) } LicenseDecode = func(b []byte) ([]byte, string) { return b, GetOrLoadPublicKey() } )
View Source
var ( ErrConnectionFailed = errors.New(`连接授权服务器失败`) ErrOfficialDataUnexcepted = errors.New(`官方数据返回异常`) ErrLicenseDownloadFailed = errors.New(`下载证书失败:官方数据返回异常`) )
View Source
var NewValidateResponse = func() *ValidateResponse { return &ValidateResponse{ Data: ValidateResultInitor(), } }
View Source
var ValidateResultInitor = func() Validator { return &ValidateResult{} }
Functions ¶
func CheckSiteURL ¶
func DownloadOnce ¶
func DownloadTime ¶
func FireSetLicense ¶
func FireSetLicense(data *lib.LicenseData)
func FullDomain ¶
func FullDomain() string
func GetOrLoadPublicKey ¶
func GetOrLoadPublicKey() string
func License ¶
func License() lib.LicenseData
func LoadPublicKey ¶
func LoadPublicKey()
func OnSetLicense ¶
func OnSetLicense(fn func(*lib.LicenseData))
func ProductDetailURL ¶
func ProductDetailURL() (url string)
func ProductURL ¶
func ProductURL() string
func ReadLicenseKeyFile ¶
func SetLicense ¶
func SetLicense(data *lib.LicenseData)
func SetPackage ¶
func SetPackage(pkg string)
func SetProductDomain ¶
func SetProductDomain(domain string)
func SetProductName ¶
func SetPublicKey ¶
func SetPublicKey(pubkey string)
func SetServerURL ¶
func SetServerURL(s *ServerURL)
func SetVersion ¶
func SetVersion(ver string)
func TrackerHTML ¶
func TrackerURL ¶
func TrackerURL() string
func VerifyPostLicenseContent ¶
VerifyPostLicenseContent 验证提交的证书内容
Types ¶
type OfficialData ¶
type OfficialResponse ¶
type OfficialResponse struct { Code int Info string Zone string `json:",omitempty" xml:",omitempty"` Data *OfficialData `json:",omitempty" xml:",omitempty"` }
type ProductVersion ¶
type ProductVersion struct { Id uint64 `comment:"ID" json:"id" xml:"id"` ProductId uint64 `comment:"产品ID" json:"product_id" xml:"product_id"` Version string `comment:"版本号(格式1.0.1)" json:"version" xml:"version"` Type string `comment:"版本类型(stable-稳定版;beta-公测版;alpha-内测版)" json:"type" xml:"type"` Os string `comment:"支持的操作系统(多个用逗号分隔),留空表示不限制" json:"os" xml:"os"` Arch string `comment:"硬件架构(多个用逗号分隔),留空表示不限制" json:"arch" xml:"arch"` ReleasedAt uint `comment:"发布时间" json:"released_at" xml:"released_at"` Created uint `comment:"创建时间" json:"created" xml:"created"` Updated uint `comment:"修改时间" json:"updated" xml:"updated"` Disabled string `comment:"是否禁用" json:"disabled" xml:"disabled"` Audited string `comment:"是否已审核" json:"audited" xml:"audited"` ForceUpgrade string `comment:"是否强行升级为此版本" json:"force_upgrade" xml:"force_upgrade"` Description string `comment:"发布说明" json:"description" xml:"description"` Remark string `comment:"备注" json:"remark" xml:"remark"` DownloadUrl string `comment:"下载网址" json:"download_url" xml:"download_url"` Sign string `comment:"下载后验证签名(多个签名之间用逗号分隔)" json:"sign" xml:"sign"` DownloadUrlOther string `comment:"备用下载网址" json:"download_url_other" xml:"download_url_other"` DownloadedPath string `comment:"自动下载保存路径" json:"-" xml:"-"` }
func LatestVersion ¶
func LatestVersion(ctx echo.Context, forceDownload bool) (*ProductVersion, error)
type ServerURL ¶
type ValidateResponse ¶
type ValidateResult ¶
type ValidateResult struct { }
func (*ValidateResult) Validate ¶
func (v *ValidateResult) Validate() error
type Validation ¶
type Validation struct {
NowVersions []string
}
Validation 定义验证器
func (*Validation) Validate ¶
func (v *Validation) Validate(data *lib.LicenseData) error
Validate 参数验证器
type VersionResponse ¶
type VersionResponse struct { Code int Info string Zone string `json:",omitempty" xml:",omitempty"` Data *ProductVersion `json:",omitempty" xml:",omitempty"` }
Click to show internal directories.
Click to hide internal directories.