pub struct TestConnection { /* private fields */ }Expand description
A milter test connection.
Implementations§
Source§impl TestConnection
impl TestConnection
Sourcepub fn configure() -> TestConnectionBuilder
pub fn configure() -> TestConnectionBuilder
Returns a builder for a milter test connection.
Sourcepub async fn open(addr: impl ToSocketAddrs) -> TestResult<Self>
pub async fn open(addr: impl ToSocketAddrs) -> TestResult<Self>
Opens and negotiates a test connection to the given socket using default settings.
Shortcut for TestConnection::configure().open_tcp(addr).
Sourcepub fn negotiated_actions(&self) -> Actions
pub fn negotiated_actions(&self) -> Actions
Returns the actions that were negotiated for this connection.
Sourcepub fn negotiated_opts(&self) -> ProtoOpts
pub fn negotiated_opts(&self) -> ProtoOpts
Returns the protocol options that were negotiated for this connection.
Sourcepub fn requested_macros(&self) -> &HashMap<MacroStage, CString>
pub fn requested_macros(&self) -> &HashMap<MacroStage, CString>
Returns the macros that were requested by the milter.
Sourcepub async fn connect(
&mut self,
hostname: impl IntoCString,
socket_info: impl IntoSocketInfo,
) -> TestResult<Status>
pub async fn connect( &mut self, hostname: impl IntoCString, socket_info: impl IntoSocketInfo, ) -> TestResult<Status>
Sends connection information to the milter.
Sourcepub async fn helo(&mut self, hostname: impl IntoCString) -> TestResult<Status>
pub async fn helo(&mut self, hostname: impl IntoCString) -> TestResult<Status>
Sends the HELO/EHLO command to the milter.
Sourcepub async fn mail<I, T>(&mut self, args: I) -> TestResult<Status>where
I: IntoIterator<Item = T>,
T: IntoCString,
pub async fn mail<I, T>(&mut self, args: I) -> TestResult<Status>where
I: IntoIterator<Item = T>,
T: IntoCString,
Sends the MAIL FROM command to the milter.
Sourcepub async fn rcpt<I, T>(&mut self, args: I) -> TestResult<Status>where
I: IntoIterator<Item = T>,
T: IntoCString,
pub async fn rcpt<I, T>(&mut self, args: I) -> TestResult<Status>where
I: IntoIterator<Item = T>,
T: IntoCString,
Sends the RCPT TO command to the milter.
Sourcepub async fn data(&mut self) -> TestResult<Status>
pub async fn data(&mut self) -> TestResult<Status>
Sends the DATA command to the milter.
Sourcepub async fn header(
&mut self,
name: impl IntoCString,
value: impl IntoCString,
) -> TestResult<Status>
pub async fn header( &mut self, name: impl IntoCString, value: impl IntoCString, ) -> TestResult<Status>
Sends a header to the milter.
Sourcepub async fn eoh(&mut self) -> TestResult<Status>
pub async fn eoh(&mut self) -> TestResult<Status>
Sends end-of-header to the milter.
Sourcepub async fn body(&mut self, bytes: impl Into<Bytes>) -> TestResult<Status>
pub async fn body(&mut self, bytes: impl Into<Bytes>) -> TestResult<Status>
Sends a chunk of the message body to the milter.
Sourcepub async fn eom(&mut self) -> TestResult<(EomActions, Status)>
pub async fn eom(&mut self) -> TestResult<(EomActions, Status)>
Sends end-of-message to the milter.
Sourcepub async fn abort(&mut self) -> TestResult<()>
pub async fn abort(&mut self) -> TestResult<()>
Instructs the milter to abort the current message.
Sourcepub async fn unknown(&mut self, arg: impl IntoCString) -> TestResult<Status>
pub async fn unknown(&mut self, arg: impl IntoCString) -> TestResult<Status>
Sends an unknown SMTP command to the milter.
Sourcepub async fn close(self) -> TestResult<()>
pub async fn close(self) -> TestResult<()>
Closes this test connection.
Sourcepub async fn macros<I, K, V>(
&mut self,
stage: MacroStage,
macros: I,
) -> TestResult<()>
pub async fn macros<I, K, V>( &mut self, stage: MacroStage, macros: I, ) -> TestResult<()>
Sends macro definitions to the milter.