diff --git a/core/util/timestamp.go b/core/util/timestamp.go new file mode 100644 index 0000000..623f64a --- /dev/null +++ b/core/util/timestamp.go @@ -0,0 +1,42 @@ +package util + +import ( + "fmt" + "strconv" + "time" +) + +type Timestamp time.Time + +func (t Timestamp) MarshalJSON() ([]byte, error) { + ts := time.Time(t).Unix() + stamp := fmt.Sprint(ts * 1000) + return []byte(stamp), nil +} + +func (t *Timestamp) UnmarshalJSON(b []byte) error { + ts, err := strconv.Atoi(string(b)) + if err != nil { + return err + } + *t = Timestamp(time.Unix(int64(ts)/1000, 0)) + + return nil +} + +func (t Timestamp) String() string { + return time.Time(t).String() +} + +func Now() Timestamp { + return Timestamp(time.Now()) +} + +func NowPtr() *Timestamp { + n := Now() + return &n +} + +func Date(year int, month time.Month, day int) Timestamp { + return Timestamp(time.Date(year, month, day, 0, 0, 0, 0, time.UTC)) +} diff --git a/model/discovery/DiscoverHost.go b/model/discovery/DiscoverHost.go new file mode 100644 index 0000000..c135194 --- /dev/null +++ b/model/discovery/DiscoverHost.go @@ -0,0 +1,16 @@ +package discovery + +import ( + "git.loafle.net/overflow/commons-go/model/meta" +) + +type DiscoverHost struct { + MetaIPType *meta.MetaIPType `json:"metaIPType,omitempty"` + + FirstScanRange string `json:"firstScanRange,omitempty"` + LastScanRange string `json:"lastScanRange,omitempty"` + ExcludeHosts []string `json:"excludeHosts,omitempty"` + IncludeHosts []string `json:"includeHosts,omitempty"` + + DiscoverPort *DiscoverPort `json:"discoverPort,omitempty"` +} diff --git a/model/discovery/DiscoverPort.go b/model/discovery/DiscoverPort.go new file mode 100644 index 0000000..8e7e37f --- /dev/null +++ b/model/discovery/DiscoverPort.go @@ -0,0 +1,28 @@ +package discovery + +type DiscoverPort struct { + FirstScanRange int `json:"firstScanRange,omitempty"` + LastScanRange int `json:"lastScanRange,omitempty"` + ExcludePorts []int `json:"excludePorts,omitempty"` + + IncludeTCP bool `json:"includeTCP,omitempty"` + IncludeUDP bool `json:"includeUDP,omitempty"` + + DiscoverService *DiscoverService `json:"discoverService,omitempty"` +} + +func (dp *DiscoverPort) Contains(port int) bool { + if dp.FirstScanRange > port { + return false + } + if dp.LastScanRange < port { + return false + } + for _, p := range dp.ExcludePorts { + if p == port { + return false + } + } + + return true +} diff --git a/model/discovery/DiscoverService.go b/model/discovery/DiscoverService.go new file mode 100644 index 0000000..5b32960 --- /dev/null +++ b/model/discovery/DiscoverService.go @@ -0,0 +1,5 @@ +package discovery + +type DiscoverService struct { + IncludeServices []string `json:"includeServices,omitempty"` +} diff --git a/model/discovery/DiscoverZone.go b/model/discovery/DiscoverZone.go new file mode 100644 index 0000000..73b078e --- /dev/null +++ b/model/discovery/DiscoverZone.go @@ -0,0 +1,7 @@ +package discovery + +type DiscoverZone struct { + ExcludePatterns []string `json:"excludePatterns,omitempty"` + + DiscoverHost *DiscoverHost `json:"discoverHost,omitempty"` +} diff --git a/model/discovery/Host.go b/model/discovery/Host.go new file mode 100644 index 0000000..e392238 --- /dev/null +++ b/model/discovery/Host.go @@ -0,0 +1,17 @@ +package discovery + +import ( + "git.loafle.net/overflow/commons-go/core/util" + "git.loafle.net/overflow/commons-go/model/meta" +) + +type Host struct { + MetaIPType *meta.MetaIPType `json:"metaIPType,omitempty"` + Address string `json:"address,omitempty"` + Mac string `json:"mac,omitempty"` + + Zone *Zone `json:"zone,omitempty"` + PortList []*Port `json:"portList,omitempty"` + + DiscoveredDate *util.Timestamp `json:"discoveredDate,omitempty"` +} diff --git a/model/discovery/Port.go b/model/discovery/Port.go new file mode 100644 index 0000000..e42d5b6 --- /dev/null +++ b/model/discovery/Port.go @@ -0,0 +1,20 @@ +package discovery + +import ( + "encoding/json" + + "git.loafle.net/overflow/commons-go/core/util" + "git.loafle.net/overflow/commons-go/model/meta" + "github.com/google/gopacket" +) + +type Port struct { + MetaPortType *meta.MetaPortType `json:"metaPortType,omitempty"` + PortNumber json.Number `json:"portNumber,omitempty"` + DiscoveredDate *util.Timestamp `json:"discoveredDate,omitempty"` + + Host *Host `json:"host,omitempty"` + ServiceList []*Service `json:"serviceList,omitempty"` + + UDPLayer gopacket.Layer `json:"-"` +} diff --git a/model/discovery/Service.go b/model/discovery/Service.go new file mode 100644 index 0000000..dae8dc2 --- /dev/null +++ b/model/discovery/Service.go @@ -0,0 +1,16 @@ +package discovery + +import ( + "git.loafle.net/overflow/commons-go/core/util" + "git.loafle.net/overflow/commons-go/model/meta" +) + +type Service struct { + MetaCryptoType *meta.MetaCryptoType `json:"metaCryptoType,omitempty"` + Key string `json:"key,omitempty"` + Description string `json:"description,omitempty"` + + Port *Port `json:"port,omitempty"` + + DiscoveredDate *util.Timestamp `json:"discoveredDate,omitempty"` +} diff --git a/model/discovery/Zone.go b/model/discovery/Zone.go new file mode 100644 index 0000000..18a28ee --- /dev/null +++ b/model/discovery/Zone.go @@ -0,0 +1,20 @@ +package discovery + +import ( + "sync" + + "git.loafle.net/overflow/commons-go/core/util" + "git.loafle.net/overflow/commons-go/model/meta" +) + +type Zone struct { + Network string `json:"network,omitempty"` + Iface string `json:"iface,omitempty"` + MetaIPType *meta.MetaIPType `json:"metaIPType,omitempty"` + Address string `json:"address,omitempty"` + Mac string `json:"mac,omitempty"` + + DiscoveredDate *util.Timestamp `json:"discoveredDate,omitempty"` + + mtx sync.RWMutex `json:"-"` +} diff --git a/model/meta/MetaCollectionItem.go b/model/meta/MetaCollectionItem.go new file mode 100644 index 0000000..ef7605f --- /dev/null +++ b/model/meta/MetaCollectionItem.go @@ -0,0 +1,16 @@ +package meta + +import ( + "encoding/json" + + "git.loafle.net/overflow/commons-go/core/util" +) + +type MetaCollectionItem struct { + ID json.Number `json:"id,Number,omitempty"` + Key string `json:"key,omitempty"` + Item string `json:"item,omitempty"` + ItemClass string `json:"itemClass,omitempty"` + MetaItemUnit *MetaItemUnit `json:"metaItemUnit,omitempty"` + CreateDate *util.Timestamp `json:"createDate,omitempty"` +} diff --git a/model/meta/MetaCollectionItemMapping.go b/model/meta/MetaCollectionItemMapping.go new file mode 100644 index 0000000..b995c40 --- /dev/null +++ b/model/meta/MetaCollectionItemMapping.go @@ -0,0 +1,13 @@ +package meta + +import ( + "encoding/json" + "git.loafle.net/overflow/commons-go/core/util" +) + +type MetaCollectionItemMapping struct { + ID json.Number `json:"id,Number,omitempty"` + MetaDisplayItemMapping *MetaDisplayItemMapping `json:"metaDisplayItemMapping,omitempty"` + MetaCollectionItem *MetaCollectionItem `json:"metaCollectionItem,omitempty"` + CreateDate *util.Timestamp `json:"createDate,omitempty"` +} diff --git a/model/meta/MetaCrawler.go b/model/meta/MetaCrawler.go new file mode 100644 index 0000000..508007b --- /dev/null +++ b/model/meta/MetaCrawler.go @@ -0,0 +1,13 @@ +package meta + +import ( + "encoding/json" + "git.loafle.net/overflow/commons-go/core/util" +) + +type MetaCrawler struct { + ID json.Number `json:"id,Number,omitempty"` + Name string `json:"name,omitempty"` + Key string `json:"key,omitempty"` + CreateDate *util.Timestamp `json:"createDate,omitempty"` +} diff --git a/model/meta/MetaCrawlerContainer.go b/model/meta/MetaCrawlerContainer.go new file mode 100644 index 0000000..7ec83c8 --- /dev/null +++ b/model/meta/MetaCrawlerContainer.go @@ -0,0 +1,13 @@ +package meta + +import ( + "encoding/json" + "git.loafle.net/overflow/commons-go/core/util" +) + +type MetaCrawlerContainer struct { + ID json.Number `json:"id,Number,omitempty"` + Name string `json:"name,omitempty"` + Key string `json:"key,omitempty"` + CreateDate *util.Timestamp `json:"createDate,omitempty"` +} diff --git a/model/meta/MetaCrawlerInputItem.go b/model/meta/MetaCrawlerInputItem.go new file mode 100644 index 0000000..d902fe3 --- /dev/null +++ b/model/meta/MetaCrawlerInputItem.go @@ -0,0 +1,13 @@ +package meta + +import ( + "encoding/json" + "git.loafle.net/overflow/commons-go/core/util" +) + +type MetaCrawlerInputItem struct { + ID json.Number `json:"id,Number,omitempty"` + MetaInputType *MetaInputType `json:"metaInputType,omitempty"` + Key string `json:"key,omitempty"` + CreateDate *util.Timestamp `json:"createDate,omitempty"` +} diff --git a/model/meta/MetaCrawlerMapping.go b/model/meta/MetaCrawlerMapping.go new file mode 100644 index 0000000..fa5b88d --- /dev/null +++ b/model/meta/MetaCrawlerMapping.go @@ -0,0 +1,15 @@ +package meta + +import ( + "encoding/json" + "git.loafle.net/overflow/commons-go/core/util" +) + +type MetaCrawlerMapping struct { + ID json.Number `json:"id,Number,omitempty"` + MetaTargetType *MetaTargetType `json:"metaTargetType,Number,omitempty"` + MetaCrawler *MetaCrawler `json:"metaCrawler,omitempty"` + DefaultInterval json.Number `json:"defaultInterval,omitempty"` + IsDefault bool `json:"isDefault,omitempty"` + CreateDate *util.Timestamp `json:"createDate,omitempty"` +} diff --git a/model/meta/MetaCryptoType.go b/model/meta/MetaCryptoType.go new file mode 100644 index 0000000..2ae5bd9 --- /dev/null +++ b/model/meta/MetaCryptoType.go @@ -0,0 +1,98 @@ +package meta + +import ( + "encoding/json" + + "git.loafle.net/overflow/commons-go/core/util" +) + +type MetaCryptoType struct { + ID json.Number `json:"id,Number,omitempty"` + Name string `json:"name,omitempty"` + 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 (e MetaCryptoTypeEnum) String() string { + return metaCryptoTypeEnumID[e] +} + +func ToMetaCryptoTypeEnum(v *MetaCryptoType) MetaCryptoTypeEnum { + return metaCryptoTypeEnumKey[v.Key] +} + +func ToMetaCryptoType(v MetaCryptoTypeEnum) *MetaCryptoType { + return &MetaCryptoType{ + Key: metaCryptoTypeEnumID[v], + } +} diff --git a/model/meta/MetaDisplayItem.go b/model/meta/MetaDisplayItem.go new file mode 100644 index 0000000..775bc65 --- /dev/null +++ b/model/meta/MetaDisplayItem.go @@ -0,0 +1,13 @@ +package meta + +import ( + "encoding/json" + "git.loafle.net/overflow/commons-go/core/util" +) + +type MetaDisplayItem struct { + ID json.Number `json:"id,Number,omitempty"` + Name string `json:"name,omitempty"` + Key string `json:"key,omitempty"` + CreateDate *util.Timestamp `json:"createDate,omitempty"` +} diff --git a/model/meta/MetaDisplayItemCategory.go b/model/meta/MetaDisplayItemCategory.go new file mode 100644 index 0000000..5a71841 --- /dev/null +++ b/model/meta/MetaDisplayItemCategory.go @@ -0,0 +1,14 @@ +package meta + +import ( + "encoding/json" + + "git.loafle.net/overflow/commons-go/core/util" +) + +type MetaDisplayItemCategory struct { + ID json.Number `json:"id,Number,omitempty"` + Name string `json:"name,omitempty"` + Key string `json:"key,omitempty"` + CreateDate *util.Timestamp `json:"createDate,omitempty"` +} diff --git a/model/meta/MetaDisplayItemMapping.go b/model/meta/MetaDisplayItemMapping.go new file mode 100644 index 0000000..5bcd23b --- /dev/null +++ b/model/meta/MetaDisplayItemMapping.go @@ -0,0 +1,19 @@ +package meta + +import ( + "encoding/json" + "git.loafle.net/overflow/commons-go/core/util" +) + +type MetaDisplayItemMapping struct { + ID json.Number `json:"id,Number,omitempty"` + MetaDisplayItem *MetaDisplayItem `json:"metaDisplayItem,omitempty"` + MetaCrawlerMapping *MetaCrawlerMapping `json:"metaCrawlerMapping,omitempty"` + MetaItemUnit *MetaItemUnit `json:"metaItemUnit,omitempty"` + MetaDisplayItemCategory *MetaDisplayItemCategory `json:"metaDisplayItemCategory,omitempty"` + IsDefault bool `json:"isDefault,omitempty"` + Formula string `json:"formula,omitempty"` + Priority json.Number `json:"priority,omitempty"` + IsRequired bool `json:"isRequired,omitempty"` + CreateDate *util.Timestamp `json:"createDate,omitempty"` +} diff --git a/model/meta/MetaHistoryType.go b/model/meta/MetaHistoryType.go new file mode 100644 index 0000000..c7cc201 --- /dev/null +++ b/model/meta/MetaHistoryType.go @@ -0,0 +1,14 @@ +package meta + +import ( + "encoding/json" + + "git.loafle.net/overflow/commons-go/core/util" +) + +type MetaHistoryType struct { + ID json.Number `json:"id,Number,omitempty"` + Name string `json:"name,omitempty"` + Key string `json:"key,omitempty"` + CreateDate *util.Timestamp `json:"createDate,omitempty"` +} diff --git a/model/meta/MetaIPType.go b/model/meta/MetaIPType.go new file mode 100644 index 0000000..c2e413d --- /dev/null +++ b/model/meta/MetaIPType.go @@ -0,0 +1,47 @@ +package meta + +import ( + "encoding/json" + + "git.loafle.net/overflow/commons-go/core/util" +) + +type MetaIPType struct { + ID json.Number `json:"id,Number,omitempty"` + Name string `json:"name,omitempty"` + Key string `json:"key,omitempty"` + CreateDate *util.Timestamp `json:"createDate,omitempty"` +} + +type MetaIPTypeEnum int + +const ( + MetaIPTypeEnumV4 MetaIPTypeEnum = iota + 1 + MetaIPTypeEnumV6 +) + +var ( + metaIPTypeEnumID = map[MetaIPTypeEnum]string{ + MetaIPTypeEnumV4: "V4", + MetaIPTypeEnumV6: "V6", + } + + metaIPTypeEnumKey = map[string]MetaIPTypeEnum{ + "V4": MetaIPTypeEnumV4, + "V6": MetaIPTypeEnumV6, + } +) + +func (e MetaIPTypeEnum) String() string { + return metaIPTypeEnumID[e] +} + +func ToMetaIPTypeEnum(v *MetaIPType) MetaIPTypeEnum { + return metaIPTypeEnumKey[v.Key] +} + +func ToMetaIPType(v MetaIPTypeEnum) *MetaIPType { + return &MetaIPType{ + Key: metaIPTypeEnumID[v], + } +} diff --git a/model/meta/MetaInfraType.go b/model/meta/MetaInfraType.go new file mode 100644 index 0000000..c93bba4 --- /dev/null +++ b/model/meta/MetaInfraType.go @@ -0,0 +1,50 @@ +package meta + +import ( + "encoding/json" + + "git.loafle.net/overflow/commons-go/core/util" +) + +type MetaInfraType struct { + ID json.Number `json:"id,Number,omitempty"` + Key string `json:"key,omitempty"` + Name string `json:"name,omitempty"` + CreateDate *util.Timestamp `json:"createDate,omitempty"` +} + +type MetaInfraTypeEnum int + +const ( + MetaInfraTypeEnumZONE MetaInfraTypeEnum = iota + 1 + MetaInfraTypeEnumHOST + MetaInfraTypeEnumService +) + +var ( + metaInfraTypeEnumID = map[MetaInfraTypeEnum]string{ + MetaInfraTypeEnumZONE: "ZONE", + MetaInfraTypeEnumHOST: "HOST", + MetaInfraTypeEnumService: "SERVICE", + } + + metaInfraTypeEnumKey = map[string]MetaInfraTypeEnum{ + "ZONE": MetaInfraTypeEnumZONE, + "HOST": MetaInfraTypeEnumHOST, + "SERVICE": MetaInfraTypeEnumService, + } +) + +func (e MetaInfraTypeEnum) String() string { + return metaInfraTypeEnumID[e] +} + +func ToMetaInfraTypeEnum(v *MetaInfraType) MetaInfraTypeEnum { + return metaInfraTypeEnumKey[v.Key] +} + +func ToMetaInfraType(v MetaInfraTypeEnum) *MetaInfraType { + return &MetaInfraType{ + Key: metaInfraTypeEnumID[v], + } +} diff --git a/model/meta/MetaInputType.go b/model/meta/MetaInputType.go new file mode 100644 index 0000000..e2c4053 --- /dev/null +++ b/model/meta/MetaInputType.go @@ -0,0 +1,14 @@ +package meta + +import ( + "encoding/json" + + "git.loafle.net/overflow/commons-go/core/util" +) + +type MetaInputType struct { + ID json.Number `json:"id,Number,omitempty"` + Name string `json:"name,omitempty"` + Key string `json:"key,omitempty"` + CreateDate *util.Timestamp `json:"createDate,omitempty"` +} diff --git a/model/meta/MetaItemUnit.go b/model/meta/MetaItemUnit.go new file mode 100644 index 0000000..c334065 --- /dev/null +++ b/model/meta/MetaItemUnit.go @@ -0,0 +1,15 @@ +package meta + +import ( + "encoding/json" + + "git.loafle.net/overflow/commons-go/core/util" +) + +type MetaItemUnit struct { + ID json.Number `json:"id,Number,omitempty"` + Key string `json:"key,omitempty"` + Unit string `json:"unit,omitempty"` + Mark string `json:"mark,omitempty"` + CreateDate *util.Timestamp `json:"createDate,omitempty"` +} diff --git a/model/meta/MetaMemberStatus.go b/model/meta/MetaMemberStatus.go new file mode 100644 index 0000000..c524b90 --- /dev/null +++ b/model/meta/MetaMemberStatus.go @@ -0,0 +1,53 @@ +package meta + +import ( + "encoding/json" + + "git.loafle.net/overflow/commons-go/core/util" +) + +type MetaMemberStatus struct { + ID json.Number `json:"id,Number,omitempty"` + Name string `json:"name,omitempty"` + Key string `json:"key,omitempty"` + CreateDate *util.Timestamp `json:"createDate,omitempty"` +} + +type MetaMemberStatusEnum int + +const ( + MetaMemberStatusEnumNOAUTH MetaMemberStatusEnum = iota + 1 + MetaMemberStatusEnumNORMAL + MetaMemberStatusEnumDORMANCY + MetaMemberStatusEnumWITHDRAWAL +) + +var ( + metaMemberStatusEnumID = map[MetaMemberStatusEnum]string{ + MetaMemberStatusEnumNOAUTH: "NOAUTH", + MetaMemberStatusEnumNORMAL: "NORMAL", + MetaMemberStatusEnumDORMANCY: "DORMANCY", + MetaMemberStatusEnumWITHDRAWAL: "WITHDRAWAL", + } + + metaMemberStatusEnumKey = map[string]MetaMemberStatusEnum{ + "NOAUTH": MetaMemberStatusEnumNOAUTH, + "NORMAL": MetaMemberStatusEnumNORMAL, + "DORMANCY": MetaMemberStatusEnumDORMANCY, + "WITHDRAWAL": MetaMemberStatusEnumWITHDRAWAL, + } +) + +func (e MetaMemberStatusEnum) String() string { + return metaMemberStatusEnumID[e] +} + +func ToMetaMemberStatusEnum(v *MetaMemberStatus) MetaMemberStatusEnum { + return metaMemberStatusEnumKey[v.Key] +} + +func ToMetaMemberStatus(v MetaMemberStatusEnum) *MetaMemberStatus { + return &MetaMemberStatus{ + Key: metaMemberStatusEnumID[v], + } +} diff --git a/model/meta/MetaNoAuthProbeStatus.go b/model/meta/MetaNoAuthProbeStatus.go new file mode 100644 index 0000000..84713f7 --- /dev/null +++ b/model/meta/MetaNoAuthProbeStatus.go @@ -0,0 +1,50 @@ +package meta + +import ( + "encoding/json" + + "git.loafle.net/overflow/commons-go/core/util" +) + +type MetaNoAuthProbeStatus struct { + ID json.Number `json:"id,Number,omitempty"` + Key string `json:"key,omitempty"` + Name string `json:"name,omitempty"` + CreateDate *util.Timestamp `json:"createDate,omitempty"` +} + +type MetaNoAuthProbeStatusEnum int + +const ( + MetaNoAuthProbeStatusEnumACCEPT MetaNoAuthProbeStatusEnum = iota + 1 + MetaNoAuthProbeStatusEnumDENY + MetaNoAuthProbeStatusEnumPROCESSING +) + +var ( + metaNoAuthProbeStatusEnumID = map[MetaNoAuthProbeStatusEnum]string{ + MetaNoAuthProbeStatusEnumACCEPT: "ACCEPT", + MetaNoAuthProbeStatusEnumDENY: "DENY", + MetaNoAuthProbeStatusEnumPROCESSING: "PROCESSING", + } + + metaNoAuthProbeStatusEnumKey = map[string]MetaNoAuthProbeStatusEnum{ + "ACCEPT": MetaNoAuthProbeStatusEnumACCEPT, + "DENY": MetaNoAuthProbeStatusEnumDENY, + "PROCESSING": MetaNoAuthProbeStatusEnumPROCESSING, + } +) + +func (e MetaNoAuthProbeStatusEnum) String() string { + return metaNoAuthProbeStatusEnumID[e] +} + +func ToMetaNoAuthProbeStatusEnum(v *MetaNoAuthProbeStatus) MetaNoAuthProbeStatusEnum { + return metaNoAuthProbeStatusEnumKey[v.Key] +} + +func ToMetaNoAuthProbeStatus(v MetaNoAuthProbeStatusEnum) *MetaNoAuthProbeStatus { + return &MetaNoAuthProbeStatus{ + Key: metaNoAuthProbeStatusEnumID[v], + } +} diff --git a/model/meta/MetaPortType.go b/model/meta/MetaPortType.go new file mode 100644 index 0000000..ca7bb00 --- /dev/null +++ b/model/meta/MetaPortType.go @@ -0,0 +1,47 @@ +package meta + +import ( + "encoding/json" + + "git.loafle.net/overflow/commons-go/core/util" +) + +type MetaPortType struct { + ID json.Number `json:"id,Number,omitempty"` + Name string `json:"name,omitempty"` + Key string `json:"key,omitempty"` + CreateDate *util.Timestamp `json:"createDate,omitempty"` +} + +type MetaPortTypeEnum int + +const ( + MetaPortTypeEnumTCP MetaPortTypeEnum = iota + 1 + MetaPortTypeEnumUDP +) + +var ( + metaPortTypeEnumID = map[MetaPortTypeEnum]string{ + MetaPortTypeEnumTCP: "TCP", + MetaPortTypeEnumUDP: "UDP", + } + + metaPortTypeEnumKey = map[string]MetaPortTypeEnum{ + "TCP": MetaPortTypeEnumTCP, + "UDP": MetaPortTypeEnumUDP, + } +) + +func (e MetaPortTypeEnum) String() string { + return metaPortTypeEnumID[e] +} + +func ToMetaPortTypeEnum(v *MetaPortType) MetaPortTypeEnum { + return metaPortTypeEnumKey[v.Key] +} + +func ToMetaPortType(v MetaPortTypeEnum) *MetaPortType { + return &MetaPortType{ + Key: metaPortTypeEnumID[v], + } +} diff --git a/model/meta/MetaProbeStatus.go b/model/meta/MetaProbeStatus.go new file mode 100644 index 0000000..51c304a --- /dev/null +++ b/model/meta/MetaProbeStatus.go @@ -0,0 +1,47 @@ +package meta + +import ( + "encoding/json" + + "git.loafle.net/overflow/commons-go/core/util" +) + +type MetaProbeStatus struct { + ID json.Number `json:"id,Number,omitempty"` + Name string `json:"name,omitempty"` + Key string `json:"key,omitempty"` + CreateDate *util.Timestamp `json:"createDate,omitempty"` +} + +type MetaProbeStatusEnum int + +const ( + MetaProbeStatusEnumINITIAL MetaProbeStatusEnum = iota + 1 + MetaProbeStatusEnumNORMAL +) + +var ( + metaProbeStatusEnumID = map[MetaProbeStatusEnum]string{ + MetaProbeStatusEnumINITIAL: "INITIAL", + MetaProbeStatusEnumNORMAL: "NORMAL", + } + + metaProbeStatusEnumKey = map[string]MetaProbeStatusEnum{ + "INITIAL": MetaProbeStatusEnumINITIAL, + "NORMAL": MetaProbeStatusEnumNORMAL, + } +) + +func (e MetaProbeStatusEnum) String() string { + return metaProbeStatusEnumID[e] +} + +func ToMetaProbeStatusEnum(v *MetaProbeStatus) MetaProbeStatusEnum { + return metaProbeStatusEnumKey[v.Key] +} + +func ToMetaProbeStatus(v MetaProbeStatusEnum) *MetaProbeStatus { + return &MetaProbeStatus{ + Key: metaProbeStatusEnumID[v], + } +} diff --git a/model/meta/MetaSensorDisplayItem.go b/model/meta/MetaSensorDisplayItem.go new file mode 100644 index 0000000..9b05c3b --- /dev/null +++ b/model/meta/MetaSensorDisplayItem.go @@ -0,0 +1,18 @@ +package meta + +import ( + "encoding/json" + + "git.loafle.net/overflow/commons-go/core/util" +) + +type MetaSensorDisplayItem struct { + ID json.Number `json:"id,Number,omitempty"` + Key string `json:"key,omitempty"` + Name string `json:"name,omitempty"` + IsDefault bool `json:"isDefault,omitempty"` + MetaCrawler *MetaCrawler `json:"metaCrawler,omitempty"` + MetaSensorItemUnit *MetaSensorItemUnit `json:"metaSensorItemUnit,omitempty"` + MetaSensorItemType *MetaSensorItemType `json:"metaSensorItemType,omitempty"` + CreateDate *util.Timestamp `json:"createDate,omitempty"` +} diff --git a/model/meta/MetaSensorItem.go b/model/meta/MetaSensorItem.go new file mode 100644 index 0000000..a05a93e --- /dev/null +++ b/model/meta/MetaSensorItem.go @@ -0,0 +1,14 @@ +package meta + +import ( + "encoding/json" + + "git.loafle.net/overflow/commons-go/core/util" +) + +type MetaSensorItem struct { + ID json.Number `json:"id,Number,omitempty"` + Key string `json:"key,omitempty"` + Name string `json:"name,omitempty"` + CreateDate *util.Timestamp `json:"createDate,omitempty"` +} diff --git a/model/meta/MetaSensorItemKey.go b/model/meta/MetaSensorItemKey.go new file mode 100644 index 0000000..5f3d3e2 --- /dev/null +++ b/model/meta/MetaSensorItemKey.go @@ -0,0 +1,19 @@ +package meta + +import ( + "encoding/json" + + "git.loafle.net/overflow/commons-go/core/util" +) + +type MetaSensorItemKey struct { + ID json.Number `json:"id,Number,omitempty"` + Key string `json:"key,omitempty"` + Name string `json:"name,omitempty"` + Froms string `json:"froms,omitempty"` + Option string `json:"option,omitempty"` + MetaSensorItem *MetaSensorItem `json:"metaSensorItem,omitempty"` + MetaCrawler *MetaCrawler `json:"metaCrawler,omitempty"` + MetaSensorItemUnit *MetaSensorItemUnit `json:"metaSensorItemUnit,omitempty"` + CreateDate *util.Timestamp `json:"createDate,omitempty"` +} diff --git a/model/meta/MetaSensorItemType.go b/model/meta/MetaSensorItemType.go new file mode 100644 index 0000000..b7ee5bf --- /dev/null +++ b/model/meta/MetaSensorItemType.go @@ -0,0 +1,14 @@ +package meta + +import ( + "encoding/json" + + "git.loafle.net/overflow/commons-go/core/util" +) + +type MetaSensorItemType struct { + ID json.Number `json:"id,Number,omitempty"` + Name string `json:"name,omitempty"` + Key string `json:"key,omitempty"` + CreateDate *util.Timestamp `json:"createDate,omitempty"` +} diff --git a/model/meta/MetaSensorItemUnit.go b/model/meta/MetaSensorItemUnit.go new file mode 100644 index 0000000..a14d001 --- /dev/null +++ b/model/meta/MetaSensorItemUnit.go @@ -0,0 +1,15 @@ +package meta + +import ( + "encoding/json" + + "git.loafle.net/overflow/commons-go/core/util" +) + +type MetaSensorItemUnit struct { + ID json.Number `json:"id,Number,omitempty"` + Key string `json:"key,omitempty"` + Unit string `json:"unit,omitempty"` + Mark string `json:"mark,omitempty"` + CreateDate *util.Timestamp `json:"createDate,omitempty"` +} diff --git a/model/meta/MetaSensorStatus.go b/model/meta/MetaSensorStatus.go new file mode 100644 index 0000000..3e25bca --- /dev/null +++ b/model/meta/MetaSensorStatus.go @@ -0,0 +1,14 @@ +package meta + +import ( + "encoding/json" + + "git.loafle.net/overflow/commons-go/core/util" +) + +type MetaSensorStatus struct { + ID json.Number `json:"id,Number,omitempty"` + Key string `json:"key,omitempty"` + Name string `json:"name,omitempty"` + CreateDate *util.Timestamp `json:"createDate,omitempty"` +} diff --git a/model/meta/MetaTargetHostType.go b/model/meta/MetaTargetHostType.go new file mode 100644 index 0000000..974a6aa --- /dev/null +++ b/model/meta/MetaTargetHostType.go @@ -0,0 +1,36 @@ +package meta + +type MetaTargetHostType struct { + MetaTargetType +} + +type MetaTargetHostTypeEnum int + +const ( + MetaTargetHostTypeEnumUNKNOWN MetaTargetHostTypeEnum = iota + 1 +) + +var ( + metaTargetHostTypeEnumID = map[MetaTargetHostTypeEnum]string{ + MetaTargetHostTypeEnumUNKNOWN: "UNKNOWN", + } + + metaTargetHostTypeEnumKey = map[string]MetaTargetHostTypeEnum{ + "UNKNOWN": MetaTargetHostTypeEnumUNKNOWN, + } +) + +func (e MetaTargetHostTypeEnum) String() string { + return metaTargetHostTypeEnumID[e] +} + +func ToMetaTargetHostTypeEnum(v *MetaTargetHostType) MetaTargetHostTypeEnum { + return metaTargetHostTypeEnumKey[v.Key] +} + +func ToMetaTargetHostType(v MetaTargetHostTypeEnum) *MetaTargetHostType { + m := &MetaTargetHostType{} + m.Key = metaTargetHostTypeEnumID[v] + + return m +} diff --git a/model/meta/MetaTargetServiceType.go b/model/meta/MetaTargetServiceType.go new file mode 100644 index 0000000..6276079 --- /dev/null +++ b/model/meta/MetaTargetServiceType.go @@ -0,0 +1,36 @@ +package meta + +type MetaTargetServiceType struct { + MetaTargetType +} + +type MetaTargetServiceTypeEnum int + +const ( + MetaTargetServiceTypeEnumUNKNOWN MetaTargetServiceTypeEnum = iota + 1 +) + +var ( + metaTargetServiceTypeEnumID = map[MetaTargetServiceTypeEnum]string{ + MetaTargetServiceTypeEnumUNKNOWN: "UNKNOWN", + } + + metaTargetServiceTypeEnumKey = map[string]MetaTargetServiceTypeEnum{ + "UNKNOWN": MetaTargetServiceTypeEnumUNKNOWN, + } +) + +func (e MetaTargetServiceTypeEnum) String() string { + return metaTargetServiceTypeEnumID[e] +} + +func ToMetaTargetServiceTypeEnum(v *MetaTargetServiceType) MetaTargetServiceTypeEnum { + return metaTargetServiceTypeEnumKey[v.Key] +} + +func ToMetaTargetServiceType(v MetaTargetServiceTypeEnum) *MetaTargetServiceType { + m := &MetaTargetServiceType{} + m.Key = metaTargetServiceTypeEnumID[v] + + return m +} diff --git a/model/meta/MetaTargetType.go b/model/meta/MetaTargetType.go new file mode 100644 index 0000000..42c43c0 --- /dev/null +++ b/model/meta/MetaTargetType.go @@ -0,0 +1,16 @@ +package meta + +import ( + "encoding/json" + + "git.loafle.net/overflow/commons-go/core/util" +) + +type MetaTargetType struct { + ID json.Number `json:"id,Number,omitempty"` + MetaInfraType *MetaInfraType `json:"metaInfraType,omitempty"` + Key string `json:"key,omitempty"` + Name string `json:"name,omitempty"` + IsSupported bool `json:"isSupported,omitempty"` + CreateDate *util.Timestamp `json:"createDate,omitempty"` +} diff --git a/model/meta/MetaTargetZoneType.go b/model/meta/MetaTargetZoneType.go new file mode 100644 index 0000000..77af1ba --- /dev/null +++ b/model/meta/MetaTargetZoneType.go @@ -0,0 +1,39 @@ +package meta + +type MetaTargetZoneType struct { + MetaTargetType +} + +type MetaTargetZoneTypeEnum int + +const ( + MetaTargetZoneTypeEnumUNKNOWN MetaTargetZoneTypeEnum = iota + 1 + MetaTargetZoneTypeEnumZONE +) + +var ( + metaTargetZoneTypeEnumID = map[MetaTargetZoneTypeEnum]string{ + MetaTargetZoneTypeEnumUNKNOWN: "UNKNOWN", + MetaTargetZoneTypeEnumZONE: "ZONE", + } + + metaTargetZoneTypeEnumKey = map[string]MetaTargetZoneTypeEnum{ + "UNKNOWN": MetaTargetZoneTypeEnumUNKNOWN, + "ZONE": MetaTargetZoneTypeEnumZONE, + } +) + +func (e MetaTargetZoneTypeEnum) String() string { + return metaTargetZoneTypeEnumID[e] +} + +func ToMetaTargetZoneTypeEnum(v *MetaTargetZoneType) MetaTargetZoneTypeEnum { + return metaTargetZoneTypeEnumKey[v.Key] +} + +func ToMetaTargetZoneType(v MetaTargetZoneTypeEnum) *MetaTargetZoneType { + m := &MetaTargetZoneType{} + m.Key = metaTargetZoneTypeEnumID[v] + + return m +}