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