2018-08-12 10:46:46 +00:00
|
|
|
package discovery
|
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/json"
|
2018-09-12 01:55:35 +00:00
|
|
|
"strconv"
|
2018-08-12 10:46:46 +00:00
|
|
|
|
|
|
|
"git.loafle.net/overflow/model/meta"
|
|
|
|
"git.loafle.net/overflow/model/util"
|
|
|
|
"github.com/google/gopacket"
|
|
|
|
)
|
|
|
|
|
|
|
|
type Port struct {
|
2018-08-28 10:42:07 +00:00
|
|
|
MetaPortType *meta.MetaPortType `json:"metaPortType,omitempty"`
|
|
|
|
PortNumber json.Number `json:"portNumber,omitempty"`
|
|
|
|
|
2018-10-23 03:43:57 +00:00
|
|
|
DefaultService string `json:"defaultService,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
|
|
|
Host *Host `json:"host,omitempty"`
|
|
|
|
ServiceList []*Service `json:"serviceList,omitempty"`
|
|
|
|
UDPLayer gopacket.Layer `json:"-"`
|
2018-08-12 10:46:46 +00:00
|
|
|
}
|
2018-09-12 01:55:35 +00:00
|
|
|
|
|
|
|
func NewPort(host *Host, metaPortType *meta.MetaPortType, portNumber int) *Port {
|
|
|
|
return &Port{
|
|
|
|
Host: host,
|
|
|
|
MetaPortType: metaPortType,
|
|
|
|
PortNumber: json.Number(strconv.Itoa(portNumber)),
|
|
|
|
}
|
|
|
|
}
|