model/discovery/Host.go

49 lines
1.3 KiB
Go
Raw Permalink Normal View History

2018-08-12 10:46:46 +00:00
package discovery
import (
"git.loafle.net/overflow/model/meta"
"git.loafle.net/overflow/model/util"
)
2018-09-12 01:55:35 +00:00
const (
DefaultOsType = "UNKNOWN"
DefaultHostVendor = "UNKNOWN"
DefaultHostModel = "UNKNOWN"
)
2018-09-12 03:10:59 +00:00
var (
DefaultHostType = meta.MetaHostTypeEnumHost.String()
)
2018-08-12 10:46:46 +00:00
type Host struct {
2018-09-11 07:11:02 +00:00
MetaIPType *meta.MetaIPType `json:"metaIPType,omitempty"`
Name string `json:"name,omitempty"`
Address string `json:"address,omitempty"`
Mac string `json:"mac,omitempty"`
OsType string `json:"osType,omitempty"`
2018-09-12 01:55:35 +00:00
HostType string `json:"hostType,omitempty"`
HostVendor string `json:"hostVendor,omitempty"`
HostModel string `json:"hostModel,omitempty"`
2018-09-11 07:11:02 +00:00
Meta map[string]map[string]string `json:"meta,omitempty"`
2018-09-17 13:55:38 +00:00
DiscoveredBy []*meta.MetaDiscovererType `json:"discoveredBy,omitempty"`
2018-09-11 07:11:02 +00:00
DiscoveredDate *util.Timestamp `json:"discoveredDate,omitempty"`
2018-08-12 10:46:46 +00:00
Zone *Zone `json:"zone,omitempty"`
PortList []*Port `json:"portList,omitempty"`
}
2018-09-12 01:55:35 +00:00
func NewHost(zone *Zone, metaIPType *meta.MetaIPType, address string) *Host {
return &Host{
Zone: zone,
MetaIPType: metaIPType,
Address: address,
OsType: DefaultOsType,
HostType: DefaultHostType,
HostVendor: DefaultHostVendor,
HostModel: DefaultHostModel,
}
}