This commit is contained in:
crusader 2018-06-13 18:53:17 +09:00
parent ab936be303
commit 6d6ac17b0a
10 changed files with 100 additions and 20 deletions

View File

@ -12,3 +12,83 @@ type MetaCryptoType struct {
Key string `json:"key,omitempty"`
CreateDate *util.Timestamp `json:"createDate,omitempty"`
}
type MetaCryptoTypeEnum int
const (
MetaCryptoTypeEnumNONE MetaCryptoTypeEnum = iota + 1
MetaCryptoTypeEnumUNKNOWN
MetaCryptoTypeEnumAES
MetaCryptoTypeEnumCIPHER
MetaCryptoTypeEnumDES
MetaCryptoTypeEnumDSA
MetaCryptoTypeEnumECDSA
MetaCryptoTypeEnumELLIPTIC
MetaCryptoTypeEnumHMAC
MetaCryptoTypeEnumMD5
MetaCryptoTypeEnumRAND
MetaCryptoTypeEnumRC4
MetaCryptoTypeEnumRSA
MetaCryptoTypeEnumSHA1
MetaCryptoTypeEnumSHA256
MetaCryptoTypeEnumSUBTLE
MetaCryptoTypeEnumTLS
MetaCryptoTypeEnumX509
MetaCryptoTypeEnumPKIX
)
var (
metaCryptoTypeEnumID = map[MetaCryptoTypeEnum]string{
MetaCryptoTypeEnumNONE: "NONE",
MetaCryptoTypeEnumUNKNOWN: "UNKNOWN",
MetaCryptoTypeEnumAES: "AES",
MetaCryptoTypeEnumCIPHER: "CIPHER",
MetaCryptoTypeEnumDES: "DES",
MetaCryptoTypeEnumDSA: "DSA",
MetaCryptoTypeEnumECDSA: "ECDSA",
MetaCryptoTypeEnumELLIPTIC: "ELLIPTIC",
MetaCryptoTypeEnumHMAC: "HMAC",
MetaCryptoTypeEnumMD5: "MD5",
MetaCryptoTypeEnumRAND: "RAND",
MetaCryptoTypeEnumRC4: "RC4",
MetaCryptoTypeEnumRSA: "RSA",
MetaCryptoTypeEnumSHA1: "SHA1",
MetaCryptoTypeEnumSHA256: "SHA256",
MetaCryptoTypeEnumSUBTLE: "SUBTLE",
MetaCryptoTypeEnumTLS: "TLS",
MetaCryptoTypeEnumX509: "X509",
MetaCryptoTypeEnumPKIX: "PKIX",
}
metaCryptoTypeEnumKey = map[string]MetaCryptoTypeEnum{
"NONE": MetaCryptoTypeEnumNONE,
"UNKNOWN": MetaCryptoTypeEnumUNKNOWN,
"AES": MetaCryptoTypeEnumAES,
"CIPHER": MetaCryptoTypeEnumCIPHER,
"DES": MetaCryptoTypeEnumDES,
"DSA": MetaCryptoTypeEnumDSA,
"ECDSA": MetaCryptoTypeEnumECDSA,
"ELLIPTIC": MetaCryptoTypeEnumELLIPTIC,
"HMAC": MetaCryptoTypeEnumHMAC,
"MD5": MetaCryptoTypeEnumMD5,
"RAND": MetaCryptoTypeEnumRAND,
"RC4": MetaCryptoTypeEnumRC4,
"RSA": MetaCryptoTypeEnumRSA,
"SHA1": MetaCryptoTypeEnumSHA1,
"SHA256": MetaCryptoTypeEnumSHA256,
"SUBTLE": MetaCryptoTypeEnumSUBTLE,
"TLS": MetaCryptoTypeEnumTLS,
"X509": MetaCryptoTypeEnumX509,
"PKIX": MetaCryptoTypeEnumPKIX,
}
)
func ToMetaCryptoTypeEnum(v *MetaCryptoType) MetaCryptoTypeEnum {
return metaCryptoTypeEnumKey[v.Key]
}
func ToMetaCryptoType(v MetaCryptoTypeEnum) *MetaCryptoType {
return &MetaCryptoType{
Key: metaCryptoTypeEnumID[v],
}
}

View File

