ing
This commit is contained in:
parent
ec00e90410
commit
46db6509b0
|
@ -28,7 +28,7 @@ type Host struct {
|
|||
HostModel string `json:"hostModel,omitempty"`
|
||||
|
||||
Meta map[string]map[string]string `json:"meta,omitempty"`
|
||||
DiscoveredBy []string `json:"discoveredBy,omitempty"`
|
||||
DiscoveredBy []*meta.MetaDiscovererType `json:"discoveredBy,omitempty"`
|
||||
DiscoveredDate *util.Timestamp `json:"discoveredDate,omitempty"`
|
||||
|
||||
Zone *Zone `json:"zone,omitempty"`
|
||||
|
|
|
@ -14,7 +14,7 @@ type Port struct {
|
|||
PortNumber json.Number `json:"portNumber,omitempty"`
|
||||
|
||||
Meta map[string]map[string]string `json:"meta,omitempty"`
|
||||
DiscoveredBy []string `json:"discoveredBy,omitempty"`
|
||||
DiscoveredBy []*meta.MetaDiscovererType `json:"discoveredBy,omitempty"`
|
||||
DiscoveredDate *util.Timestamp `json:"discoveredDate,omitempty"`
|
||||
|
||||
Host *Host `json:"host,omitempty"`
|
||||
|
|
|
@ -26,7 +26,7 @@ type Service struct {
|
|||
ServiceVersion string `json:"serviceVersion,omitempty"`
|
||||
|
||||
Meta map[string]map[string]string `json:"meta,omitempty"`
|
||||
DiscoveredBy []string `json:"discoveredBy,omitempty"`
|
||||
DiscoveredBy []*meta.MetaDiscovererType `json:"discoveredBy,omitempty"`
|
||||
DiscoveredDate *util.Timestamp `json:"discoveredDate,omitempty"`
|
||||
|
||||
Port *Port `json:"port,omitempty"`
|
||||
|
|
|
@ -15,7 +15,7 @@ type Zone struct {
|
|||
Mac string `json:"mac,omitempty"`
|
||||
|
||||
Meta map[string]map[string]string `json:"meta,omitempty"`
|
||||
DiscoveredBy []string `json:"discoveredBy,omitempty"`
|
||||
DiscoveredBy []*meta.MetaDiscovererType `json:"discoveredBy,omitempty"`
|
||||
DiscoveredDate *util.Timestamp `json:"discoveredDate,omitempty"`
|
||||
|
||||
mtx sync.RWMutex `json:"-"`
|
||||
|
|
89
meta/MetaDiscovererType.go
Normal file
89
meta/MetaDiscovererType.go
Normal file
|
@ -0,0 +1,89 @@
|
|||
package meta
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"git.loafle.net/overflow/model/util"
|
||||
)
|
||||
|
||||
type MetaDiscovererType 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 MetaDiscovererTypeEnum int
|
||||
|
||||
const (
|
||||
MetaDiscovererTypeEnumUNKNOWN MetaDiscovererTypeEnum = iota + 1
|
||||
MetaDiscovererTypeEnumARP
|
||||
MetaDiscovererTypeEnumICMP
|
||||
MetaDiscovererTypeEnumMDNS
|
||||
MetaDiscovererTypeEnumNDP
|
||||
MetaDiscovererTypeEnumSNMP
|
||||
MetaDiscovererTypeEnumTCPACK
|
||||
MetaDiscovererTypeEnumTCPFIN
|
||||
MetaDiscovererTypeEnumTCPNULL
|
||||
MetaDiscovererTypeEnumTCPXmas
|
||||
MetaDiscovererTypeEnumTCPSyn
|
||||
MetaDiscovererTypeEnumTCPConnection
|
||||
MetaDiscovererTypeEnumTCPMatcher
|
||||
MetaDiscovererTypeEnumUDPConnection
|
||||
MetaDiscovererTypeEnumUDPMatcher
|
||||
MetaDiscovererTypeEnumUPnP
|
||||
)
|
||||
|
||||
var (
|
||||
metaDiscovererTypeEnumID = map[MetaDiscovererTypeEnum]string{
|
||||
MetaDiscovererTypeEnumUNKNOWN: "UNKNOWN",
|
||||
MetaDiscovererTypeEnumARP: "ARP",
|
||||
MetaDiscovererTypeEnumICMP: "ICMP",
|
||||
MetaDiscovererTypeEnumMDNS: "MDNS",
|
||||
MetaDiscovererTypeEnumNDP: "NDP",
|
||||
MetaDiscovererTypeEnumSNMP: "SNMP",
|
||||
MetaDiscovererTypeEnumTCPACK: "TCPACK",
|
||||
MetaDiscovererTypeEnumTCPFIN: "TCPFIN",
|
||||
MetaDiscovererTypeEnumTCPNULL: "TCPNULL",
|
||||
MetaDiscovererTypeEnumTCPXmas: "TCPXmas",
|
||||
MetaDiscovererTypeEnumTCPSyn: "TCPSyn",
|
||||
MetaDiscovererTypeEnumTCPConnection: "TCPConnection",
|
||||
MetaDiscovererTypeEnumTCPMatcher: "TCPMatcher",
|
||||
MetaDiscovererTypeEnumUDPConnection: "UDPConnection",
|
||||
MetaDiscovererTypeEnumUDPMatcher: "UDPMatcher",
|
||||
MetaDiscovererTypeEnumUPnP: "UPnP",
|
||||
}
|
||||
|
||||
metaDiscovererTypeEnumKey = map[string]MetaDiscovererTypeEnum{
|
||||
"UNKNOWN": MetaDiscovererTypeEnumUNKNOWN,
|
||||
"ARP": MetaDiscovererTypeEnumARP,
|
||||
"ICMP": MetaDiscovererTypeEnumICMP,
|
||||
"MDNS": MetaDiscovererTypeEnumMDNS,
|
||||
"NDP": MetaDiscovererTypeEnumNDP,
|
||||
"SNMP": MetaDiscovererTypeEnumSNMP,
|
||||
"TCPACK": MetaDiscovererTypeEnumTCPACK,
|
||||
"TCPFIN": MetaDiscovererTypeEnumTCPFIN,
|
||||
"TCPNULL": MetaDiscovererTypeEnumTCPNULL,
|
||||
"TCPXmas": MetaDiscovererTypeEnumTCPXmas,
|
||||
"TCPSyn": MetaDiscovererTypeEnumTCPSyn,
|
||||
"TCPConnection": MetaDiscovererTypeEnumTCPConnection,
|
||||
"TCPMatcher": MetaDiscovererTypeEnumTCPMatcher,
|
||||
"UDPConnection": MetaDiscovererTypeEnumUDPConnection,
|
||||
"UDPMatcher": MetaDiscovererTypeEnumUDPMatcher,
|
||||
"UPnP": MetaDiscovererTypeEnumUPnP,
|
||||
}
|
||||
)
|
||||
|
||||
func (e MetaDiscovererTypeEnum) String() string {
|
||||
return metaDiscovererTypeEnumID[e]
|
||||
}
|
||||
|
||||
func ToMetaDiscovererTypeEnum(v *MetaDiscovererType) MetaDiscovererTypeEnum {
|
||||
return metaDiscovererTypeEnumKey[v.Key]
|
||||
}
|
||||
|
||||
func ToMetaDiscovererType(v MetaDiscovererTypeEnum) *MetaDiscovererType {
|
||||
return &MetaDiscovererType{
|
||||
Key: metaDiscovererTypeEnumID[v],
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user