Highlight port in red if tunnel failed to open

This commit is contained in:
2025-04-18 14:57:31 +02:00
parent 75bfd4d5cf
commit 95e47c708c
3 changed files with 23 additions and 3 deletions

View File

@@ -40,7 +40,12 @@ impl TunnelInner {
&self.internal_address,
self.port,
)
.await?;
.await
.inspect_err(|_| {
self.stats.set_failed(true);
})?;
self.stats.set_failed(false);
Ok(TrackStats::new(channel.into_stream(), self.stats.clone()))
}

View File

@@ -17,9 +17,15 @@ pub struct TunnelRow {
impl From<&TunnelRow> for Vec<Span<'static>> {
fn from(row: &TunnelRow) -> Self {
let port = if row.stats.failed() {
row.port.clone().red()
} else {
row.port.clone()
};
vec![
row.name.clone(),
row.port.clone(),
port,
row.access.clone(),
row.address.clone(),
row.stats.connections().to_string().into(),