model

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APP

type APP struct {
	Url          string           `json:"url"`
	Name         string           `json:"name" title:"服务"`
	Attr         map[string]int64 `json:"attr"`                          // 自定义内容
	Instance     int              `json:"instance" title:"最大实例"`         // 实例
	ExpireTime   time.Time        `json:"expire_time" title:"到期时间"`      // 授权到期的时间戳
	MaxLifeCycle int64            `json:"max_life_cycle" title:"最大生存周期"` // 最大生存周期 (授权到期时间-生成授权时间)/周期时间60s
	// contains filtered or unexported fields
}

type Cli

type Cli struct {
	ID    string `json:"id"`   // 客户端 id
	App   string `json:"app"`  // 产品
	Uuid  string `json:"uuid"` // 客户端 随机token
	IP    string `json:"ip"`
	Start int64  `json:"start"`
	Lease int64  `json:"lease"`
}

客户端

type License

type License struct {
	Lid            string            `json:"lid"`                      // 授权码唯一uuid,用来甄别是否重复授权。
	Sid            string            `json:"sid"`                      // 机器码的id, lid与sid 一一对应
	Devices        map[string]string `json:"devices"`                  // 节点id与 硬件信息md5
	GenerationTime time.Time         `json:"generation_time"`          // 授权生成时间
	UpdateTime     time.Time         `json:"update_time" title:"更新时间"` //当前时间 最后一次授权更新时间
	LifeCycle      int64             `json:"life_cycle" title:"生存周期"`  // 当前生存周期
	APPs           map[string]*APP   `json:"apps"  title:"产品"`         //key:app英文名请求中url标识字段
}

授权码

func (*License) CheckTime

func (lic *License) CheckTime(application string) bool

传入一个app名,检查改产品是否到期

func (*License) Format

func (lic *License) Format() *fLicense

func (*License) NodeNums

func (lic *License) NodeNums() int

type SerialNum

type SerialNum struct {
	Sid   string                `json:"sid"`   // 序列号唯一uuid,用来标识序列号,并与 授权码相互校验,一一对应。
	Nodes map[string]*node.Node `json:"nodes"` // 节点的具体硬件信息。这里不使用map的原因是map是无序的。无法保证每次生成的hws是一致的。
	Time  int64                 `json:"time"`  // 生成 序列号的时间。
}

序列号

func (*SerialNum) GenSerialNum

func (sn *SerialNum) GenSerialNum(nodes map[string]*node.Node) (code string, err error)

生成序列号

Jump to

Keyboard shortcuts

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