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 (
|
2018-09-13 10:12:29 +00:00
|
|
|
UnknownServiceKey = "UNKNOWN"
|
2018-09-12 01:55:35 +00:00
|
|
|
DefaultServiceVendor = "UNKNOWN"
|
|
|
|
DefaultServiceVersion = "UNKNOWN"
|
|
|
|
)
|
|
|
|
|
2018-09-12 03:10:59 +00:00
|
|
|
var (
|
|
|
|
DefaultServiceType = meta.MetaServiceTypeEnumUNKNOWN.String()
|
|
|
|
)
|
|
|
|
|
2018-08-12 10:46:46 +00:00
|
|
|
type Service struct {
|
|
|
|
MetaCryptoType *meta.MetaCryptoType `json:"metaCryptoType,omitempty"`
|
|
|
|
Key string `json:"key,omitempty"`
|
2018-08-13 08:12:55 +00:00
|
|
|
Name string `json:"name,omitempty"`
|
2018-08-12 10:46:46 +00:00
|
|
|
Description string `json:"description,omitempty"`
|
|
|
|
|
2018-09-12 01:55:35 +00:00
|
|
|
ServiceType string `json:"serviceType,omitempty"`
|
|
|
|
ServiceVendor string `json:"serviceVendor,omitempty"`
|
|
|
|
ServiceVersion string `json:"serviceVersion,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
|
|
|
|
2018-09-11 07:11:02 +00:00
|
|
|
Port *Port `json:"port,omitempty"`
|
2018-08-12 10:46:46 +00:00
|
|
|
}
|
2018-09-12 01:55:35 +00:00
|
|
|
|
|
|
|
func NewService(port *Port, metaCryptoType *meta.MetaCryptoType, key string) *Service {
|
|
|
|
return &Service{
|
|
|
|
Port: port,
|
|
|
|
MetaCryptoType: metaCryptoType,
|
|
|
|
Key: key,
|
|
|
|
ServiceType: DefaultServiceType,
|
|
|
|
ServiceVendor: DefaultServiceVendor,
|
|
|
|
ServiceVersion: DefaultServiceVersion,
|
|
|
|
}
|
|
|
|
}
|