895b963745
Consolidating the UI's seed values onto TestConfiguration's own defaults also silently changed the default target to iperf.es.net, which was not asked for. Sets it back in TestConfiguration, which is now the single definition the screen and the headless entry point both read. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
38 lines
919 B
Dart
38 lines
919 B
Dart
/// 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 = 'speedtest.uztelecom.uz',
|
|
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;
|
|
}
|
|
}
|