pub struct ServeContext {
pub vps_name: String,
pub local_port: u16,
pub timeout_ms: u64,
pub json: bool,
pub bind_addr: String,
pub bound_flag: Option<Arc<AtomicBool>>,
pub stats: Option<Arc<TunnelStats>>,
}Expand description
Everything an already-connected client needs to serve one tunnel, minus the mode-specific destination.
§Why a struct (B3)
The three serve entry points below took nine and ten positional parameters,
with u16, u64 and bool sitting next to each other. local_port and
remote_port are both u16; swapping them compiles and binds the wrong
side of the tunnel. The one lint that measures this — too_many_arguments —
was suppressed on all three, so nothing reported it.
Fields§
§vps_name: StringRegistry name of the relay host.
local_port: u16Local port to bind (0 = OS-assigned).
timeout_ms: u64Mandatory deadline in milliseconds.
json: boolAgent-first JSON output.
bind_addr: StringLocal bind address.
bound_flag: Option<Arc<AtomicBool>>Set once the listener is bound (readiness handshake for callers).
stats: Option<Arc<TunnelStats>>Lifetime counters published in the tunnel_closed event.
Auto Trait Implementations§
impl Freeze for ServeContext
impl RefUnwindSafe for ServeContext
impl Send for ServeContext
impl Sync for ServeContext
impl Unpin for ServeContext
impl UnsafeUnpin for ServeContext
impl UnwindSafe for ServeContext
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more