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) }