model/discovery/Port.go
crusader f0016076e4 ing
2018-10-23 12:43:57 +09:00

33 lines
981 B
Go

package discovery
import (
"encoding/json"
"strconv"
"git.loafle.net/overflow/model/meta"
"git.loafle.net/overflow/model/util"
"github.com/google/gopacket"
)
type Port struct {
MetaPortType *meta.MetaPortType `json:"metaPortType,omitempty"`
PortNumber json.Number `json:"portNumber,omitempty"`
DefaultService string `json:"defaultService,omitempty"`
Meta map[string]map[string]string `json:"meta,omitempty"`
DiscoveredBy []*meta.MetaDiscovererType `json:"discoveredBy,omitempty"`
DiscoveredDate *util.Timestamp `json:"discoveredDate,omitempty"`
Host *Host `json:"host,omitempty"`
ServiceList []*Service `json:"serviceList,omitempty"`
UDPLayer gopacket.Layer `json:"-"`
}
func NewPort(host *Host, metaPortType *meta.MetaPortType, portNumber int) *Port {
return &Port{
Host: host,
MetaPortType: metaPortType,
PortNumber: json.Number(strconv.Itoa(portNumber)),
}
}