probe/discovery/protocol/icmp/icmp.go
2018-09-01 11:19:03 +09:00

27 lines
629 B
Go

package icmp
import (
"git.loafle.net/overflow_scanner/probe/discovery/protocol/icmp/privileged"
"git.loafle.net/overflow_scanner/probe/discovery/protocol/icmp/unprivileged"
"git.loafle.net/overflow_scanner/probe/discovery/session"
"git.loafle.net/overflow_scanner/probe/internal/pcap"
)
func Scan(discoverySession session.DiscoverySession) error {
zone := discoverySession.Zone()
var _privileged bool
_, err := pcap.RetainScanner(zone)
if nil == err {
pcap.ReleaseScanner(zone)
_privileged = true
}
if _privileged {
return privileged.Scan(discoverySession)
}
return unprivileged.Scan(discoverySession)
}