mirror of
https://github.com/n0-computer/noq.git
synced 2026-09-20 18:23:41 +00:00
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:
committed by
Benjamin Saunders
parent
28a2c8052c
commit
cebfb270f6
@@ -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();
|
||||
|
||||
@@ -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)?;
|
||||
|
||||
Reference in New Issue
Block a user