Struct vsmtp_server::Connection
[−]pub struct Connection<S> where
S: AsyncRead + AsyncWrite + Send + Unpin + Debug, {
pub kind: ConnectionKind,
pub server_name: String,
pub timestamp: SystemTime,
pub is_alive: bool,
pub config: Arc<Config>,
pub client_addr: SocketAddr,
pub server_addr: SocketAddr,
pub error_count: i64,
pub is_secured: bool,
pub is_authenticated: bool,
pub authentication_attempt: i64,
pub inner: AbstractIO<S>,
}Expand description
Instance containing connection to the server’s information
Fields
kind: ConnectionKindserver’s port
server_name: Stringserver’s domain of the connection, (from config.server.domain or sni)
timestamp: SystemTimeconnection timestamp
is_alive: boolis still alive
config: Arc<Config>server’s configuration
client_addr: SocketAddrpeer socket address
server_addr: SocketAddraddress used for this connection
error_count: i64number of error the client made so far
is_secured: boolis under tls (tunneled or opportunistic)
is_authenticated: boolhas completed SASL challenge (AUTH)
authentication_attempt: i64number of time the AUTH command has been received (and failed)
inner: AbstractIO<S>inner stream
Implementations
impl<S> Connection<S> where
S: AsyncRead + AsyncWrite + Send + Unpin + Debug,
impl<S> Connection<S> where
S: AsyncRead + AsyncWrite + Send + Unpin + Debug,
pub fn new(
kind: ConnectionKind,
client_addr: SocketAddr,
server_addr: SocketAddr,
config: Arc<Config>,
inner: S
) -> Self
pub fn new(
kind: ConnectionKind,
client_addr: SocketAddr,
server_addr: SocketAddr,
config: Arc<Config>,
inner: S
) -> Self
pub fn new_with(
kind: ConnectionKind,
server_name: String,
timestamp: SystemTime,
config: Arc<Config>,
client_addr: SocketAddr,
server_addr: SocketAddr,
error_count: i64,
is_secured: bool,
is_authenticated: bool,
authentication_attempt: i64,
inner: S
) -> Self
pub fn new_with(
kind: ConnectionKind,
server_name: String,
timestamp: SystemTime,
config: Arc<Config>,
client_addr: SocketAddr,
server_addr: SocketAddr,
error_count: i64,
is_secured: bool,
is_authenticated: bool,
authentication_attempt: i64,
inner: S
) -> Self
impl<S> Connection<S> where
S: AsyncRead + AsyncWrite + Send + Unpin + Debug,
impl<S> Connection<S> where
S: AsyncRead + AsyncWrite + Send + Unpin + Debug,
pub async fn send_reply_or_code(
&mut self,
reply_or_code: ReplyOrCodeID
) -> Result<()>
pub async fn send_reply_or_code(
&mut self,
reply_or_code: ReplyOrCodeID
) -> Result<()>
pub async fn send_reply(&mut self, reply: Reply) -> Result<()>
pub async fn send_reply(&mut self, reply: Reply) -> Result<()>
send a reply code to the client
Errors
impl<S> Connection<S> where
S: AsyncRead + AsyncWrite + Send + Unpin + Sync + Debug,
impl<S> Connection<S> where
S: AsyncRead + AsyncWrite + Send + Unpin + Sync + Debug,
pub async fn receive<M>(
&mut self,
tls_config: Option<Arc<ServerConfig>>,
rsasl: Option<Arc<Mutex<Backend>>>,
rule_engine: Arc<RuleEngine>,
resolvers: Arc<Resolvers>,
mail_handler: &mut M
) -> Result<()> where
M: OnMail + Send,
pub async fn receive<M>(
&mut self,
tls_config: Option<Arc<ServerConfig>>,
rsasl: Option<Arc<Mutex<Backend>>>,
rule_engine: Arc<RuleEngine>,
resolvers: Arc<Resolvers>,
mail_handler: &mut M
) -> Result<()> where
M: OnMail + Send,
Receives the incomings mail of a connection
Errors
- server failed to send a message
- a transaction failed
- the pre-queue processing of the mail failed
Trait Implementations
Auto Trait Implementations
impl<S> !RefUnwindSafe for Connection<S>
impl<S> Send for Connection<S>
impl<S> Sync for Connection<S> where
S: Sync,
impl<S> Unpin for Connection<S>
impl<S> !UnwindSafe for Connection<S>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more