license

package
v2.1.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2020 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrLicenseNotFound = errors.New(`License does not exist`)
	SkipLicenseCheck   = true
)
View Source
var (
	ErrConnectionNotFound     = errors.New(`连接授权服务器失败`)
	ErrOfficialDataUnexcepted = errors.New(`官方数据返回异常`)
)
View Source
var NewValidResp = func() *ValidResp {
	return &ValidResp{Data: &ValidResult{}}
}

Functions

func Check

func Check(machineID, domain string) error

Check 检查权限

func Download

func Download(machineID, domain string) error

Download 从官方服务器重新下载许可证

func Error

func Error() error

func Exists

func Exists() bool

func FileName

func FileName() string

func FilePath

func FilePath() string

func FullLicenseURL

func FullLicenseURL(machineID, domain string) string

FullLicenseURL 包含完整参数的授权网址

func Generate

func Generate(privBytes []byte, pemSaveDirs ...string) error

Generate 生成演示版证书

func License

func License() lib.LicenseData

func MachineID

func MachineID() (string, error)

MachineID 生成当前机器的机器码

func Ok

func Ok(domain string) bool

func ProductURL

func ProductURL() string

func PublicKey

func PublicKey() string

func Save

func Save(b []byte) error

Save 保存授权文件

func SetPublicKey

func SetPublicKey(pubkey string)

func SetServerURL

func SetServerURL(s *ServerURL)

func SetVersion

func SetVersion(version string)

func TrackerURL

func TrackerURL() string

func Validate

func Validate() error

Validate 验证授权

func Version

func Version() string

Types

type OfficialData

type OfficialData struct {
	lib.LicenseData
	Timestamp int64
}

type OfficialResp

type OfficialResp struct {
	Code int
	Info string
	Zone string        `json:",omitempty" xml:",omitempty"`
	Data *OfficialData `json:",omitempty" xml:",omitempty"`
}

type ProductVersion

type ProductVersion struct {
	Id               uint64 `db:"id,omitempty,pk" bson:"id,omitempty" comment:"ID" json:"id" xml:"id"`
	ProductId        uint64 `db:"product_id" bson:"product_id" comment:"产品ID" json:"product_id" xml:"product_id"`
	Version          string `db:"version" bson:"version" comment:"版本号(格式1.0.1)" json:"version" xml:"version"`
	Type             string `db:"type" bson:"type" comment:"版本类型(stable-稳定版;beta-公测版;alpha-内测版)" json:"type" xml:"type"`
	Os               string `db:"os" bson:"os" comment:"支持的操作系统(多个用逗号分隔),留空表示不限制" json:"os" xml:"os"`
	Arch             string `db:"arch" bson:"arch" comment:"硬件架构(多个用逗号分隔),留空表示不限制" json:"arch" xml:"arch"`
	ReleasedAt       uint   `db:"released_at" bson:"released_at" comment:"发布时间" json:"released_at" xml:"released_at"`
	Created          uint   `db:"created" bson:"created" comment:"创建时间" json:"created" xml:"created"`
	Updated          uint   `db:"updated" bson:"updated" comment:"修改时间" json:"updated" xml:"updated"`
	Disabled         string `db:"disabled" bson:"disabled" comment:"是否禁用" json:"disabled" xml:"disabled"`
	Audited          string `db:"audited" bson:"audited" comment:"是否已审核" json:"audited" xml:"audited"`
	ForceUpgrade     string `db:"force_upgrade" bson:"force_upgrade" comment:"是否强行升级为此版本" json:"force_upgrade" xml:"force_upgrade"`
	Description      string `db:"description" bson:"description" comment:"发布说明" json:"description" xml:"description"`
	Remark           string `db:"remark" bson:"remark" comment:"备注" json:"remark" xml:"remark"`
	DownloadUrl      string `db:"download_url" bson:"download_url" comment:"下载网址" json:"download_url" xml:"download_url"`
	Sign             string `db:"sign" bson:"sign" comment:"下载后验证签名(多个签名之间用逗号分隔)" json:"sign" xml:"sign"`
	DownloadUrlOther string `` /* 129-byte string literal not displayed */
}

type ServerURL

type ServerURL struct {
	Tracker         string //用于统计分析的js地址
	Product         string //该产品的详情介绍页面网址
	License         string //许可证验证和许可证下载API网址
	Version         string //该产品最新版本信息API网址
	LicenseFileName string //许可证文件名称
}

func (*ServerURL) Apply

func (s *ServerURL) Apply()

type ValidResp

type ValidResp struct {
	Code int
	Info string
	Zone string    `json:",omitempty" xml:",omitempty"`
	Data Validator `json:",omitempty" xml:",omitempty"`
}

type ValidResult

type ValidResult struct {
}

func (*ValidResult) Validate

func (v *ValidResult) Validate() error

type Validation

type Validation struct {
	NowVersions []string
}

Validation 定义验证器

func (*Validation) Validate

func (v *Validation) Validate(data *lib.LicenseData) error

Validate 参数验证器

type Validator

type Validator interface {
	Validate() error
}

type VersionResp

type VersionResp struct {
	Code int
	Info string
	Zone string          `json:",omitempty" xml:",omitempty"`
	Data *ProductVersion `json:",omitempty" xml:",omitempty"`
}

Jump to

Keyboard shortcuts

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