mirror of
https://github.com/mailscope/kumomta.git
synced 2026-09-13 05:52:13 +00:00
adopt more compact representation of ResolvedAddress in logs/diagnostics
Previously we'd use the Debug impl of ResolvedAddress, which rendered
like `ResolvedAddress { name: "some.host.", addr: "10.0.0.1" }`, which
is a bit heavyweight when it shows up in a log where we're indicating
that none of the hosts could be connected.
This commit adds a Display impl that renders that same struct in a
more compact form: `some.host./10.0.0.1`.
This commit is contained in:
@@ -18,6 +18,12 @@ pub struct ResolvedAddress {
|
||||
pub addr: IpAddr,
|
||||
}
|
||||
|
||||
impl std::fmt::Display for ResolvedAddress {
|
||||
fn fmt(&self, fmt: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
write!(fmt, "{}/{}", self.name, self.addr)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Copy, Clone, Eq, PartialEq, Hash, Ord, PartialOrd)]
|
||||
pub enum RecordType {
|
||||
/// Recorded by a receiving listener
|
||||
|
||||
@@ -179,7 +179,7 @@ impl SmtpDispatcher {
|
||||
detail: 4,
|
||||
}),
|
||||
content: format!(
|
||||
"{addr:?} is on the list of prohibited_hosts {:?}",
|
||||
"{addr} is on the list of prohibited_hosts {:?}",
|
||||
path_config.prohibited_hosts
|
||||
),
|
||||
command: None,
|
||||
@@ -276,10 +276,10 @@ impl SmtpDispatcher {
|
||||
.egress_source
|
||||
.remote_port
|
||||
.unwrap_or(path_config.smtp_port);
|
||||
let connect_context = format!("connect to {address:?} port {port} and read initial banner");
|
||||
let connect_context = format!("connect to {address} port {port} and read initial banner");
|
||||
|
||||
self.tracer.diagnostic(Level::INFO, || {
|
||||
format!("Attempting connection to {address:?} port {port}")
|
||||
format!("Attempting connection to {address} port {port}")
|
||||
});
|
||||
|
||||
let make_connection = {
|
||||
@@ -301,7 +301,7 @@ impl SmtpDispatcher {
|
||||
.await?;
|
||||
|
||||
tracing::debug!(
|
||||
"connected to {address:?} port {port} via source address {source_address:?}"
|
||||
"connected to {address} port {port} via source address {source_address:?}"
|
||||
);
|
||||
|
||||
let mut client = SmtpClient::with_stream(stream, &mx_host, timeouts);
|
||||
@@ -341,7 +341,7 @@ impl SmtpDispatcher {
|
||||
let pretls_caps = client
|
||||
.ehlo(&ehlo_name)
|
||||
.await
|
||||
.with_context(|| format!("{address:?}:{port}: EHLO after banner"))?;
|
||||
.with_context(|| format!("{address}:{port}: EHLO after banner"))?;
|
||||
|
||||
// Use STARTTLS if available.
|
||||
let has_tls = pretls_caps.contains_key("STARTTLS");
|
||||
@@ -493,7 +493,7 @@ impl SmtpDispatcher {
|
||||
{
|
||||
TlsStatus::FailedHandshake(handshake_error) => {
|
||||
tracing::debug!(
|
||||
"TLS handshake with {address:?}:{port} failed: \
|
||||
"TLS handshake with {address}:{port} failed: \
|
||||
{handshake_error}, but continuing in clear text because \
|
||||
we are in OpportunisticInsecure mode"
|
||||
);
|
||||
@@ -518,7 +518,7 @@ impl SmtpDispatcher {
|
||||
self.remember_broken_tls(&dispatcher.name, &path_config);
|
||||
OpportunisticInsecureTlsHandshakeError {
|
||||
error,
|
||||
address: format!("{address:?}:{port}"),
|
||||
address: format!("{address}:{port}"),
|
||||
label,
|
||||
}
|
||||
})?;
|
||||
|
||||
@@ -10,6 +10,11 @@
|
||||
|
||||
* Updated embedded libunbound to 1.22
|
||||
|
||||
* Use more compact representation of ResolvedAddress in logs. Instead of
|
||||
showing something like `ResolvedAddress { name: "some.host.", addr: 10.0.0.1 }`
|
||||
we now display it as `some.host./10.0.0.1` which is a bit easier to
|
||||
understand and occupies less space in the logs.
|
||||
|
||||
## Fixes
|
||||
|
||||
* When `enable_tls` is set to `Required` or `RequiredInsecure`, ignore the
|
||||
|
||||
Reference in New Issue
Block a user