ing
This commit is contained in:
parent
c65fd4ab7d
commit
235a059d9b
|
@ -7,9 +7,9 @@ import (
|
|||
"testing"
|
||||
|
||||
logging "git.loafle.net/commons/logging-go"
|
||||
occc "git.loafle.net/overflow/commons-go/core/constants"
|
||||
occu "git.loafle.net/overflow/commons-go/core/util"
|
||||
ocmd "git.loafle.net/overflow/commons-go/model/discovery"
|
||||
ocmm "git.loafle.net/overflow/commons-go/model/meta"
|
||||
"git.loafle.net/overflow/container_discovery/internal/discoverer"
|
||||
)
|
||||
|
||||
|
@ -19,17 +19,20 @@ var (
|
|||
}
|
||||
z = &ocmd.Zone{
|
||||
Network: "192.168.1.0/24",
|
||||
IPV4: "192.168.1.101",
|
||||
MetaIPType: ocmm.ToMetaIPType(ocmm.MetaIPTypeEnumV4),
|
||||
Address: "192.168.1.101",
|
||||
Iface: "enp3s0",
|
||||
Mac: "44:8a:5b:f1:f1:f3",
|
||||
}
|
||||
dh = &ocmd.DiscoverHost{
|
||||
FirstScanRangeV4: "192.168.1.1",
|
||||
LastScanRangeV4: "192.168.1.254",
|
||||
MetaIPType: ocmm.ToMetaIPType(ocmm.MetaIPTypeEnumV4),
|
||||
FirstScanRange: "192.168.1.1",
|
||||
LastScanRange: "192.168.1.254",
|
||||
}
|
||||
h = &ocmd.Host{
|
||||
Zone: z,
|
||||
IPV4: "192.168.1.10",
|
||||
MetaIPType: ocmm.ToMetaIPType(ocmm.MetaIPTypeEnumV4),
|
||||
Address: "192.168.1.10",
|
||||
Mac: "d0:50:99:97:5d:99",
|
||||
}
|
||||
dp = &ocmd.DiscoverPort{
|
||||
|
@ -43,7 +46,7 @@ var (
|
|||
}
|
||||
p = &ocmd.Port{
|
||||
Host: h,
|
||||
PortType: occc.PortTypeTCP,
|
||||
MetaPortType: ocmm.ToMetaPortType(ocmm.MetaPortTypeEnumTCP),
|
||||
PortNumber: json.Number(strconv.Itoa(80)),
|
||||
DiscoveredDate: occu.NowPtr(),
|
||||
}
|
||||
|
@ -80,8 +83,9 @@ var (
|
|||
}
|
||||
|
||||
dha = &ocmd.DiscoverHost{
|
||||
FirstScanRangeV4: "192.168.1.0",
|
||||
LastScanRangeV4: "192.168.1.255",
|
||||
MetaIPType: ocmm.ToMetaIPType(ocmm.MetaIPTypeEnumV4),
|
||||
FirstScanRange: "192.168.1.0",
|
||||
LastScanRange: "192.168.1.255",
|
||||
DiscoverPort: &ocmd.DiscoverPort{
|
||||
FirstScanRange: 1,
|
||||
LastScanRange: 50000,
|
||||
|
|
|
@ -10,6 +10,7 @@ import (
|
|||
"git.loafle.net/commons/util-go/net/cidr"
|
||||
occu "git.loafle.net/overflow/commons-go/core/util"
|
||||
ocmd "git.loafle.net/overflow/commons-go/model/discovery"
|
||||
ocmm "git.loafle.net/overflow/commons-go/model/meta"
|
||||
"git.loafle.net/overflow/container_discovery/internal/pcap"
|
||||
"github.com/google/gopacket"
|
||||
"github.com/google/gopacket/layers"
|
||||
|
@ -145,6 +146,7 @@ func handlePacketARP(zone *ocmd.Zone, hostRanges []net.IP, hosts map[string]*ocm
|
|||
}
|
||||
|
||||
h := &ocmd.Host{
|
||||
MetaIPType: ocmm.ToMetaIPType(ocmm.MetaIPTypeEnumV4),
|
||||
Address: ip.String(),
|
||||
Mac: net.HardwareAddr(packet.SourceHwAddress).String(),
|
||||
Zone: zone,
|
||||
|
|
Loading…
Reference in New Issue
Block a user