This commit is contained in:
geek 2018-06-12 18:18:11 +09:00
parent b65ef6017d
commit e0caf04f92
45 changed files with 566 additions and 222 deletions

View File

@ -1,19 +1,24 @@
package discovery
import (
"encoding/json"
"git.loafle.net/overflow/commons-go/core/util"
)
import "git.loafle.net/overflow/commons-go/core/util"
type Host struct {
Zone *Zone `json:"zone"`
//Zone *Zone `json:"zone"`
//
//ID json.Number `json:"id,Number,omitempty"`
//IPV4 string `json:"ipv4,omitempty"`
//IPV6 string `json:"ipv6,omitempty"`
//Mac string `json:"mac,omitempty"`
//OS string `json:"os,omitempty"`
//
//DiscoveredDate *util.Timestamp `json:"discoveredDate,omitempty"`
ID json.Number `json:"id,Number,omitempty"`
IPV4 string `json:"ipv4,omitempty"`
IPV6 string `json:"ipv6,omitempty"`
Mac string `json:"mac,omitempty"`
OS string `json:"os,omitempty"`
MetaIPTypeKey string `json:"metaIpTypeKey, 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"`
}

View File

@ -3,20 +3,28 @@ package discovery
import (
"encoding/json"
"github.com/google/gopacket"
"git.loafle.net/overflow/commons-go/core/constants"
"git.loafle.net/overflow/commons-go/core/util"
"github.com/google/gopacket"
)
type Port struct {
MetaPortTypeKey string `json:"metaPortTypeKey,omitempty"`
PortNumber json.Number `json:"portNumber, omitempty"`
DiscoveredDate *util.Timestamp `json:"discoveredDate, omitempty"`
Host *Host `json:"host,omitempty"`
ID json.Number `json:"id,Number,omitempty"`
PortType constants.PortType `json:"portType,omitempty"`
PortNumber json.Number `json:"portNumber,omitempty"`
DiscoveredDate *util.Timestamp `json:"discoveredDate,omitempty"`
ServiceList []Service `json:"serviceList, omitempty"`
UDPLayer gopacket.Layer `json:"-"`
//Host *Host `json:"host,omitempty"`
//
//ID json.Number `json:"id,Number,omitempty"`
//PortType constants.PortType `json:"portType,omitempty"`
//PortNumber json.Number `json:"portNumber,omitempty"`
//
//DiscoveredDate *util.Timestamp `json:"discoveredDate,omitempty"`
//
//UDPLayer gopacket.Layer `json:"-"`
}

View File

@ -1,18 +1,21 @@
package discovery
import (
"encoding/json"
"git.loafle.net/overflow/commons-go/core/constants"
"git.loafle.net/overflow/commons-go/core/util"
)
import "git.loafle.net/overflow/commons-go/core/util"
type Service struct {
Port *Port `json:"port,omitempty"`
ID json.Number `json:"id,Number,omitempty"`
CryptoType constants.CryptoType `json:"cryptoType,omitempty"`
ServiceName string `json:"serviceName,omitempty"`
MetaCryptoTypeKey string `json:"metaCryptoTypeKey, omitempty"`
Name string `json:"name, omitempty"`
Port *Port `json:"port, omitempty"`
DiscoveredDate *util.Timestamp `json:"discoveredDate,omitempty"`
//Port *Port `json:"port,omitempty"`
//
//ID json.Number `json:"id,Number,omitempty"`
//CryptoType constants.CryptoType `json:"cryptoType,omitempty"`
//ServiceName string `json:"serviceName,omitempty"`
//
//DiscoveredDate *util.Timestamp `json:"discoveredDate,omitempty"`
}

View File

