model/discovery/Service.go
crusader 46db6509b0 ing
2018-09-17 22:55:38 +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 []*meta.MetaDiscovererType `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,
}
}