Tunnels are now always stored in the handler
If tunnel.domain is set that means the tunnel is actually open. This should make it possible to retry a failed tunnel in the future.
This commit is contained in:
@@ -6,22 +6,30 @@ use ratatui::text::Span;
|
||||
use super::{Tunnel, TunnelAccess};
|
||||
|
||||
pub fn header() -> Vec<Span<'static>> {
|
||||
vec!["Access".into(), "Port".into(), "Address".into()]
|
||||
vec![
|
||||
"Name".into(),
|
||||
"Access".into(),
|
||||
"Port".into(),
|
||||
"Address".into(),
|
||||
]
|
||||
}
|
||||
|
||||
pub async fn to_row((address, tunnel): (&String, &Option<Tunnel>)) -> Vec<Span<'static>> {
|
||||
let (access, port) = if let Some(tunnel) = tunnel {
|
||||
let access = match tunnel.access.read().await.deref() {
|
||||
TunnelAccess::Private(owner) => owner.clone().yellow(),
|
||||
TunnelAccess::Protected => "PROTECTED".blue(),
|
||||
TunnelAccess::Public => "PUBLIC".green(),
|
||||
};
|
||||
|
||||
(access, tunnel.port.to_string().into())
|
||||
} else {
|
||||
("FAILED".red(), "".into())
|
||||
pub async fn to_row(tunnel: &Tunnel) -> Vec<Span<'static>> {
|
||||
let access = match tunnel.access.read().await.deref() {
|
||||
TunnelAccess::Private(owner) => owner.clone().yellow(),
|
||||
TunnelAccess::Protected => "PROTECTED".blue(),
|
||||
TunnelAccess::Public => "PUBLIC".green(),
|
||||
};
|
||||
let address = format!("http://{address}").into();
|
||||
|
||||
vec![access, port, address]
|
||||
let address = tunnel
|
||||
.get_address()
|
||||
.map(|address| format!("http://{address}").into())
|
||||
.unwrap_or("FAILED".red());
|
||||
|
||||
vec![
|
||||
tunnel.name.clone().into(),
|
||||
access,
|
||||
tunnel.port.to_string().into(),
|
||||
address,
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user