Debug, cmd remove, close connection at last response
This commit is contained in:
parent
f86793e8f2
commit
c38b24a8ed
4 changed files with 98 additions and 13 deletions
30
src/main.rs
30
src/main.rs
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue