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"` Key string `json:"key,omitempty"`
CreateDate *util.Timestamp `json:"createDate,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 type MetaIPTypeEnum int
const ( const (
MetaIPTypeEnumV4 MetaIPTypeEnum = 1 MetaIPTypeEnumV4 MetaIPTypeEnum = iota + 1
MetaIPTypeEnumV6 MetaIPTypeEnum = 2 MetaIPTypeEnumV6
) )
var ( var (

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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