commons-go/discovery/model/DiscoveryPort.go
crusader 796da7bbfe ing
2018-04-12 18:38:04 +09:00

29 lines
620 B
Go

package model
type DiscoveryPort struct {
FirstScanRange int `json:"firstScanRange,omitempty"`
LastScanRange int `json:"lastScanRange,omitempty"`
ExcludePorts []int `json:"excludePorts,omitempty"`
IncludeTCP bool `json:"includeTCP,omitempty"`
IncludeUDP bool `json:"includeUDP,omitempty"`
DiscoveryService *DiscoveryService `json:"discoveryService,omitempty"`
}
func (dp *DiscoveryPort) Contains(port int) bool {
if dp.FirstScanRange > port {
return false
}
if dp.LastScanRange < port {
return false
}
for _, p := range dp.ExcludePorts {
if p == port {
return false
}
}
return true
}