Line data Source code
1 : import 'package:dart_ping/dart_ping.dart';
2 :
3 : import 'package:network_tools/network_tools.dart';
4 :
5 : /// A discovered host in a form that can be sent across an isolate boundary.
6 : ///
7 : /// Host scanners emit these so the scan can run in a separate isolate and the
8 : /// calling isolate can wrap them in [ActiveHost].
9 : class SendableActiveHost {
10 6 : SendableActiveHost(
11 : this.address, {
12 : this.pingData,
13 : this.openPorts = const [],
14 : this.macAddress,
15 : this.hostName,
16 : this.deviceType,
17 : });
18 :
19 : /// The host's IPv4 or IPv6 address.
20 : final String address;
21 :
22 : /// The ICMP response recorded while confirming the host, or null when the
23 : /// host was found through the neighbor table without answering ping.
24 : final PingResponse? pingData;
25 :
26 : /// Ports found open on this host.
27 : List<OpenPort> openPorts;
28 :
29 : /// MAC address read from the neighbor table during discovery, when available.
30 : final String? macAddress;
31 :
32 : /// Host name resolved during discovery so consumers do not have to wait for
33 : /// another lookup.
34 : final String? hostName;
35 :
36 : /// Inferred device type based on open port patterns (e.g., "Router", "Printer").
37 : final String? deviceType;
38 : }
|