This commit is contained in:
crusader 2017-11-18 17:23:39 +09:00
parent 6ac80b1a88
commit be4832f7a9
3 changed files with 39 additions and 2 deletions

7
discovery/ipv4/port.go Normal file
View File

@ -0,0 +1,7 @@
package ipv4
import "git.loafle.net/overflow/overflow_discovery/api/module/discovery/model"
func ScanPort(host *model.Host, dp *model.DiscoveryPort, resultChan chan interface{}, errChan chan error, doneChan chan<- struct{}) {
}

7
discovery/ipv6/port.go Normal file
View File

@ -0,0 +1,7 @@
package ipv6
import "git.loafle.net/overflow/overflow_discovery/api/module/discovery/model"
func ScanPort(host *model.Host, dp *model.DiscoveryPort, resultChan chan interface{}, errChan chan error, doneChan chan<- struct{}) {
}

View File

@ -1,7 +1,30 @@
package discovery package discovery
import "git.loafle.net/overflow/overflow_discovery/api/module/discovery/model" import (
"fmt"
"net"
"git.loafle.net/overflow/overflow_discovery/api/module/discovery/model"
"git.loafle.net/overflow/overflow_discovery/discovery/ipv4"
"git.loafle.net/overflow/overflow_discovery/discovery/ipv6"
)
func scanPort(host *model.Host, dp *model.DiscoveryPort, resultChan chan interface{}, errChan chan error, doneChan chan<- struct{}) { func scanPort(host *model.Host, dp *model.DiscoveryPort, resultChan chan interface{}, errChan chan error, doneChan chan<- struct{}) {
_, ipNet, err := net.ParseCIDR(host.Zone.Network)
if nil != err {
errChan <- err
doneChan <- struct{}{} doneChan <- struct{}{}
return
}
switch len(ipNet.IP) {
case net.IPv4len:
ipv4.ScanPort(host, dp, resultChan, errChan, doneChan)
case net.IPv6len:
ipv6.ScanPort(host, dp, resultChan, errChan, doneChan)
default:
errChan <- fmt.Errorf("Discovery: Not supported ip length")
doneChan <- struct{}{}
return
}
} }