mirror of
https://github.com/tribufu/rust-gamedig
synced 2026-05-18 09:35:50 +00:00
cli: Add option to create a packet capture
This commit is contained in:
parent
abbcae618f
commit
8d17ca4e48
2 changed files with 11 additions and 1 deletions
|
|
@ -38,6 +38,10 @@ struct Cli {
|
|||
#[arg(short, long, default_value = "generic")]
|
||||
output_mode: OutputMode,
|
||||
|
||||
#[cfg(feature = "packet_capture")]
|
||||
#[arg(short, long)]
|
||||
capture: Option<String>,
|
||||
|
||||
/// Optional timeout settings for the server query.
|
||||
#[command(flatten, next_help_heading = "Timeouts")]
|
||||
timeout_settings: Option<TimeoutSettings>,
|
||||
|
|
@ -177,6 +181,11 @@ fn main() -> Result<()> {
|
|||
// Resolve the IP address
|
||||
let ip = resolve_ip_or_domain(&args.ip, &mut extra_options)?;
|
||||
|
||||
#[cfg(feature = "packet_capture")]
|
||||
unsafe {
|
||||
gamedig::capture::simple_setup_capture(args.capture.clone());
|
||||
}
|
||||
|
||||
// Query the server using game definition, parsed IP, and user command line
|
||||
// flags.
|
||||
let result = query_with_timeout_and_extra_settings(game, &ip, args.port, args.timeout_settings, extra_options)?;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue