impl fmt::Display for FedDest
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
9df5265c00
commit
ba48758b89
2 changed files with 11 additions and 1 deletions
|
@ -448,7 +448,7 @@ pub(crate) async fn resolve_true_destination(
|
||||||
let (actual_dest, hostname_uri) = resolve_actual_dest(&server_name, no_cache).await?;
|
let (actual_dest, hostname_uri) = resolve_actual_dest(&server_name, no_cache).await?;
|
||||||
|
|
||||||
Ok(RoomMessageEventContent::text_plain(format!(
|
Ok(RoomMessageEventContent::text_plain(format!(
|
||||||
"Actual destination: {actual_dest:?} | Hostname URI: {hostname_uri}"
|
"Actual destination: {actual_dest} | Hostname URI: {hostname_uri}"
|
||||||
)))
|
)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
use std::{
|
use std::{
|
||||||
|
fmt,
|
||||||
fmt::Debug,
|
fmt::Debug,
|
||||||
net::{IpAddr, SocketAddr},
|
net::{IpAddr, SocketAddr},
|
||||||
};
|
};
|
||||||
|
@ -414,6 +415,15 @@ impl FedDest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl fmt::Display for FedDest {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
|
match self {
|
||||||
|
FedDest::Named(host, port) => write!(f, "{host}{port}"),
|
||||||
|
FedDest::Literal(addr) => write!(f, "{addr}"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::{add_port_to_hostname, get_ip_with_port, FedDest};
|
use super::{add_port_to_hostname, get_ip_with_port, FedDest};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue