Skip to main content

TunnelState

Struct TunnelState 

Source
pub struct TunnelState { /* private fields */ }
Expand description

Tunnel-owned state grouped off the App god-struct. Contains the rule list, the edit form, the live child-process map, form baseline for the dirty check, the pending delete index and the cached per-host summary strings. Pure state container; behaviour lives on App or on dedicated methods here.

Implementations§

Source§

impl TunnelState

Source

pub fn list(&self) -> &[TunnelRule]

Source

pub fn list_mut(&mut self) -> &mut Vec<TunnelRule>

Source

pub fn form(&self) -> &TunnelForm

Source

pub fn form_mut(&mut self) -> &mut TunnelForm

Source

pub fn reset_form(&mut self)

Source

pub fn active(&self) -> &HashMap<String, ActiveTunnel>

Source

pub fn active_get(&self, alias: &str) -> Option<&ActiveTunnel>

Source

pub fn active_get_mut(&mut self, alias: &str) -> Option<&mut ActiveTunnel>

Source

pub fn active_contains(&self, alias: &str) -> bool

Source

pub fn active_insert(&mut self, alias: String, tunnel: ActiveTunnel)

Source

pub fn active_remove(&mut self, alias: &str) -> Option<ActiveTunnel>

Source

pub fn drain_active(&mut self) -> Drain<'_, String, ActiveTunnel>

Source

pub fn clear_active(&mut self)

Source

pub fn pending_delete(&self) -> Option<usize>

Source

pub fn take_pending_delete(&mut self) -> Option<usize>

Source

pub fn sort_mode(&self) -> TunnelSortMode

Source

pub fn set_sort_mode(&mut self, mode: TunnelSortMode)

Source

pub fn form_baseline(&self) -> Option<&TunnelFormBaseline>

Source

pub fn set_form_baseline(&mut self, baseline: Option<TunnelFormBaseline>)

Source

pub fn demo_live_snapshots(&self) -> &HashMap<String, TunnelLiveSnapshot>

Source

pub fn demo_live_snapshots_mut( &mut self, ) -> &mut HashMap<String, TunnelLiveSnapshot>

Source

pub fn parser_tx(&self) -> Sender<ParserMessage>

Source

pub fn clients(&self) -> &HashMap<u16, Vec<ClientPeer>>

Source

pub fn peer_viz(&self) -> &HashMap<(u16, String), [u64; 12]>

Source

pub fn peer_viz_last_push(&self) -> Option<Instant>

Source

pub fn peer_viz_prev_push(&self) -> Option<Instant>

Source

pub fn summaries_cache(&self) -> &HashMap<String, String>

Source

pub fn summaries_cache_mut(&mut self) -> &mut HashMap<String, String>

Source

pub fn request_delete(&mut self, idx: usize)

Open a delete confirmation for the tunnel at idx. The renderer reads pending_delete to draw the confirm overlay.

Source

pub fn cancel_delete(&mut self)

Dismiss a pending delete confirmation. Idempotent.

Source

pub fn ensure_lsof_poller(&mut self)

Ensure the shared lsof poller is running. Idempotent: a second call after the poller is already up is a noop. Caller is responsible for updating bind_ports afterwards.

Source

pub fn set_lsof_ports(&self, ports: Vec<(String, u16, u32)>)

Replace the lsof poller’s port list. Callers compute the (alias, bind_port, tunnel_pid) tuples from the SSH config directives because ActiveTunnel does not store the rule set directly. The poller picks up the new list on its next iteration.

Source

pub fn poll(&mut self) -> Vec<(String, String, bool)>

Drain the parser channel into per-tunnel live state, drain the lsof channel into the shared clients and conflicts maps, rotate per-tunnel history buckets and finally poll every active child for exit. Returns (alias, message, is_error) tuples so the outer loop can route them through notify_*.

Source

pub fn push_peer_viz(&mut self, now: Instant)

Push one bucket of per-peer braille history. Called exactly once per lsof arrival so the visible window encodes PEER_VIZ_BUCKETS consecutive poll snapshots — long enough to see the trend, short enough to react quickly to changes. The renderer fills in smooth motion between pushes via peer_viz_last_push / peer_viz_prev_push. Garbage-collects entries for peers that no longer appear in self.clients.

Trait Implementations§

Source§

impl Default for TunnelState

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Drop for TunnelState

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V