package ipv4 import ( "testing" omm "git.loafle.net/overflow/model/meta" oms "git.loafle.net/overflow/model/scan" omu "git.loafle.net/overflow/model/util" ) func TestHostScan(t *testing.T) { z := &oms.Zone{ Network: "192.168.1.0/24", Iface: "{1924FA2B-6927-4BA5-AF43-876C3F8853CE}", Mac: "30:9C:23:15:A3:09", Address: "192.168.1.201", DiscoveredDate: omu.NowPtr(), } dp := &oms.DiscoverPort{ FirstScanRange: 1, LastScanRange: 20000, ExcludePorts: []int{ 631, }, IncludeTCP: true, IncludeUDP: true, DiscoverService: nil, } dh := &oms.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) } }