Documentation ¶
Index ¶
- Variables
- func Example(param *ExampleParam) error
- func GetBaseBoardSerial() (string, error)
- func GetCPUSerial() ([]string, error)
- func GetGPUs(configmap, namespace string) ([]string, error)
- func GetIpAddress() ([]string, error)
- func GetK8sNodes() ([]string, error)
- func GetMacAddress() ([]string, error)
- type Aes
- type CheckModel
- type ExampleParam
- type GenerateParam
- type License
- type LicenseContent
- type PrivateKey
- type ValidateParam
Constants ¶
This section is empty.
Variables ¶
View Source
var ( OsNotSupported = errors.New("os not supported") NotFoundKubeConfig = errors.New("not found env: KUBECONFIG") )
Functions ¶
func Example ¶
func Example(param *ExampleParam) error
func GetBaseBoardSerial ¶ added in v1.1.3
func GetIpAddress ¶
func GetK8sNodes ¶ added in v1.1.0
func GetMacAddress ¶
Types ¶
type Aes ¶ added in v1.1.0
type Aes struct {
// contains filtered or unexported fields
}
func (*Aes) Generate ¶ added in v1.1.0
func (l *Aes) Generate(param *GenerateParam) error
func (*Aes) GetLicenseContent ¶ added in v1.1.4
func (l *Aes) GetLicenseContent(name string) (LicenseContent, error)
func (*Aes) LocalValidate ¶ added in v1.1.0
func (l *Aes) LocalValidate(param *ValidateParam) error
func (*Aes) Validate ¶ added in v1.1.0
func (l *Aes) Validate(param *ValidateParam) error
type CheckModel ¶
type CheckModel struct { IpAddress []string `json:"ip_address" yaml:"ip_address" mapstructure:"ip_address"` // 可被允许的IP地址 MacAddress []string `json:"mac_address" yaml:"mac_address" mapstructure:"mac_address"` // 可被允许的MAC地址 CpuSerial []string `json:"cpu_serial" yaml:"cpu_serial" mapstructure:"cpu_serial"` // 可被允许的CPU序列号 BaseBoardSerial []string `json:"base_board_serial" yaml:"base_board_serial" mapstructure:"base_board_serial"` // 可被允许的主板序列号 }
type ExampleParam ¶ added in v1.1.0
type ExampleParam struct { LicenseName string `json:"license_name" yaml:"license_name" mapstructure:"license_name"` // 证书生成名称 LicenseSigName string `json:"license_sig_name" yaml:"license_sig_name" mapstructure:"license_sig_name"` // sig证书生成名称 PrivateKeyName string `json:"private_key_name,omitempty" yaml:"private_key_name,omitempty" mapstructure:"private_key_name,omitempty"` // 密钥库存储名称 Metadata map[string]interface{} `json:"metadata" yaml:"metadata"` // 元数据 Extra map[string]interface{} `json:"extra,omitempty" yaml:"extra,omitempty"` // 额外的校验信息 }
ExampleParam 生成config
type GenerateParam ¶
type GenerateParam struct { Subject string `json:"subject" yaml:"subject"` // 证书subject PrivateAlias string `json:"private_alias" yaml:"private_alias,omitempty" mapstructure:"private_alias,omitempty"` // 密钥别称 KeyPass string `json:"key_pass" yaml:"key_pass" mapstructure:"key_pass"` // 密钥密码(需要妥善保管,不能让使用者知道) StorePass string `json:"store_pass,omitempty" yaml:"store_pass,omitempty" mapstructure:"store_pass,omitempty"` // 访问秘钥库的密码 LicenseName string `json:"license_name" yaml:"license_name" mapstructure:"license_name"` // 证书生成名称 LicenseSigName string `json:"license_sig_name" yaml:"license_sig_name" mapstructure:"license_sig_name"` // sig证书生成名称 PrivateKeyName string `json:"private_key_name,omitempty" yaml:"private_key_name,omitempty" mapstructure:"private_key_name,omitempty"` // 密钥库存储名称 Issued time.Time `json:"issued" yaml:"issued"` // 证书生成时间 NotBefore time.Time `json:"not_before" yaml:"not_before" mapstructure:"not_before"` // 证书生效时间 NotAfter time.Time `json:"not_after" yaml:"not_after" mapstructure:"not_after"` // 证书失效时间 ConsumerType string `json:"consumer_type" yaml:"consumer_type" mapstructure:"consumer_type"` // 用户类型 ConsumerAmount int `json:"consumer_amount" yaml:"consumer_amount" mapstructure:"consumer_amount"` // 用户数量 Description string `json:"description" yaml:"description"` // 描述信息 Metadata map[string]interface{} `json:"metadata" yaml:"metadata"` // 元数据 CheckModel *CheckModel `json:"check_model,omitempty" yaml:"check_model,omitempty" mapstructure:"check_model,omitempty"` // 服务器硬件校验信息 Extra map[string]interface{} `json:"extra,omitempty" yaml:"extra,omitempty"` // 额外的信息 }
GenerateParam 生成证书参数
func (*GenerateParam) ReadYaml ¶
func (c *GenerateParam) ReadYaml(path string) error
type License ¶ added in v1.1.0
type License interface { Generate(param *GenerateParam) error LocalValidate(param *ValidateParam) error Validate(param *ValidateParam) error GetLicenseContent(name string) (LicenseContent, error) }
type LicenseContent ¶ added in v1.1.0
type LicenseContent struct { Subject string `json:"subject" yaml:"subject"` // 证书subject Issued time.Time `json:"issued" yaml:"issued"` // 证书生成时间 NotBefore time.Time `json:"not_before" yaml:"not_before" mapstructure:"not_before"` // 证书生效时间 NotAfter time.Time `json:"not_after" yaml:"not_after" mapstructure:"not_after"` // 证书失效时间 ConsumerType string `json:"consumer_type" yaml:"consumer_type" mapstructure:"consumer_type"` // 用户类型 ConsumerAmount int `json:"consumer_amount" yaml:"consumer_amount" mapstructure:"consumer_amount"` // 用户数量 Description string `json:"description" yaml:"description"` // 描述信息 CheckModel *CheckModel `json:"check_model,omitempty" yaml:"check_model,omitempty" mapstructure:"check_model,omitempty"` // 服务器硬件校验信息 Metadata map[string]interface{} `json:"metadata" yaml:"metadata"` // 元数据 Extra map[string]interface{} `json:"extra,omitempty" yaml:"extra,omitempty"` // 额外的信息 }
func (*LicenseContent) ReadYaml ¶ added in v1.1.0
func (c *LicenseContent) ReadYaml(path string) error
type PrivateKey ¶ added in v1.1.0
type PrivateKey struct {
// contains filtered or unexported fields
}
func NewPrivateKey ¶ added in v1.1.0
func NewPrivateKey(store store.Store) *PrivateKey
func (*PrivateKey) Generate ¶ added in v1.1.0
func (l *PrivateKey) Generate(param *GenerateParam) error
Generate 生成软件证书许可
func (*PrivateKey) GetLicenseContent ¶ added in v1.1.4
func (l *PrivateKey) GetLicenseContent(name string) (LicenseContent, error)
func (*PrivateKey) LocalValidate ¶ added in v1.1.0
func (l *PrivateKey) LocalValidate(param *ValidateParam) error
LocalValidate 验证软件证书许可,会自动补全本机的CPU,IP,MAC address并与License进行验证
func (*PrivateKey) Validate ¶ added in v1.1.0
func (l *PrivateKey) Validate(param *ValidateParam) error
Validate 验证软件证书许可,不会自动补全本机的CPU,IP,MAC address,请自行补充信息
type ValidateParam ¶
type ValidateParam struct { PrivateAlias string // 密钥别称 KeyPass string // 密钥密码(需要妥善保管,不能让使用者知道) StorePass string // 访问秘钥库的密码 LicenseName string // 证书生成名称 LicenseSigName string // sig证书生成名称 PrivateKeyName string // 密钥库存储名称 NotBefore time.Time // 证书生效时间 NotAfter time.Time // 证书失效时间 ConsumerAmount int // 用户数量 Metadata map[string]interface{} // 元数据 LicenseCheckModel *CheckModel // 服务器硬件校验信息 Extra map[string]interface{} // 额外的校验信息 ExtraValidateFunc func(licenseExtra, validateExtra map[string]interface{}) error // 额外的校验函数 }
func (*ValidateParam) NewLicense ¶ added in v1.1.2
func (params *ValidateParam) NewLicense() (License, error)
NewLicense 只在example时使用
func (*ValidateParam) SwitchStore ¶ added in v1.1.2
func (params *ValidateParam) SwitchStore() (store.Store, error)
func (*ValidateParam) Validate ¶ added in v1.1.0
func (params *ValidateParam) Validate(licenseData *LicenseContent) error
Click to show internal directories.
Click to hide internal directories.