Skip to content

Commit

Permalink
add mtls support
Browse files Browse the repository at this point in the history
  • Loading branch information
notoriaga committed Mar 13, 2024
1 parent 2c0bc5e commit f68bcf3
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,14 @@ struct Cli {
/// Path to a YAML file containing a list of messages to send to the caster
#[arg(long)]
input: Option<PathBuf>,

/// Client certificate file for mTLS
#[arg(long, requires = "key")]
cert: Option<PathBuf>,

/// Private key file for mTLS
#[arg(long, requires = "cert")]
key: Option<PathBuf>,
}

#[derive(Debug, Clone, Copy, serde::Deserialize)]
Expand Down Expand Up @@ -302,6 +310,11 @@ fn run() -> Result<()> {
curl.http_version(HttpVersion::Any)?;
curl.http_09_allowed(true)?;

if let (Some(cert), Some(key)) = (&opt.cert, &opt.key) {
curl.ssl_cert(cert)?;
curl.ssl_key(key)?;
}

if opt.verbose {
curl.verbose(true)?;
}
Expand Down

0 comments on commit f68bcf3

Please sign in to comment.