@ -1,19 +1,27 @@
package discovery
import (
"encoding/json"
"sync"
"git.loafle.net/overflow/commons-go/core/util"
"sync"
)
type Zone struct {
ID json.Number `json:"id,Number,omitempty"`
Network string `json:"network,omitempty"`
IPV4 string `json:"ipv4,omitempty"`
IPV6 string `json:"ipv6,omitempty"`
Iface string `json:"iface,omitempty"`
Mac string `json:"mac,omitempty"`
//ID json.Number `json:"id,Number,omitempty"`
//Network string `json:"network,omitempty"`
//IPV4 string `json:"ipv4,omitempty"`
//IPV6 string `json:"ipv6,omitempty"`
//Iface string `json:"iface,omitempty"`
//Mac string `json:"mac,omitempty"`
//
//DiscoveredDate *util.Timestamp `json:"discoveredDate,omitempty"`
//
//mtx sync.RWMutex `json:"-"`
Network string `json:"network, omitempty"`
Iface string `json:"iface, omitempty"`
MetaIPTypeKey string `json:"metaIPTypeKey, omitempty"`
Address string `json:"address, omitempty"`
Mac string `json:"mac, omitempty"`
DiscoveredDate *util.Timestamp `json:"discoveredDate,omitempty"`

View File

@ -6,7 +6,6 @@ import (
"git.loafle.net/overflow/commons-go/core/util"
"git.loafle.net/overflow/commons-go/model/meta"
"git.loafle.net/overflow/commons-go/model/probe"
"git.loafle.net/overflow/commons-go/model/target"
)
type Infra struct {
@ -14,5 +13,5 @@ type Infra struct {
MetaInfraType *meta.MetaInfraType `json:"metaInfraType,omitempty"`
CreateDate *util.Timestamp `json:"createDate,omitempty"`
Probe *probe.Probe `json:"probe,omitempty"`
Target *target.Target `json:"target,omitempty"`
//Target *target.Target `json:"target,omitempty"`
}

View File

@ -1,13 +1,17 @@
package infra
import (
"git.loafle.net/overflow/commons-go/core/util"
"git.loafle.net/overflow/commons-go/model/meta"
)
type InfraHost struct {
Infra
InfraOS *InfraOS `json:"infraOS,omitempty"`
IP string `json:"ip,omitempty"`
Mac string `json:"mac,omitempty"`
CreateDate *util.Timestamp `json:"createDate,omitempty"`
InfraZone *InfraZone `json:"infraZone,omitempty"`
MetaTargetHostType *meta.MetaTargetHostType `json:"metaTargetHostType,omitempty"`
InfraHostMachine *InfraHostMachine `json:"infraHostMachine,omitempty"`
InfraHostOS *InfraHostOS `json:"infraHostOS,omitempty"`
InfraHostIPs []InfraHostIP `json:"infraHostIPs,omitempty"`
infraHostPorts []InfraHostPort `json:"infraHostPorts,omitempty"`
infraHostApplications []InfraHostApplication `json:"infraHostApplications, omitempty"`
infraHostDaemons []InfraHostDaemon `json:"infraHostDaemons, omitempty"`
}

View File

@ -0,0 +1,14 @@
package infra
import (
"git.loafle.net/overflow/commons-go/core/util"
"encoding/json"
)
type InfraHostApplication struct {
ID json.Number `json:"id,Number,omitempty"`
Name string `json:"name, omitempty"`
InfraHost *InfraHost `json:"infraHost, omitempty"`
CreateDate *util.Timestamp `json:"createDate,omitempty"`
}

View File

@ -0,0 +1,14 @@
package infra
import (
"git.loafle.net/overflow/commons-go/core/util"
"encoding/json"
)
type InfraHostDaemon struct {
ID json.Number `json:"id,Number,omitempty"`
Name string `json:"name, omitempty"`
InfraHost *InfraHost `json:"infraHost, omitempty"`
CreateDate *util.Timestamp `json:"createDate,omitempty"`
}

View File

@ -0,0 +1,18 @@
package infra
import (
"encoding/json"
"git.loafle.net/overflow/commons-go/core/util"
"git.loafle.net/overflow/commons-go/model/meta"
)
type InfraHostIP struct {
ID json.Number `json:"id,Number, omitempty"`
InfraHost *InfraHost `json:"infraHost, omitempty"`
MetaIPType *meta.MetaIPType `json:"metaIPType, omitempty"`
Address string `json:"address, omitempty"`
Mac string `json:"mac, omitempty"`
Iface string `json:"iface, omitempty"`
Gateway string `json:"gateway, omitempty"`
CreateDate *util.Timestamp `json:"createDate, omitempty"`
}

View File

@ -0,0 +1,13 @@
package infra
import (
"git.loafle.net/overflow/commons-go/core/util"
"encoding/json"
)
type InfraHostMachine struct {
ID json.Number `json:"id,Number,omitempty"`
InfraHost *InfraHost `json:"infraHost, omitempty"`
Meta string `json:"meta,omitempty"`
CreateDate *util.Timestamp `json:"createDate,omitempty"`
}

View File

@ -0,0 +1,21 @@
package infra
import (
"git.loafle.net/overflow/commons-go/core/util"
"encoding/json"
)
type InfraHostOS struct {
ID json.Number `json:"id,Number, omitempty"`
InfraHost *InfraHost `json:"infraHost, omitempty"`
Name string `json:"name, omitempty"`
OS string `json:"os, omitempty"`
Platform string `json:"platform, omitempty"`
PlatformFamily string `json:"platformFamily, omitempty"`
PlatformVersion string `json:"platformVersion, omitempty"`
KernelVersion string `json:"kernelVersion, omitempty"`
HostID string `json:"hostID, omitempty"`
Meta string `json:"meta, omitempty"`
CreateDate *util.Timestamp `json:"createDate, omitempty"`
}

View File

@ -0,0 +1,15 @@
package infra
import (
"encoding/json"
"git.loafle.net/overflow/commons-go/core/util"
"git.loafle.net/overflow/commons-go/model/meta"
)
type InfraHostPort struct {
ID json.Number `json:"id,Number,omitempty"`
InfraHost *InfraHost `json:"infraHost,omitempty"`
MetaPortType *meta.MetaPortType `json:"metaPortType, omitempty"`
Port json.Number `json:"port,Number,omitempty"`
CreateDate *util.Timestamp `json:"createDate,omitempty"`
}

View File

@ -1,9 +0,0 @@
package infra
import "git.loafle.net/overflow/commons-go/core/util"
type InfraMachine struct {
Infra
Meta string `json:"meta,omitempty"`
CreateDate *util.Timestamp `json:"createDate,omitempty"`
}

View File

@ -1,14 +0,0 @@
package infra
import (
"git.loafle.net/overflow/commons-go/core/util"
"git.loafle.net/overflow/commons-go/model/meta"
)
type InfraOS struct {
Infra
InfraMachine *InfraMachine `json:"infraMachine,omitempty"`
Meta string `json:"meta,omitempty"`
CreateDate *util.Timestamp `json:"createDate,omitempty"`
MetaInfraVendor *meta.MetaInfraVendor `json:"metaInfraVendor,omitempty"`
}

View File

@ -1,10 +0,0 @@
package infra
import "git.loafle.net/overflow/commons-go/core/util"
type InfraOSApplication struct {
Infra
InfraOS *InfraOS `json:"infraOS,omitempty"`
Name string `json:"name,omitempty"`
CreateDate *util.Timestamp `json:"createDate,omitempty"`
}

View File

@ -1,12 +0,0 @@
package infra
import (
"git.loafle.net/overflow/commons-go/core/util"
)
type InfraOSDaemon struct {
Infra
InfraOS *InfraOS `json:"infraOS,omitempty"`
Name string `json:"name,omitempty"`
CreateDate *util.Timestamp `json:"createDate,omitempty"`
}

View File

@ -1,18 +0,0 @@
package infra
import (
"encoding/json"
"git.loafle.net/overflow/commons-go/core/util"
"git.loafle.net/overflow/commons-go/model/meta"
)
type InfraOSPort struct {
Infra
InfraOS *InfraOS `json:"infraOS,omitempty"`
CreateDate *util.Timestamp `json:"createDate,omitempty"`
Port json.Number `json:"port,omitempty"`
PortType string `json:"portType,omitempty"`
MetaInfraVendor *meta.MetaInfraVendor `json:"metaInfraVendor,omitempty"`
TLSType bool `json:"tlsType,omitempty"`
}

View File

@ -0,0 +1,11 @@
package infra
import "git.loafle.net/overflow/commons-go/model/meta"
type InfraService struct {
Infra
MetaTargetServiceType *meta.MetaTargetServiceType `json:"metaTargetServiceType, omitempty"`
InfraHostIP *InfraHostIP `json:"infraHostIP, omitempty"`
InfraHostPort *InfraHostPort `json:"infraHostPort, omitempty"`
MetaCryptoType *meta.MetaCryptoType `json:"metaCryptoType, omitempty"`
}

View File

@ -1,18 +0,0 @@
package infra
import (
"encoding/json"
"git.loafle.net/overflow/commons-go/core/util"
"git.loafle.net/overflow/commons-go/model/meta"
)
type InfraServiceApplication struct {
Infra
InfraHost *InfraHost `json:"infraHost,omitempty"`
PortType string `json:"portType,omitempty"`
Port json.Number `json:"port,omitempty"`
MetaInfraVendor *meta.MetaInfraVendor `json:"metaInfraVendor,omitempty"`
CreateDate *util.Timestamp `json:"createDate,omitempty"`
TLSType bool `json:"tlsType,omitempty"`
}

13
model/infra/InfraZone.go Normal file
View File

@ -0,0 +1,13 @@
package infra
import "git.loafle.net/overflow/commons-go/model/meta"
type InfraZone struct {
Infra
MetaTargetZoneType *meta.MetaTargetZoneType `json:"metaTargetZoneType, omitempty"`
MetaIPType *meta.MetaIPType `json:"metaIPType, omitempty"`
Network string `json:"network, omitempty"`
Iface string `json:"iface, omitempty"`
Address string `json:"address, omitempty"`
Mac string `json:"mac, omitempty"`
}

View File

@ -1,14 +0,0 @@
package meta
import (
"encoding/json"
"git.loafle.net/overflow/commons-go/core/util"
)
type MetaContainer struct {
ID json.Number `json:"id,Number,omitempty"`
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
CreateDate *util.Timestamp `json:"createDate,omitempty"`
}

View File

@ -9,7 +9,8 @@ import (
type MetaCrawler struct {
ID json.Number `json:"id,Number,omitempty"`
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
Key string `json:"key,omitempty"`
IsDefault bool `json:"isDefault, omitempty"`
CreateDate *util.Timestamp `json:"createDate,omitempty"`
MetaContainer *MetaContainer `json:"metaContainer,omitempty"`
}

View File

@ -0,0 +1,13 @@
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"`
}

View File

@ -9,5 +9,6 @@ import (
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"`
}

43
model/meta/MetaIPType.go Normal file
View File

@ -0,0 +1,43 @@
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 = 1
MetaIPTypeEnumV6 MetaIPTypeEnum = 2
)
var (
metaIPTypeEnumID = map[MetaIPTypeEnum]string {
MetaIPTypeEnumV4: "V4",
MetaIPTypeEnumV6: "V6",
}
metaIPTypeEnumKey = map[string]MetaIPTypeEnum{
"V4": MetaIPTypeEnumV4,
"V6": MetaIPTypeEnumV6,
}
)
func ToMetaIPTypeEnum(v *MetaIPType) MetaIPTypeEnum {
return metaIPTypeEnumKey[v.Key]
}
func ToMetaIPType(v MetaIPTypeEnum) *MetaIPType {
return &MetaIPType{
Key: metaIPTypeEnumID[v],
}
}

View File

@ -8,6 +8,39 @@ import (
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 = 1
MetaInfraTypeEnumHOST MetaInfraTypeEnum = 2
MetaInfraTypeEnumService MetaInfraTypeEnum = 3
)
var (
metaInfraTypeEnumID = map[MetaInfraTypeEnum]string {
MetaInfraTypeEnumZONE: "ZONE",
MetaInfraTypeEnumHOST: "HOST",
MetaInfraTypeEnumService: "SERVICE",
}
metaInfraTypeEnumKey = map[string]MetaInfraTypeEnum{
"ZONE": MetaInfraTypeEnumZONE,
"HOST": MetaInfraTypeEnumHOST,
"SERVICE": MetaInfraTypeEnumService,
}
)
func ToMetaInfraTypeEnum(v *MetaInfraType) MetaInfraTypeEnum {
return metaInfraTypeEnumKey[v.Key]
}
func ToMetaInfraType(v MetaInfraTypeEnum) *MetaInfraType {
return &MetaInfraType{
Key: metaInfraTypeEnumID[v],
}
}

View File

@ -1,8 +1,48 @@
package meta
import "encoding/json"
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"`
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 = 1
MetaMemberStatusEnumNORMAL MetaMemberStatusEnum = 2
MetaMemberStatusEnumDORMANCY MetaMemberStatusEnum = 3
MetaMemberStatusEnumWITHDRAWAL MetaMemberStatusEnum = 4
)
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 ToMetaMemberStatusEnum(v *MetaMemberStatus) MetaMemberStatusEnum {
return metaMemberStatusEnumKey[v.Key]
}
func ToMetaMemberStatus(v MetaMemberStatusEnum) *MetaMemberStatus {
return &MetaMemberStatus{
Key: metaMemberStatusEnumID[v],
}
}