@ -16,8 +16,8 @@ type MetaIPType struct {
type MetaIPTypeEnum int
const (
MetaIPTypeEnumV4 MetaIPTypeEnum = 1
MetaIPTypeEnumV6 MetaIPTypeEnum = 2
MetaIPTypeEnumV4 MetaIPTypeEnum = iota + 1
MetaIPTypeEnumV6
)
var (

View File

@ -16,9 +16,9 @@ type MetaInfraType struct {
type MetaInfraTypeEnum int
const (
MetaInfraTypeEnumZONE MetaInfraTypeEnum = 1
MetaInfraTypeEnumHOST MetaInfraTypeEnum = 2
MetaInfraTypeEnumService MetaInfraTypeEnum = 3
MetaInfraTypeEnumZONE MetaInfraTypeEnum = iota + 1
MetaInfraTypeEnumHOST
MetaInfraTypeEnumService
)
var (

View File

@ -16,10 +16,10 @@ type MetaMemberStatus struct {
type MetaMemberStatusEnum int
const (
MetaMemberStatusEnumNOAUTH MetaMemberStatusEnum = 1
MetaMemberStatusEnumNORMAL MetaMemberStatusEnum = 2
MetaMemberStatusEnumDORMANCY MetaMemberStatusEnum = 3
MetaMemberStatusEnumWITHDRAWAL MetaMemberStatusEnum = 4
MetaMemberStatusEnumNOAUTH MetaMemberStatusEnum = iota + 1
MetaMemberStatusEnumNORMAL
MetaMemberStatusEnumDORMANCY
MetaMemberStatusEnumWITHDRAWAL
)
var (

View File

@ -16,9 +16,9 @@ type MetaNoAuthProbeStatus struct {
type NoAuthProbeStatusEnum int
const (
NoAuthProbeStatusEnumACCEPT NoAuthProbeStatusEnum = 1
NoAuthProbeStatusEnumDENY NoAuthProbeStatusEnum = 2
NoAuthProbeStatusEnumPROCESSING NoAuthProbeStatusEnum = 3
NoAuthProbeStatusEnumACCEPT NoAuthProbeStatusEnum = iota + 1
NoAuthProbeStatusEnumDENY
NoAuthProbeStatusEnumPROCESSING
)
var (

View File

@ -16,8 +16,8 @@ type MetaPortType struct {
type MetaPortTypeEnum int
const (
MetaPortTypeEnumTCP MetaPortTypeEnum = 1
MetaPortTypeEnumUDP MetaPortTypeEnum = 2
MetaPortTypeEnumTCP MetaPortTypeEnum = iota + 1
MetaPortTypeEnumUDP
)
var (

View File

@ -16,8 +16,8 @@ type MetaProbeStatus struct {
type MetaProbeStatusEnum int
const (
MetaProbeStatusEnumINITIAL MetaProbeStatusEnum = 1
MetaProbeStatusEnumNORMAL MetaProbeStatusEnum = 2
MetaProbeStatusEnumINITIAL MetaProbeStatusEnum = iota + 1
MetaProbeStatusEnumNORMAL
)
var (

View File

@ -7,7 +7,7 @@ type MetaTargetHostType struct {
type MetaTargetHostTypeEnum int
const (
MetaTargetHostTypeEnumUNKNOWN MetaTargetHostTypeEnum = 100
MetaTargetHostTypeEnumUNKNOWN MetaTargetHostTypeEnum = iota + 1
)
var (

View File

@ -7,7 +7,7 @@ type MetaTargetServiceType struct {
type MetaTargetServiceTypeEnum int
const (
MetaTargetServiceTypeEnumUNKNOWN MetaTargetServiceTypeEnum = 1000
MetaTargetServiceTypeEnumUNKNOWN MetaTargetServiceTypeEnum = iota + 1
)
var (

View File

@ -7,8 +7,8 @@ type MetaTargetZoneType struct {
type MetaTargetZoneTypeEnum int
const (
MetaTargetZoneTypeEnumUNKNOWN MetaTargetZoneTypeEnum = 1
MetaTargetZoneTypeEnumZONE MetaTargetZoneTypeEnum = 2
MetaTargetZoneTypeEnumUNKNOWN MetaTargetZoneTypeEnum = iota + 1
MetaTargetZoneTypeEnumZONE
)
var (