summaryrefslogtreecommitdiff
path: root/crates/utils
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2025-11-03 18:49:06 +0800
committer魏曹先生 <1992414357@qq.com>2025-11-03 18:49:06 +0800
commit40df512c3fb11a769ae57692550c23899c28fe75 (patch)
treec62151e03893b93fd63ed8729c063acdecec7552 /crates/utils
parenteb80c53983e4802384b95a9adc74756c13bd726a (diff)
update: Registry and connection improvements
- Update client and server registry logic - Improve TCP connection instance handling
Diffstat (limited to 'crates/utils')
-rw-r--r--crates/utils/tcp_connection/src/instance_challenge.rs16
1 files changed, 15 insertions, 1 deletions
diff --git a/crates/utils/tcp_connection/src/instance_challenge.rs b/crates/utils/tcp_connection/src/instance_challenge.rs
index c4ea6a8..3a7f6a3 100644
--- a/crates/utils/tcp_connection/src/instance_challenge.rs
+++ b/crates/utils/tcp_connection/src/instance_challenge.rs
@@ -132,7 +132,21 @@ impl ConnectionInstance {
self.stream.read_exact(&mut challenge).await?;
// Load private key
- let private_key_pem = tokio::fs::read_to_string(&private_key_file).await?;
+ let private_key_pem = tokio::fs::read_to_string(&private_key_file)
+ .await
+ .map_err(|e| {
+ TcpTargetError::NotFound(format!(
+ "Read private key \"{}\" failed: \"{}\"",
+ private_key_file
+ .as_ref()
+ .display()
+ .to_string()
+ .split("/")
+ .last()
+ .unwrap_or("UNKNOWN"),
+ e
+ ))
+ })?;
// Sign the challenge with supported key types
let signature = if let Ok(rsa_key) = RsaPrivateKey::from_pkcs1_pem(&private_key_pem) {