model/discovery/Service.go
crusader 725389f033 ing
2018-09-12 10:55:35 +09:00

41 lines
1.2 KiB
Go

package discovery
import (
"git.loafle.net/overflow/model/meta"
"git.loafle.net/overflow/model/util"
)
const (
DefaultServiceType = "ETC"
DefaultServiceVendor = "UNKNOWN"
DefaultServiceVersion = "UNKNOWN"
)
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,
}
}