Debug, cmd remove, close connection at last response

This commit is contained in:
Pascal Engélibert 2026-02-02 16:06:04 +01:00
commit c38b24a8ed
4 changed files with 98 additions and 13 deletions

View file

@ -32,6 +32,8 @@ enum Subcommand {
Print(OptPrint),
/// Record traffic
Record(OptRecord),
/// Remove record
Remove(OptRemove),
/// Write test record
Test(OptTest),
}
@ -64,6 +66,9 @@ struct OptPlay {
/// Only run these parts
#[argp(option, default = "String::from(\"both\")")]
run: String,
/// Print debug info
#[argp(switch, short = 'd')]
debug: bool,
}
/// Print records
@ -88,6 +93,21 @@ struct OptRecord {}
#[argp(subcommand, name = "test")]
struct OptTest {}
/// Copy record but removing one connection id
#[derive(FromArgs)]
#[argp(subcommand, name = "remove")]
struct OptRemove {
/// Output path
#[argp(positional)]
output: String,
/// Record number to remove
#[argp(positional)]
record_number: u64,
/// Packet number to remove
#[argp(positional)]
packet_number: usize,
}
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
enum RunMode {
Client,
@ -220,6 +240,7 @@ async fn main() {
(subopt.forward_addr, subopt.forward_port),
sync_receiver,
subopt.repeat,
subopt.debug,
)
.await;
} else {
@ -234,6 +255,7 @@ async fn main() {
&subopt.certs,
("0.0.0.0", subopt.listen_port),
sync_sender,
subopt.debug,
)
.await;
}
@ -246,6 +268,14 @@ async fn main() {
Subcommand::Record(_subopt) => {
record::make_record(&opt.record_file);
}
Subcommand::Remove(subopt) => {
record::remove_record(
&opt.record_file,
&subopt.output,
subopt.record_number,
subopt.packet_number,
);
}
Subcommand::Test(_subopt) => {
record::make_test_record(&opt.record_file);
}