2018-08-12 10:46:46 +00:00
|
|
|
package discovery
|
|
|
|
|
|
|
|
type DiscoverPort struct {
|
2018-08-30 11:40:21 +00:00
|
|
|
DiscoveryConfig *DiscoveryConfig `json:"discoveryConfig,omitempty"`
|
|
|
|
|
2018-08-12 10:46:46 +00:00
|
|
|
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"`
|
|
|
|
|
|
|
|
DiscoverService *DiscoverService `json:"discoverService,omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
func (dp *DiscoverPort) 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
|
|
|
|
}
|