From 43fbddf016f94f4ba006d82c9a67dca61b5852a1 Mon Sep 17 00:00:00 2001 From: Gab <24553253+gabrix73@users.noreply.github.com> Date: Fri, 14 Aug 2026 20:39:22 +0200 Subject: Complete Nym and YAMN transport integration --- ingress/src/main.rs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'ingress/src') diff --git a/ingress/src/main.rs b/ingress/src/main.rs index 4f8dff6..21da30f 100644 --- a/ingress/src/main.rs +++ b/ingress/src/main.rs @@ -41,7 +41,11 @@ fn dry_run() -> bool { } fn split_address(address: &str) -> Result<(&str, &str)> { - if address.len() > 320 || address.chars().any(|c| matches!(c, '\r' | '\n' | '\0' | ' ')) { + if address.len() > 320 + || address + .chars() + .any(|c| matches!(c, '\r' | '\n' | '\0' | ' ')) + { bail!("invalid entry address"); } let (local, domain) = address @@ -74,7 +78,10 @@ async fn smtp_read_response(reader: &mut BufReader) -> let mut line = String::new(); loop { line.clear(); - let read = reader.read_line(&mut line).await.context("read SMTP response")?; + let read = reader + .read_line(&mut line) + .await + .context("read SMTP response")?; if read == 0 { bail!("SMTP connection closed"); } @@ -113,9 +120,7 @@ async fn smtp_command( async fn deliver(entry_address: &str, payload: &[u8]) -> Result<()> { let (_, host) = split_address(entry_address)?; let proxy = env::var("YAMN_TOR_SOCKS").unwrap_or_else(|_| "127.0.0.1:9050".to_string()); - let (proxy_host, proxy_port) = proxy - .rsplit_once(':') - .context("invalid YAMN_TOR_SOCKS")?; + let (proxy_host, proxy_port) = proxy.rsplit_once(':').context("invalid YAMN_TOR_SOCKS")?; let proxy_port: u16 = proxy_port.parse().context("invalid YAMN_TOR_SOCKS port")?; let target = format!("{host}:25"); let stream = tokio::time::timeout( @@ -136,12 +141,7 @@ async fn deliver(entry_address: &str, payload: &[u8]) -> Result<()> { bail!("invalid YAMN_INGRESS_FROM"); } smtp_command(&mut reader, b"EHLO yamn-nym-ingress\r\n", 2).await?; - smtp_command( - &mut reader, - format!("MAIL FROM:{from}\r\n").as_bytes(), - 2, - ) - .await?; + smtp_command(&mut reader, format!("MAIL FROM:{from}\r\n").as_bytes(), 2).await?; smtp_command( &mut reader, format!("RCPT TO:<{entry_address}>\r\n").as_bytes(), -- cgit v1.2.3