Add --keylog command line option for perf client and server

binaries. This allow dumping crypto keys to disk using
SSLKEYLOGFILE env var.
This commit is contained in:
Damien Deville
2022-10-27 10:42:15 +02:00
committed by Benjamin Saunders
parent 28a2c8052c
commit cebfb270f6
2 changed files with 14 additions and 0 deletions
+7
View File
@@ -60,6 +60,9 @@ struct Opt {
#[cfg(feature = "json-output")]
#[clap(long)]
json: Option<PathBuf>,
/// Perform NSS-compatible TLS key logging to the file specified in `SSLKEYLOGFILE`.
#[clap(long = "keylog")]
keylog: bool,
}
#[tokio::main(flavor = "current_thread")]
@@ -115,6 +118,10 @@ async fn run(opt: Opt) -> Result<()> {
.with_no_client_auth();
crypto.alpn_protocols = vec![b"perf".to_vec()];
if opt.keylog {
crypto.key_log = Arc::new(rustls::KeyLogFile::new());
}
let cfg = quinn::ClientConfig::new(Arc::new(crypto));
let stream_stats = OpenStreamStats::default();
+7
View File
@@ -29,6 +29,9 @@ struct Opt {
/// Whether to print connection statistics
#[clap(long)]
conn_stats: bool,
/// Perform NSS-compatible TLS key logging to the file specified in `SSLKEYLOGFILE`.
#[clap(long = "keylog")]
keylog: bool,
}
#[tokio::main(flavor = "current_thread")]
@@ -74,6 +77,10 @@ async fn run(opt: Opt) -> Result<()> {
.unwrap();
crypto.alpn_protocols = vec![b"perf".to_vec()];
if opt.keylog {
crypto.key_log = Arc::new(rustls::KeyLogFile::new());
}
let server_config = quinn::ServerConfig::with_crypto(Arc::new(crypto));
let socket = bind_socket(opt.listen, opt.send_buffer_size, opt.recv_buffer_size)?;