This commit is contained in:
crusader 2018-04-28 01:46:07 +09:00
parent d8ffaa8d84
commit ba355a5665
6 changed files with 28 additions and 22 deletions

View File

@ -292,12 +292,13 @@ export class SettingComponent implements OnInit, AfterContentInit {
} }
const discoverZone: DiscoverZone = { const discoverZone: DiscoverZone = {
discoverHost: { discoverHost: {
firstScanRange: this.startIP, firstScanRangev4: this.startIP,
lastScanRange: this.endIP, lastScanRangev4: this.endIP,
discoverPort: discoverPort, discoverPort: discoverPort,
}, },
}; };
console.log(discoverZone); console.log(discoverZone);
// console.log('start discovery - ' + this.probe.probeKey); // console.log('start discovery - ' + this.probe.probeKey);

View File

@ -1,10 +1,15 @@
import { DiscoverPort } from './DiscoverPort'; import { DiscoverPort } from './DiscoverPort';
export interface DiscoverHost { export interface DiscoverHost {
firstScanRange?: string; firstScanRangev4?: string;
lastScanRange?: string; lastScanRangev4?: string;
excludeHosts?: string[]; excludeHostsv4?: string[];
includeHosts?: string[]; includeHostsv4?: string[];
firstScanRangev6?: string;
lastScanRangev6?: string;
excludeHostsv6?: string[];
includeHostsv6?: string[];
discoverPort?: DiscoverPort; discoverPort?: DiscoverPort;
} }

View File

@ -3,8 +3,8 @@ import { Port } from './Port';
export interface Host { export interface Host {
id?: number; id?: number;
ip4?: string; ipv4?: string;
ip6?: string; ipv6?: string;
mac: number; mac: number;
os: string; os: string;
discoveredDate?: Date; discoveredDate?: Date;

View File

@ -3,8 +3,8 @@ import { Host } from './Host';
export interface Zone { export interface Zone {
id?: number; id?: number;
network?: string; network?: string;
ip4?: string; ipv4?: string;
ip6?: string; ipv6?: string;
iface?: string; iface?: string;
mac?: string; mac?: string;
discoveredDate?: Date; discoveredDate?: Date;

View File

@ -70,10 +70,10 @@ export function reducer(state = initialState, action: Actions): State {
} }
if (null === zone.hosts || undefined === zone.hosts) { if (null === zone.hosts || undefined === zone.hosts) {
zone.hosts = new Map(); zone.hosts = new Map();
zone.hosts.set(host.ip4, host); zone.hosts.set(host.ipv4, host);
} else { } else {
if (zone.hosts.has(host.ip4) === false) { if (zone.hosts.has(host.ipv4) === false) {
zone.hosts.set(host.ip4, host); zone.hosts.set(host.ipv4, host);
} }
} }
@ -118,7 +118,7 @@ export function reducer(state = initialState, action: Actions): State {
zone.hosts = new Map(); zone.hosts = new Map();
} }
let host: Host = null; let host: Host = null;
host = zone.hosts.get(port.host.ip4); host = zone.hosts.get(port.host.ipv4);
if (host === undefined || host === null) { if (host === undefined || host === null) {
host = port.host; host = port.host;
@ -133,7 +133,7 @@ export function reducer(state = initialState, action: Actions): State {
} }
} }
zone.hosts.set(host.ip4, host); zone.hosts.set(host.ipv4, host);
zones.set(zone.network, zone); zones.set(zone.network, zone);
const newZones: Map<string, Zone> = new Map(); const newZones: Map<string, Zone> = new Map();
@ -174,10 +174,10 @@ export function reducer(state = initialState, action: Actions): State {
// console.error(`Discovery.DiscoveredPort: Host[${service.port.host.ip}] is not exist`); // console.error(`Discovery.DiscoveredPort: Host[${service.port.host.ip}] is not exist`);
// } // }
let host: Host = null; let host: Host = null;
host = zone.hosts.get(service.port.host.ip4); host = zone.hosts.get(service.port.host.ipv4);
if (host === undefined || host === null) { if (host === undefined || host === null) {
zone.hosts.set(service.port.host.ip4, service.port.host); zone.hosts.set(service.port.host.ipv4, service.port.host);
host = service.port.host; host = service.port.host;
} }
@ -199,7 +199,7 @@ export function reducer(state = initialState, action: Actions): State {
port.services.set(service.serviceName, service); port.services.set(service.serviceName, service);
host.ports.set(service.port.portNumber, port); host.ports.set(service.port.portNumber, port);
zone.hosts.set(host.ip4, host); zone.hosts.set(host.ipv4, host);
zones.set(zone.network, zone); zones.set(zone.network, zone);
const newZones: Map<string, Zone> = new Map(); const newZones: Map<string, Zone> = new Map();

View File

@ -7,10 +7,10 @@ import {
Host, Host,
Port, Port,
Service, Service,
DiscoveryZone, DiscoverZone as MDDiscoverZone,
DiscoveryHost, DiscoverHost as MDDiscoverHost,
DiscoveryPort, DiscoverPort as MDDiscoverPort,
DiscoveryService as MDiscoveryService, DiscoverService as MDiscoverService,
} from '../../model'; } from '../../model';
import { Probe } from 'packages/probe/model'; import { Probe } from 'packages/probe/model';