From 060bf8326d3d26b719c8e518c22708af4c20040b Mon Sep 17 00:00:00 2001 From: Divma <26765164+divagant-martian@users.noreply.github.com> Date: Tue, 20 Aug 2024 12:55:00 -0500 Subject: [PATCH 1/2] refactor(iroh, iroh-blobs, iroh-net)!: remove deprecated items (#2652) ## Description Removes items deprecated in the last release. ## Breaking Changes ### iroh-blobs - `iroh_blobs::store::fs::Store::import_flat_store` was previously deprecated and is now removed. Use iroh <= `0.22.0` to migrate. - `iroh_blobs::store::fs::FlatStorePaths` is removed. This was only used for importing flat stores, which were previously deprecated. Use iroh <= `0.22.0` to migrate. ### iroh - Automatic migration from flat stores is no longer possible. This was previously deprecated. Use iroh <= `0.22.0` to migrate. ### iroh-net - `iroh_net::endpoint::RemoteInfo::last_alive_relay` was previously deprecated and it's now removed. ## Notes & open questions n/a ## Change checklist - [x] Self-review. - [ ] ~~Documentation updates following the [style guide](https://rust-lang.github.io/rfcs/1574-more-api-documentation-conventions.html#appendix-a-full-conventions-text), if relevant.~~ - [x] Tests if relevant. - [x] All breaking changes documented. --- iroh-blobs/src/store/fs.rs | 41 +- iroh-blobs/src/store/fs/import_flat_store.rs | 386 ------------------ iroh-cli/tests/cli.rs | 109 +---- iroh-net/src/magicsock/node_map/node_state.rs | 9 - iroh/src/node/builder.rs | 23 -- 5 files changed, 2 insertions(+), 566 deletions(-) delete mode 100644 iroh-blobs/src/store/fs/import_flat_store.rs diff --git a/iroh-blobs/src/store/fs.rs b/iroh-blobs/src/store/fs.rs index fb6596ef02..94bc137288 100644 --- a/iroh-blobs/src/store/fs.rs +++ b/iroh-blobs/src/store/fs.rs @@ -86,7 +86,6 @@ use smallvec::SmallVec; use tokio::io::AsyncWriteExt; use tracing::trace_span; -mod import_flat_store; mod migrate_redb_v1_v2; mod tables; #[doc(hidden)] @@ -586,11 +585,6 @@ pub(crate) enum ActorMessage { cmd: Export, tx: oneshot::Sender>, }, - /// Modification method: import an entire flat store into the redb store. - ImportFlatStore { - paths: FlatStorePaths, - tx: oneshot::Sender, - }, /// Update inline options UpdateInlineOptions { /// The new inline options @@ -680,8 +674,7 @@ impl ActorMessage { Self::UpdateInlineOptions { .. } | Self::Sync { .. } | Self::Shutdown { .. } - | Self::Fsck { .. } - | Self::ImportFlatStore { .. } => MessageCategory::TopLevel, + | Self::Fsck { .. } => MessageCategory::TopLevel, #[cfg(test)] Self::EntryState { .. } => MessageCategory::ReadOnly, } @@ -698,17 +691,6 @@ enum MessageCategory { pub(crate) type FilterPredicate = Box, AccessGuard) -> Option<(K, V)> + Send + Sync>; -/// Parameters for importing from a flat store -#[derive(Debug)] -pub struct FlatStorePaths { - /// Complete data files - pub complete: PathBuf, - /// Partial data files - pub partial: PathBuf, - /// Metadata files such as the tags table - pub meta: PathBuf, -} - /// Storage that is using a redb database for small files and files for /// large files. #[derive(Debug, Clone)] @@ -756,15 +738,6 @@ impl Store { pub async fn dump(&self) -> io::Result<()> { Ok(self.0.dump().await?) } - - /// Import from a v0 or v1 flat store, for backwards compatibility. - #[deprecated( - since = "0.23.0", - note = "Flat stores are deprecated and future versions will not be able to migrate." - )] - pub async fn import_flat_store(&self, paths: FlatStorePaths) -> io::Result { - Ok(self.0.import_flat_store(paths).await?) - } } #[derive(Debug)] @@ -1001,14 +974,6 @@ impl StoreInner { Ok(rx.await??) } - async fn import_flat_store(&self, paths: FlatStorePaths) -> OuterResult { - let (tx, rx) = oneshot::channel(); - self.tx - .send(ActorMessage::ImportFlatStore { paths, tx }) - .await?; - Ok(rx.await?) - } - async fn update_inline_options( &self, inline_options: InlineOptions, @@ -2193,10 +2158,6 @@ impl ActorState { fn handle_toplevel(&mut self, db: &redb::Database, msg: ActorMessage) -> ActorResult<()> { match msg { - ActorMessage::ImportFlatStore { paths, tx } => { - let res = self.import_flat_store(db, paths); - tx.send(res?).ok(); - } ActorMessage::UpdateInlineOptions { inline_options, reapply, diff --git a/iroh-blobs/src/store/fs/import_flat_store.rs b/iroh-blobs/src/store/fs/import_flat_store.rs deleted file mode 100644 index b80cdd2729..0000000000 --- a/iroh-blobs/src/store/fs/import_flat_store.rs +++ /dev/null @@ -1,386 +0,0 @@ -//! Import a flat store into the redb store -//! -//! This is a separate module since it contains a lot of code that is unrelated -//! to the rest of the redb store. -use std::{ - collections::{BTreeMap, BTreeSet}, - io, - path::{Path, PathBuf}, -}; - -use crate::{ - store::fs::{tables::Tables, DataLocation, EntryState, OutboardLocation}, - util::{raw_outboard_size, Tag}, - IROH_BLOCK_SIZE, -}; - -use super::{ActorResult, ActorState, FlatStorePaths}; -use iroh_base::hash::{Hash, HashAndFormat}; -use redb::ReadableTable; -use std::str::FromStr; - -/// A file name that indicates the purpose of the file. -#[derive(Clone, PartialEq, Eq)] -pub enum FileName { - /// Incomplete data for the hash, with an unique id - PartialData(Hash, [u8; 16]), - /// File is storing data for the hash - Data(Hash), - /// File is storing a partial outboard - PartialOutboard(Hash, [u8; 16]), - /// File is storing an outboard - /// - /// We can have multiple files with the same outboard, in case the outboard - /// does not contain hashes. But we don't store those outboards. - Outboard(Hash), - /// External paths for the hash - Paths(Hash), - /// File is going to be used to store metadata - Meta(Vec), -} - -impl FileName { - /// Get the file purpose from a path, handling weird cases - pub fn from_path(path: impl AsRef) -> std::result::Result { - let path = path.as_ref(); - let name = path.file_name().ok_or("no file name")?; - let name = name.to_str().ok_or("invalid file name")?; - let purpose = Self::from_str(name).map_err(|_| "invalid file name")?; - Ok(purpose) - } -} - -impl FromStr for FileName { - type Err = (); - - fn from_str(s: &str) -> std::result::Result { - const OUTBOARD_EXT: &str = "obao4"; - // split into base and extension - let Some((base, ext)) = s.rsplit_once('.') else { - return Err(()); - }; - // strip optional leading dot - let base = base.strip_prefix('.').unwrap_or(base); - let mut hash = [0u8; 32]; - if let Some((base, uuid_text)) = base.split_once('-') { - let mut uuid = [0u8; 16]; - hex::decode_to_slice(uuid_text, &mut uuid).map_err(|_| ())?; - if ext == "data" { - hex::decode_to_slice(base, &mut hash).map_err(|_| ())?; - Ok(Self::PartialData(hash.into(), uuid)) - } else if ext == OUTBOARD_EXT { - hex::decode_to_slice(base, &mut hash).map_err(|_| ())?; - Ok(Self::PartialOutboard(hash.into(), uuid)) - } else { - Err(()) - } - } else if ext == "meta" { - let data = hex::decode(base).map_err(|_| ())?; - Ok(Self::Meta(data)) - } else { - hex::decode_to_slice(base, &mut hash).map_err(|_| ())?; - if ext == "data" { - Ok(Self::Data(hash.into())) - } else if ext == OUTBOARD_EXT { - Ok(Self::Outboard(hash.into())) - } else if ext == "paths" { - Ok(Self::Paths(hash.into())) - } else { - Err(()) - } - } - } -} - -impl ActorState { - pub(super) fn import_flat_store( - &mut self, - db: &redb::Database, - paths: FlatStorePaths, - ) -> ActorResult { - #[derive(Debug, Default)] - struct EntryPaths { - data: Option<(PathBuf, u64)>, - outboard: Option<(PathBuf, u64)>, - external: Vec<(PathBuf, u64)>, - #[allow(clippy::type_complexity)] - partial: BTreeMap<[u8; 16], (Option<(PathBuf, u64)>, Option<(PathBuf, u64)>)>, - } - - fn copy_outboard(src: &Path, tgt: &Path) -> io::Result<()> { - let mut data = std::fs::read(src)?; - if data.len() % 64 != 8 { - return Err(io::Error::new( - io::ErrorKind::InvalidData, - "outboard without length prefix", - )); - } - data.splice(0..8, []); - std::fs::write(tgt, data) - } - - let FlatStorePaths { - complete: complete_path, - partial: partial_path, - meta: meta_path, - } = &paths; - let mut index = BTreeMap::::new(); - let mut have_partial = false; - let mut have_complete = false; - let mut have_meta = false; - if partial_path.exists() { - tracing::debug!("importing partial data from {:?}", partial_path); - for entry in std::fs::read_dir(partial_path)? { - let entry = entry?; - let path = entry.path(); - if path.is_file() { - let Ok(meta) = entry.metadata() else { - tracing::warn!("unable to open file {}", path.display()); - continue; - }; - let size = meta.len(); - if let Ok(purpose) = FileName::from_path(&path) { - match purpose { - FileName::PartialData(hash, uuid) => { - let m = index.entry(hash).or_default(); - m.partial.entry(uuid).or_default().0 = Some((path, size)); - } - FileName::PartialOutboard(hash, uuid) => { - let m = index.entry(hash).or_default(); - m.partial.entry(uuid).or_default().0 = Some((path, size)); - } - _ => { - // silently ignore other files, there could be a valid reason for them - } - } - } - } - } - have_partial = true; - } - - if complete_path.exists() { - tracing::debug!("importing complete data from {:?}", complete_path); - for entry in std::fs::read_dir(complete_path)? { - let entry = entry?; - let path = entry.path(); - if path.is_file() { - let Ok(meta) = entry.metadata() else { - tracing::warn!("unable to open file {}", path.display()); - continue; - }; - let size = meta.len(); - if let Ok(purpose) = FileName::from_path(&path) { - match purpose { - FileName::Data(hash) => { - let m = index.entry(hash).or_default(); - m.data = Some((path, size)); - } - FileName::Outboard(hash) => { - let m = index.entry(hash).or_default(); - m.outboard = Some((path, size)); - } - FileName::Paths(hash) => { - let m = index.entry(hash).or_default(); - let paths = std::fs::read(path)?; - let paths: BTreeSet = postcard::from_bytes(&paths) - .map_err(|e| io::Error::new(io::ErrorKind::Other, e))?; - for path in paths { - let Ok(meta) = path.metadata() else { - tracing::warn!( - "unable to open external file {}", - path.display() - ); - continue; - }; - m.external.push((path, meta.len())); - } - } - _ => { - // silently ignore other files, there could be a valid reason for them - } - } - } - } - } - have_complete = true; - } - - let txn = db.begin_write()?; - let mut delete_after_commit = Default::default(); - let mut tables = Tables::new(&txn, &mut delete_after_commit)?; - for (hash, entry) in index { - if tables.blobs.get(hash)?.is_some() { - tracing::debug!("hash {} already exists in the db", hash.to_hex()); - continue; - } - if let Some((data_path, data_size)) = entry.data { - let needs_outboard = data_size > IROH_BLOCK_SIZE.bytes() as u64; - let outboard_path = if needs_outboard { - let Some((outboard_path, outboard_size)) = entry.outboard else { - tracing::warn!("missing outboard file for {}", hash.to_hex()); - continue; - }; - if outboard_size != raw_outboard_size(data_size) + 8 { - tracing::warn!("outboard file has wrong size for {}", hash.to_hex()); - continue; - } - Some(outboard_path) - } else { - None - }; - if let Err(cause) = - std::fs::rename(data_path, self.options.path.owned_data_path(&hash)) - { - tracing::error!("failed to move data file: {}", cause); - continue; - } - if let Some(outboard_path) = outboard_path { - if let Err(cause) = copy_outboard( - &outboard_path, - &self.options.path.owned_outboard_path(&hash), - ) { - tracing::error!("failed to move outboard file: {}", cause); - continue; - } - } - let entry = EntryState::Complete { - data_location: DataLocation::Owned(data_size), - outboard_location: if needs_outboard { - OutboardLocation::Owned - } else { - OutboardLocation::NotNeeded - }, - }; - tables.blobs.insert(hash, entry)?; - continue; - } - if !entry.external.is_empty() { - let sizes = entry.external.iter().map(|x| x.1).collect::>(); - if sizes.iter().min() != sizes.iter().max() { - tracing::warn!("external files for {} have different sizes", hash.to_hex()); - continue; - } - let size = sizes[0]; - let needs_outboard = size > IROH_BLOCK_SIZE.bytes() as u64; - let outboard_path = if needs_outboard { - let Some((outboard_path, outboard_size)) = entry.outboard else { - tracing::warn!("missing outboard file for {}", hash.to_hex()); - continue; - }; - if outboard_size != raw_outboard_size(size) + 8 { - tracing::warn!("outboard file has wrong size for {}", hash.to_hex()); - continue; - } - Some(outboard_path) - } else { - None - }; - if let Some(outboard_path) = outboard_path { - if let Err(cause) = copy_outboard( - &outboard_path, - &self.options.path.owned_outboard_path(&hash), - ) { - tracing::error!("failed to move outboard file: {}", cause); - continue; - } - } - let paths = entry - .external - .into_iter() - .map(|(path, _size)| path) - .collect(); - let entry = EntryState::Complete { - data_location: DataLocation::External(paths, size), - outboard_location: if needs_outboard { - OutboardLocation::Owned - } else { - OutboardLocation::NotNeeded - }, - }; - tables.blobs.insert(hash, entry)?; - continue; - } - // partial entries that have data - let partial_with_data = entry - .partial - .into_iter() - .filter_map(|(_k, (d, o))| d.map(|d| (d, o))); - let largest_partial = partial_with_data.max_by_key(|((_, size), _o)| *size); - if let Some(((data_path, data_size), outboard)) = largest_partial { - let needs_outboard = data_size >= IROH_BLOCK_SIZE.bytes() as u64; - let outboard_path = if needs_outboard { - if let Some((outboard_path, _)) = outboard { - Some(outboard_path) - } else { - tracing::warn!( - hash = hash.fmt_short(), - "missing outboard file. assuming empty partial" - ); - None - } - } else { - None - }; - if let Err(cause) = - std::fs::rename(data_path, self.options.path.owned_data_path(&hash)) - { - tracing::error!("failed to move data file: {}", cause); - continue; - } - if let Some(outboard_path) = outboard_path { - if let Err(cause) = copy_outboard( - &outboard_path, - &self.options.path.owned_outboard_path(&hash), - ) { - tracing::error!("failed to move outboard file: {}", cause); - continue; - } - } - let entry = EntryState::Partial { size: None }; - tables.blobs.insert(hash, entry)?; - continue; - } - } - // import tags, this is pretty straightforward - if meta_path.exists() { - tracing::info!("importing metadata from {:?}", meta_path); - let tags_path = meta_path.join("tags.meta"); - if tags_path.exists() { - let data = std::fs::read(&tags_path)?; - #[allow(clippy::mutable_key_type)] - let tags: BTreeMap = postcard::from_bytes(&data) - .map_err(|e| io::Error::new(io::ErrorKind::Other, e))?; - tracing::debug!("loaded tags. {} entries", tags.len()); - for (tag, content) in tags { - tables.tags.insert(tag, content)?; - } - std::fs::remove_file(tags_path).ok(); - }; - have_meta = true; - } - - drop(tables); - txn.commit()?; - - if have_partial { - tracing::trace!("removing flat db partial path {:?}", partial_path); - if let Err(cause) = std::fs::remove_dir_all(partial_path) { - tracing::error!("failed to remove partial path: {}", cause); - } - } - if have_complete { - tracing::trace!("removing flat db complete path {:?}", complete_path); - if let Err(cause) = std::fs::remove_dir_all(complete_path) { - tracing::error!("failed to remove complete path: {}", cause); - } - } - if have_meta { - tracing::trace!("removing flat db meta path {:?}", meta_path); - if let Err(cause) = std::fs::remove_dir_all(meta_path) { - tracing::error!("failed to remove meta path: {}", cause); - } - } - Ok(have_partial || have_complete) - } -} diff --git a/iroh-cli/tests/cli.rs b/iroh-cli/tests/cli.rs index 13a94d88d2..4a443c27d7 100644 --- a/iroh-cli/tests/cli.rs +++ b/iroh-cli/tests/cli.rs @@ -1,7 +1,5 @@ #![cfg(any(target_os = "windows", target_os = "macos", target_os = "linux"))] -use std::collections::BTreeMap; use std::env; -use std::ffi::OsString; use std::io::{BufRead, BufReader, Read}; use std::net::SocketAddr; use std::path::{Path, PathBuf}; @@ -10,11 +8,7 @@ use std::str::FromStr; use anyhow::{ensure, Context, Result}; use bao_tree::blake3; use duct::{cmd, ReaderHandle}; -use iroh::{ - base::ticket::BlobTicket, - blobs::{Hash, HashAndFormat}, - util::path::IrohPaths, -}; +use iroh::{base::ticket::BlobTicket, blobs::Hash, util::path::IrohPaths}; use rand::{RngCore, SeedableRng}; use regex::Regex; use testdir::testdir; @@ -293,107 +287,6 @@ fn cli_provide_from_stdin_to_stdout() -> Result<()> { test_provide_get_loop(Input::Stdin(path), Output::Stdout) } -/// Creates a v0 flat store in the given directory. -fn init_v0_blob_store(iroh_data_dir: &Path) -> anyhow::Result<()> { - let complete_v0 = iroh_data_dir.join("blobs.v0"); - let partial_v0 = iroh_data_dir.join("blobs-partial.v0"); - let meta_v0 = iroh_data_dir.join("blobs-meta.v0"); - std::fs::create_dir_all(&complete_v0)?; - std::fs::create_dir_all(&partial_v0)?; - std::fs::create_dir_all(&meta_v0)?; - let complete = b"complete"; - let partial = vec![0u8; 1024 * 17]; - let complete_hash = blake3::hash(complete).into(); - let partial_hash = blake3::hash(&partial).into(); - let mut tags = BTreeMap::::new(); - tags.insert("complete".to_string(), HashAndFormat::raw(complete_hash)); - tags.insert("partial".to_string(), HashAndFormat::raw(partial_hash)); - let tags = postcard::to_stdvec(&tags)?; - let uuid = [0u8; 16]; - std::fs::write( - complete_v0.join(format!("{}.data", complete_hash.to_hex())), - complete, - )?; - std::fs::write( - partial_v0.join(format!( - "{}-{}.data", - partial_hash.to_hex(), - hex::encode(uuid) - )), - partial, - )?; - std::fs::write( - partial_v0.join(format!( - "{}-{}.obao4", - partial_hash.to_hex(), - hex::encode(uuid) - )), - vec![], - )?; - std::fs::write(meta_v0.join("tags.meta"), tags)?; - Ok(()) -} - -fn run_cli( - iroh_data_dir: impl Into, - args: impl IntoIterator>, -) -> anyhow::Result { - let output = cmd(iroh_bin(), args) - .env_remove("RUST_LOG") - .env("IROH_DATA_DIR", iroh_data_dir) - .stderr_capture() - .stdout_capture() - .unchecked() - .run()?; - - // checking the output first, so you can still view any logging - println!("STDOUT: {}", String::from_utf8_lossy(&output.stdout)); - println!("STDERR: {}", String::from_utf8_lossy(&output.stderr)); - - ensure!( - output.status.success(), - "iroh command failed. See STDERR output above." - ); - - let text = String::from_utf8(output.stdout)?; - Ok(text) -} - -#[test] -fn cli_bao_store_migration() -> anyhow::Result<()> { - let dir = testdir!(); - let iroh_data_dir = dir.join("iroh_data_dir"); - init_v0_blob_store(&iroh_data_dir)?; - let mut reader_handle = cmd(iroh_bin(), ["start"]) - .env_remove("RUST_LOG") - .env("IROH_DATA_DIR", &iroh_data_dir) - .stderr_to_stdout() - .reader()?; - - assert_matches_line( - BufReader::new(&mut reader_handle), - [(r"Iroh is running", 1), (r"Node ID: [_\w\d-]*", 1)], - ); - - println!("iroh started up."); - let tags_output = run_cli(&iroh_data_dir, ["tags", "list"])?; - let expected = r#""complete": 2vfkw5gcrtbybfsczoxq4mae47svtgcgsniwcvoz7xf36nz45yfa (Raw) -"partial": 4yny3v7anmzzsajv2amm3nxpqd2owfw4dqnjwq6anv7nj2djmt2q (Raw) -"#; - assert_eq!(tags_output, expected); - - let blob_output = run_cli(&iroh_data_dir, ["blobs", "list", "blobs"])?; - let expected = r#" 2vfkw5gcrtbybfsczoxq4mae47svtgcgsniwcvoz7xf36nz45yfa (8 B) -"#; - assert_eq!(blob_output, expected); - - let incomplete_blob_output = run_cli(iroh_data_dir, ["blobs", "list", "incomplete-blobs"])?; - let expected = r#"4yny3v7anmzzsajv2amm3nxpqd2owfw4dqnjwq6anv7nj2djmt2q (0 B) -"#; - assert_eq!(incomplete_blob_output, expected); - Ok(()) -} - #[cfg(unix)] #[tokio::test] async fn cli_provide_persistence() -> anyhow::Result<()> { diff --git a/iroh-net/src/magicsock/node_map/node_state.rs b/iroh-net/src/magicsock/node_map/node_state.rs index 110324fe10..3ecaa05acc 100644 --- a/iroh-net/src/magicsock/node_map/node_state.rs +++ b/iroh-net/src/magicsock/node_map/node_state.rs @@ -1300,15 +1300,6 @@ impl RemoteInfo { .min() } - /// Returns the elapsed time since the relay path to the node last received data. - #[deprecated( - since = "0.23.0", - note = "access relay_url.last_alive directly instead" - )] - pub fn last_alive_relay(&self) -> Option { - self.relay_url.as_ref().and_then(|r| r.last_alive) - } - /// Whether there is a possible known network path to the remote node. /// /// Note that this does not provide any guarantees of whether any network path is diff --git a/iroh/src/node/builder.rs b/iroh/src/node/builder.rs index 8858b68e2d..8ca6c05d21 100644 --- a/iroh/src/node/builder.rs +++ b/iroh/src/node/builder.rs @@ -307,29 +307,6 @@ where })?; let docs_storage = DocsStorage::Persistent(IrohPaths::DocsDatabase.with_root(root)); - #[allow(deprecated)] - let v0 = blobs_store - .import_flat_store(iroh_blobs::store::fs::FlatStorePaths { - complete: root.join("blobs.v0"), - partial: root.join("blobs-partial.v0"), - meta: root.join("blobs-meta.v0"), - }) - .await?; - #[allow(deprecated)] - let v1 = blobs_store - .import_flat_store(iroh_blobs::store::fs::FlatStorePaths { - complete: root.join("blobs.v1").join("complete"), - partial: root.join("blobs.v1").join("partial"), - meta: root.join("blobs.v1").join("meta"), - }) - .await?; - if v0 || v1 { - tracing::warn!("Imported deprecated flat data. Future versions will stop supporting migrations from flat stores"); - blobs_store - .update_inline_options(iroh_blobs::store::fs::InlineOptions::default(), true) - .await?; - } - let secret_key_path = IrohPaths::SecretKey.with_root(root); let secret_key = load_secret_key(secret_key_path).await?; From c70caaf48ac39fcfb3b971366a76bff37b493ee9 Mon Sep 17 00:00:00 2001 From: Floris Bruynooghe Date: Wed, 21 Aug 2024 17:55:36 +0200 Subject: [PATCH 2/2] fix(iroh-net): Document the keylog environment variable correctly (#2655) ## Description Also log the fact this is enabled on WARN level. This is pretty important to notice. ## Breaking Changes none ## Notes & open questions ## Change checklist - [x] Self-review. - [x] Documentation updates following the [style guide](https://rust-lang.github.io/rfcs/1574-more-api-documentation-conventions.html#appendix-a-full-conventions-text), if relevant. - ~~[ ] Tests if relevant.~~ - ~~[ ] All breaking changes documented.~~ --- iroh-net/src/endpoint.rs | 2 +- iroh-net/src/tls.rs | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/iroh-net/src/endpoint.rs b/iroh-net/src/endpoint.rs index 5a1154b4d6..74178c0e48 100644 --- a/iroh-net/src/endpoint.rs +++ b/iroh-net/src/endpoint.rs @@ -259,7 +259,7 @@ impl Builder { /// This key should normally remain secret but can be useful to debug networking issues /// by decrypting captured traffic. /// - /// If *keylog* is `true` then setting the `KEYLOGFILE` environment variable to a + /// If *keylog* is `true` then setting the `SSLKEYLOGFILE` environment variable to a /// filename will result in this file being used to log the TLS pre-master keys. pub fn keylog(mut self, keylog: bool) -> Self { self.keylog = keylog; diff --git a/iroh-net/src/tls.rs b/iroh-net/src/tls.rs index e7dafe714f..b95525da4b 100644 --- a/iroh-net/src/tls.rs +++ b/iroh-net/src/tls.rs @@ -5,6 +5,8 @@ use std::sync::Arc; +use tracing::warn; + use crate::key::{PublicKey, SecretKey}; pub mod certificate; @@ -35,6 +37,7 @@ pub fn make_client_config( .expect("Client cert key DER is valid; qed"); crypto.alpn_protocols = alpn_protocols; if keylog { + warn!("enabling SSLKEYLOGFILE for TLS pre-master keys"); crypto.key_log = Arc::new(rustls::KeyLogFile::new()); } @@ -63,6 +66,7 @@ pub fn make_server_config( .expect("Server cert key DER is valid; qed"); crypto.alpn_protocols = alpn_protocols; if keylog { + warn!("enabling SSLKEYLOGFILE for TLS pre-master keys"); crypto.key_log = Arc::new(rustls::KeyLogFile::new()); } Ok(crypto)