model/discovery/Service.go
crusader bd7c853bdc ing
2018-09-13 19:12:29 +09:00

45 lines
1.3 KiB
Go

package discovery
import (
"git.loafle.net/overflow/model/meta"
"git.loafle.net/overflow/model/util"
)
const (
UnknownServiceKey = "UNKNOWN"
DefaultServiceVendor = "UNKNOWN"
DefaultServiceVersion = "UNKNOWN"
)
var (
DefaultServiceType = meta.MetaServiceTypeEnumUNKNOWN.String()
)
type Service struct {
MetaCryptoType *meta.MetaCryptoType `json:"metaCryptoType,omitempty"`
Key string `json:"key,omitempty"`
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
ServiceType string `json:"serviceType,omitempty"`
ServiceVendor string `json:"serviceVendor,omitempty"`
ServiceVersion string `json:"serviceVersion,omitempty"`
Meta map[string]map[string]string `json:"meta,omitempty"`
DiscoveredBy []string `json:"discoveredBy,omitempty"`
DiscoveredDate *util.Timestamp `json:"discoveredDate,omitempty"`
Port *Port `json:"port,omitempty"`
}
func NewService(port *Port, metaCryptoType *meta.MetaCryptoType, key string) *Service {
return &Service{
Port: port,
MetaCryptoType: metaCryptoType,
Key: key,
ServiceType: DefaultServiceType,
ServiceVendor: DefaultServiceVendor,
ServiceVersion: DefaultServiceVersion,
}
}