Author:
Hash:
Timestamp:
+14 -9 +/-5 browse
Kevin Schoon [me@kevinschoon.com]
f60977bfe80ea90feb323053ead6fb3994721065
Wed, 26 Aug 2026 17:37:39 +0000 (2 weeks ago)
| 1 | diff --git a/examples/session.rs b/examples/session.rs |
| 2 | index 85a974b..7953f1c 100644 |
| 3 | --- a/examples/session.rs |
| 4 | +++ b/examples/session.rs |
| 5 | @@ -54,7 +54,10 @@ fn next(action: Action) { |
| 6 | cb, |
| 7 | } => { |
| 8 | print_response(&initial_response); |
| 9 | - next(cb.call(IpAddr::from_str("127.0.0.1").unwrap(), TEST_EMAIL.as_bytes())); |
| 10 | + next(cb.call( |
| 11 | + IpAddr::from_str("127.0.0.1").unwrap(), |
| 12 | + TEST_EMAIL.as_bytes(), |
| 13 | + )); |
| 14 | } |
| 15 | Action::Envelope { |
| 16 | initial_response, |
| 17 | diff --git a/src/lib.rs b/src/lib.rs |
| 18 | index fd9dd65..86c7cd0 100644 |
| 19 | --- a/src/lib.rs |
| 20 | +++ b/src/lib.rs |
| 21 | @@ -8,10 +8,10 @@ pub use mail_auth; |
| 22 | pub use mail_parser; |
| 23 | pub use smtp_proto; |
| 24 | |
| 25 | - /// Helper module for mutating email messages |
| 26 | - pub mod rewrite; |
| 27 | /// Session EXPN function helper |
| 28 | pub mod expand; |
| 29 | + /// Helper module for mutating email messages |
| 30 | + pub mod rewrite; |
| 31 | /// Low level SMTP session without network transport |
| 32 | pub mod session; |
| 33 | /// Session VRFY function helper |
| 34 | diff --git a/src/server/mod.rs b/src/server/mod.rs |
| 35 | index 2ada76f..dcf03e3 100644 |
| 36 | --- a/src/server/mod.rs |
| 37 | +++ b/src/server/mod.rs |
| 38 | @@ -17,9 +17,9 @@ use tokio::time::timeout; |
| 39 | use tokio_rustls::{rustls, TlsAcceptor}; |
| 40 | use tokio_util::codec::Framed; |
| 41 | |
| 42 | - use crate::plain_auth::PlainAuth; |
| 43 | use crate::delivery::Delivery; |
| 44 | use crate::expand::Expansion; |
| 45 | + use crate::plain_auth::PlainAuth; |
| 46 | use crate::session::{Response, Session}; |
| 47 | use crate::smtp_response; |
| 48 | use crate::verify::Verify; |
| 49 | @@ -213,7 +213,9 @@ impl Server { |
| 50 | } => { |
| 51 | conn.send(initial_response).await?; |
| 52 | match conn.next().await { |
| 53 | - Some(Ok(Command::Payload(payload))) => match cb.call(client_ip, &payload) { |
| 54 | + Some(Ok(Command::Payload(payload))) => match cb |
| 55 | + .call(client_ip, &payload) |
| 56 | + { |
| 57 | crate::session::Action::Send(response) => { |
| 58 | conn.send(response).await?; |
| 59 | } |
| 60 | diff --git a/src/server/opportunistic.rs b/src/server/opportunistic.rs |
| 61 | index eac9503..39cdabe 100644 |
| 62 | --- a/src/server/opportunistic.rs |
| 63 | +++ b/src/server/opportunistic.rs |
| 64 | @@ -6,8 +6,8 @@ use tokio::sync::Mutex; |
| 65 | use tokio_rustls::server::TlsStream; |
| 66 | use tokio_util::codec::Framed; |
| 67 | |
| 68 | - use crate::session::Response; |
| 69 | use super::transport::{Command, Transport, TransportError}; |
| 70 | + use crate::session::Response; |
| 71 | |
| 72 | /// Connection that is either over plain text or TLS |
| 73 | pub(crate) trait Opportunistic { |
| 74 | diff --git a/src/session.rs b/src/session.rs |
| 75 | index 9deeaa7..9b59458 100644 |
| 76 | --- a/src/session.rs |
| 77 | +++ b/src/session.rs |
| 78 | @@ -9,8 +9,8 @@ use mail_parser::{Message, MessageParser}; |
| 79 | use smtp_proto::{EhloResponse, Request, Response as SmtpResponse}; |
| 80 | use url::Host; |
| 81 | |
| 82 | - use crate::plain_auth::{AuthData, AuthError}; |
| 83 | use crate::expand::ExpansionError; |
| 84 | + use crate::plain_auth::{AuthData, AuthError}; |
| 85 | use crate::smtp_response; |
| 86 | use crate::verify::VerifyError; |
| 87 | |
| 88 | @@ -177,7 +177,7 @@ pub mod callback { |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | - /// SMTP VRFY helper |
| 93 | + /// SMTP VRFY helper |
| 94 | pub struct Verify; |
| 95 | |
| 96 | impl Verify { |
| 97 | @@ -189,7 +189,7 @@ pub mod callback { |
| 98 | } |
| 99 | } |
| 100 | |
| 101 | - /// SMTP EXPN helper |
| 102 | + /// SMTP EXPN helper |
| 103 | pub struct Expand; |
| 104 | |
| 105 | impl Expand { |