View File

@ -2,63 +2,44 @@ package meta
import (
"encoding/json"
"fmt"
"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 NoAuthProbeStatusType int
type NoAuthProbeStatusEnum int
const (
NoAuthProbeStatusTypeACCEPT NoAuthProbeStatusType = 1 + iota
NoAuthProbeStatusTypeDENY
NoAuthProbeStatusTypePROCESS
NoAuthProbeStatusEnumACCEPT NoAuthProbeStatusEnum = 1
NoAuthProbeStatusEnumDENY NoAuthProbeStatusEnum = 2
NoAuthProbeStatusEnumPROCESSING NoAuthProbeStatusEnum = 3
)
var (
noAuthProbeStatusTypeID = map[NoAuthProbeStatusType]string{
NoAuthProbeStatusTypeACCEPT: "ACCEPT",
NoAuthProbeStatusTypeDENY: "DENY",
NoAuthProbeStatusTypePROCESS: "PROCESS",
noAuthProbeStatusEnumID = map[NoAuthProbeStatusEnum]string{
NoAuthProbeStatusEnumACCEPT: "ACCEPT",
NoAuthProbeStatusEnumDENY: "DENY",
NoAuthProbeStatusEnumPROCESSING:"PROCESSING",
}
noAuthProbeStatusTypeName = map[string]NoAuthProbeStatusType{
"ACCEPT": NoAuthProbeStatusTypeACCEPT,
"DENY": NoAuthProbeStatusTypeDENY,
"PROCESS": NoAuthProbeStatusTypePROCESS,
noAuthProbeStatusEnumKey = map[string]NoAuthProbeStatusEnum{
"ACCEPT": NoAuthProbeStatusEnumACCEPT,
"DENY": NoAuthProbeStatusEnumDENY,
"PROCESSING": NoAuthProbeStatusEnumPROCESSING,
}
)
func ToNoAuthProbeStatusType(v string) NoAuthProbeStatusType {
return noAuthProbeStatusTypeName[v]
func ToNoAuthProbeStatusEnum(v *MetaNoAuthProbeStatus) NoAuthProbeStatusEnum {
return noAuthProbeStatusEnumKey[v.Key]
}
func (ct NoAuthProbeStatusType) String() string {
return noAuthProbeStatusTypeID[ct]
}
func (ct NoAuthProbeStatusType) MarshalJSON() ([]byte, error) {
value, ok := noAuthProbeStatusTypeID[ct]
if !ok {
return nil, fmt.Errorf("Invalid EnumType[%s] value", ct)
func ToMetaNoAuthProbeStatus(v NoAuthProbeStatusEnum) *MetaNoAuthProbeStatus {
return &MetaNoAuthProbeStatus{
Key: noAuthProbeStatusEnumID[v],
}
return json.Marshal(value)
}
func (ct NoAuthProbeStatusType) UnmarshalJSON(b []byte) error {
var s string
err := json.Unmarshal(b, &s)
if err != nil {
return err
}
value, ok := noAuthProbeStatusTypeName[s]
if !ok {
return fmt.Errorf("Invalid EnumType[%s] value", s)
}
ct = value
return nil
}

View File

@ -0,0 +1,13 @@
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"`
}

View File

@ -1,8 +1,43 @@
package meta
import "encoding/json"
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 = 1
MetaProbeStatusEnumNORMAL MetaProbeStatusEnum = 2
)
var (
metaProbeStatusEnumID = map[MetaProbeStatusEnum]string {
MetaProbeStatusEnumINITIAL: "INITIAL",
MetaProbeStatusEnumNORMAL: "NORMAL",
}
metaProbeStatusEnumKey = map[string]MetaProbeStatusEnum{
"INITIAL": MetaProbeStatusEnumINITIAL,
"NORMAL": MetaProbeStatusEnumNORMAL,
}
)
func ToMetaProbeStatusEnum(v *MetaProbeStatus) MetaProbeStatusEnum {
return metaProbeStatusEnumKey[v.Key]
}
func ToMetaProbeStatus(v MetaProbeStatusEnum) *MetaProbeStatus {
return &MetaProbeStatus{
Key: metaProbeStatusEnumID[v],
}
}

View File

@ -8,9 +8,11 @@ import (
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"`
CreateDate *util.Timestamp `json:"createDate,omitempty"`
MetaSensorItemType *MetaSensorItemType `json:"metaSensorItemType,omitempty"`
CreateDate *util.Timestamp `json:"createDate,omitempty"`
}

View File

@ -8,7 +8,6 @@ import (
type MetaSensorItem struct {
ID json.Number `json:"id,Number,omitempty"`
MetaSensorItemType *MetaSensorItemType `json:"metaSensorItemType,omitempty"`
Key string `json:"key,omitempty"`
Name string `json:"name,omitempty"`
CreateDate *util.Timestamp `json:"createDate,omitempty"`

View File

@ -8,11 +8,12 @@ import (
type MetaSensorItemKey struct {
ID json.Number `json:"id,Number,omitempty"`
MetaSensorItem *MetaSensorItem `json:"metaSensorItem,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"`
CreateDate *util.Timestamp `json:"createDate,omitempty"`
MetaSensorItemUnit *MetaSensorItemUnit `json:"metaSensorItemUnit,omitempty"`
CreateDate *util.Timestamp `json:"createDate,omitempty"`
}

View File

@ -9,6 +9,6 @@ import (
type MetaSensorItemType struct {
ID json.Number `json:"id,Number,omitempty"`
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
Key string `json:"key,omitempty"`
CreateDate *util.Timestamp `json:"createDate,omitempty"`
}

View File

@ -8,7 +8,8 @@ import (
type MetaSensorItemUnit struct {
ID json.Number `json:"id,Number,omitempty"`
Key string `json:"key, omitempty"`
Unit string `json:"unit,omitempty"`
CreateDate *util.Timestamp `json:"createDate,omitempty"`
Mark string `json:"mark,omitempty"`
CreateDate *util.Timestamp `json:"createDate,omitempty"`
}

View File

@ -1,8 +1,13 @@
package meta
import "encoding/json"
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"`
}

View File

@ -0,0 +1,33 @@
package meta
type MetaTargetHostType struct {
MetaTargetType
}
type MetaTargetHostTypeEnum int
const (
MetaTargetHostTypeEnumUNKNOWN MetaTargetHostTypeEnum = 100
)
var (
metaTargetHostTypeEnumID = map[MetaTargetHostTypeEnum]string{
MetaTargetHostTypeEnumUNKNOWN: "UNKNOWN",
}
metaTargetHostTypeEnumKey = map[string]MetaTargetHostTypeEnum{
"UNKNOWN": MetaTargetHostTypeEnumUNKNOWN,
}
)
func ToMetaTargetHostTypeEnum(v *MetaTargetHostType) MetaTargetHostTypeEnum {
return metaTargetHostTypeEnumKey[v.Key]
}
func ToMetaTargetHostType(v MetaTargetHostTypeEnum) *MetaTargetHostType {
m := &MetaTargetHostType {
}
m.Key = metaTargetHostTypeEnumID[v]
return m
}

View File

@ -0,0 +1,33 @@
package meta
type MetaTargetServiceType struct {
MetaTargetType
}
type MetaTargetServiceTypeEnum int
const (
MetaTargetServiceTypeEnumUNKNOWN MetaTargetServiceTypeEnum = 1000
)
var (
metaTargetServiceTypeEnumID = map[MetaTargetServiceTypeEnum]string{
MetaTargetServiceTypeEnumUNKNOWN: "UNKNOWN",
}
metaTargetServiceTypeEnumKey = map[string]MetaTargetServiceTypeEnum{
"UNKNOWN": MetaTargetServiceTypeEnumUNKNOWN,
}
)
func ToMetaTargetServiceTypeEnum(v *MetaTargetServiceType) MetaTargetServiceTypeEnum {
return metaTargetServiceTypeEnumKey[v.Key]
}
func ToMetaTargetServiceType(v MetaTargetServiceTypeEnum) *MetaTargetServiceType {
m := &MetaTargetServiceType {
}
m.Key = metaTargetServiceTypeEnumID[v]
return m
}

View File

@ -0,0 +1,17 @@
package meta
import (
"encoding/json"
"git.loafle.net/overflow/commons-go/core/util"
"git.loafle.net/overflow_backup_2018_0455/overflow_service/proxy/meta"
)
type MetaTargetType struct {
ID json.Number `json:"id, Number, omitempty"`
MetaInfraType *meta.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"`
}

View File

@ -0,0 +1,35 @@
package meta
type MetaTargetZoneType struct {
MetaTargetType
}
type MetaTargetZoneTypeEnum int
const (
MetaTargetZoneTypeEnumUNKNOWN MetaTargetZoneTypeEnum = 1
MetaTargetZoneTypeEnumZONE MetaTargetZoneTypeEnum = 2
)
var (
metaTargetZoneTypeEnumID = map[MetaTargetZoneTypeEnum]string{
MetaTargetZoneTypeEnumUNKNOWN: "UNKNOWN",
MetaTargetZoneTypeEnumZONE: "ZONE",
}
metaTargetZoneTypeEnumKey = map[string]MetaTargetZoneTypeEnum{
"UNKNOWN": MetaTargetZoneTypeEnumUNKNOWN,
"ZONE": MetaTargetZoneTypeEnumZONE,
}
)
func ToMetaTargetZoneTypeEnum(v *MetaTargetZoneType) MetaTargetZoneTypeEnum {
return metaTargetZoneTypeEnumKey[v.Key]
}
func ToMetaTargetZoneType(v MetaTargetZoneTypeEnum) *MetaTargetZoneType {
m := &MetaTargetZoneType {
}
m.Key = metaTargetZoneTypeEnumID[v]
return m
}

View File

@ -4,20 +4,20 @@ import (
"encoding/json"
"git.loafle.net/overflow/commons-go/core/util"
"git.loafle.net/overflow/commons-go/model/domain"
"git.loafle.net/overflow/commons-go/model/meta"
"git.loafle.net/overflow/commons-go/model/domain"
"git.loafle.net/overflow/commons-go/model/probe"
)
type NoAuthProbe struct {
ID json.Number `json:"id,Number,omitempty"`
Description string `json:"description,omitempty"`
MetaNoAuthProbeStatus *meta.MetaNoAuthProbeStatus `json:"metaNoAuthProbeStatus,omitempty"`
TempProbeKey string `json:"tempProbeKey,omitempty"`
CreateDate *util.Timestamp `json:"createDate,omitempty"`
APIKey string `json:"apiKey,omitempty"`
Domain *domain.DomainMember `json:"domain,omitempty"`
Probe *probe.Probe `json:"probe,omitempty"`
MetaNoAuthProbeStatus *meta.MetaNoAuthProbeStatus `json:"metaNoAuthProbeStatus,omitempty"`
InfraHostMeta string `json:"infraHostMeta, omitempty"`
TempProbeKey string `json:"tempProbeKey,omitempty"`
APIKey string `json:"apiKey,omitempty"`
ConnectDate *util.Timestamp `json:"connectDate,omitempty"`
ConnectAddress string `json:"connectAddress,omitempty"`
CreateDate *util.Timestamp `json:"createDate,omitempty"`
}

View File

@ -4,26 +4,24 @@ import (
"encoding/json"
"git.loafle.net/overflow/commons-go/core/util"
"git.loafle.net/overflow/commons-go/model/meta"
"git.loafle.net/overflow/commons-go/model/domain"
"git.loafle.net/overflow/commons-go/model/member"
"git.loafle.net/overflow/commons-go/model/meta"
)
type Probe struct {
ID json.Number `json:"id,Number,omitempty"`
MetaProbeStatus *meta.MetaProbeStatus `json:"metaProbeStatus,omitempty"`
Description string `json:"description,omitempty"`
CreateDate *util.Timestamp `json:"createDate,omitempty"`
Domain *domain.Domain `json:"domain,omitempty"`
ProbeKey string `json:"probeKey,omitempty"`
EncryptionKey string `json:"encryptionKey,omitempty"`
DisplayName string `json:"displayName,omitempty"`
Name string `json:"name,omitempty"`
Cidr string `json:"cidr,omitempty"`
AuthorizeDate *util.Timestamp `json:"authorizeDate,omitempty"`
AuthorizeMember *member.Member `json:"authorizeMember,omitempty"`
TargetCount int `json:"targetCount,omitempty"`
ConnectDate *util.Timestamp `json:"connectDate,omitempty"`
ConnectAddress string `json:"connectAddress,omitempty"`
TargetCount int `json:"targetCount,omitempty"`
SensorCount int `json:"sensorCount,omitempty"`
CreateDate *util.Timestamp `json:"createDate,omitempty"`
}

View File

@ -10,10 +10,12 @@ import (
type Sensor struct {
ID json.Number `json:"id,Number,omitempty"`
CreateDate *util.Timestamp `json:"createDate,omitempty"`
Target *target.Target `json:"target, omitempty"`
Name string `json:"name, omitempty"`
Description string `json:"description,omitempty"`
MetaSensorStatus *meta.MetaSensorStatus `json:"metaSensorStatus,omitempty"`
Target *target.Target `json:"target,omitempty"`
MetaCrawler *meta.MetaCrawler `json:"metaCrawler,omitempty"`
CrawlerInputItems string `json:"crawlerInputItems,omitempty"`
ItemCount json.Number `json:"itemCount,omitempty"`
CreateDate *util.Timestamp `json:"createDate,omitempty"`
}

View File

@ -3,12 +3,12 @@ package sensorconfig
import (
"encoding/json"
"git.loafle.net/overflow/commons-go/core/constants"
"git.loafle.net/overflow/commons-go/model/meta"
)
type Connection struct {
IP string `json:"ip,omitempty"`
Port json.Number `json:"port,Number,omitempty"`
PortType constants.PortType `json:"portType,omitempty"`
MetaPortType *meta.MetaPortType `json:"metaPortType,omitempty"`
SSL bool `json:"ssl,omitempty"`
}

View File

@ -4,11 +4,18 @@ import (
"encoding/json"
"git.loafle.net/overflow/commons-go/core/util"
"git.loafle.net/overflow/commons-go/model/infra"
"git.loafle.net/overflow/commons-go/model/meta"
"git.loafle.net/overflow/commons-go/model/sensor"
)
type Target struct {
ID json.Number `json:"id,Number,omitempty"`
CreateDate *util.Timestamp `json:"createDate,omitempty"`
DisplayName string `json:"displayName,omitempty"`
Infra *infra.Infra `json:"infra, omitempty"`
MetaTargetType *meta.MetaTargetType `json:"metaTargetType, omitempty"`
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
SensorCount json.Number `json:"sensorCount, omitempty"`
CreateDate *util.Timestamp `json:"createDate,omitempty"`
Sensors []sensor.Sensor `json:"sensors,omitempty"`
}