feat: add domain models for test configuration and results

This commit is contained in:
2026-08-24 06:41:47 +09:00
parent 5a7c36a798
commit ef194af782
4 changed files with 92 additions and 0 deletions
+10
View File
@@ -0,0 +1,10 @@
/// Raw result from an iperf3 execution.
class Iperf3Result {
final String rawOutput;
final int exitCode;
const Iperf3Result({
required this.rawOutput,
required this.exitCode,
});
}
+37
View File
@@ -0,0 +1,37 @@
/// Configuration for an iperf3 client test.
class TestConfiguration {
final String server;
final int port;
final Duration duration;
final int interval;
final int parallelStreams;
const TestConfiguration({
this.server = 'iperf.es.net',
this.port = 5201,
this.duration = const Duration(seconds: 10),
this.interval = 1,
this.parallelStreams = 1,
});
/// Convert to iperf3 CLI arguments.
List<String> toCliArgs() {
return <String>[
'-c', server,
'-p', '$port',
'-t', '${duration.inSeconds}',
'-i', '$interval',
'-P', '$parallelStreams',
];
}
/// Validate the configuration.
bool get isValid {
if (server.isEmpty) return false;
if (port < 1 || port > 65535) return false;
if (duration.inSeconds < 1) return false;
if (interval < 1) return false;
if (parallelStreams < 1) return false;
return true;
}
}