scanPorts method
并发扫描多个端口 / Scans multiple ports with bounded concurrency.
Implementation
Future<List<PortCheckResult>> scanPorts({
required String host,
List<int> ports = const <int>[80, 443],
Duration? timeout,
int concurrency = 12,
}) async {
return ports
.map(
(port) => PortCheckResult(
host: host,
port: port,
isOpen: false,
responseTime: Duration.zero,
errorMessage:
'TCP port scanning is not available on the web platform.',
timestamp: DateTime.now(),
),
)
.toList(growable: false);
}