package ipv4 import ( "testing" omd "git.loafle.net/overflow/model/discovery" omm "git.loafle.net/overflow/model/meta" omu "git.loafle.net/overflow/model/util" ) func TestHostScan(t *testing.T) { z := &omd.Zone{ Network: "192.168.1.0/24", Iface: " \\Device\\NPF_{1924FA2B-6927-4BA5-AF43-876C3F8853CE}", Mac: "30:9C:23:15:A3:09", Address: "192.168.1.201", DiscoveredDate: omu.NowPtr(), } dp := &omd.DiscoverPort{ FirstScanRange: 1, LastScanRange: 20000, ExcludePorts: []int{ 631, }, IncludeTCP: true, IncludeUDP: true, DiscoverService: nil, } dh := &omd.DiscoverHost{ MetaIPType: omm.ToMetaIPType(omm.MetaIPTypeEnumV4), FirstScanRange: "192.168.1.1", LastScanRange: "192.168.1.255", DiscoverPort: dp, } resCh := make(chan interface{}) errCh := make(chan error) stopCh := make(chan struct{}) ScanHost(z, dh, resCh, errCh, stopCh) for res := range resCh { t.Log(res) } for err := range errCh { t.Log(err) } }