Skip to main content

Module control

Module control 

Source
Expand description

Port forwarding control via ControlMaster sessions.

Structs§

ControlSession
A discovered ControlMaster session.
PortForward
A single active port forward on a ControlMaster session.

Enums§

ForwardType
Whether a forward is local (-L), remote (-R), or dynamic/SOCKS (-D).

Functions§

cancel_forward
Cancel the forward on local_port (lists first to find its spec); an inherent TOCTOU race means it may vanish before the cancel lands.
cancel_known_forward
Cancel a known forward directly, skipping the list round-trip; the spec is [addr]:lport[:rhost:rport], with an empty rhost sent as localhost.
exit_session
Close a ControlMaster session (ssh -O exit); the socket file is unlinked asynchronously, so re-check the path before assuming removal.
list_forwards
List active port forwards on a ControlMaster session.
list_forwards_bounded
Run list_forwards for many control paths with bounded ssh -O list spawns; results in input order, one failure never cancels the others.
list_sessions
Discover live ControlMaster sessions by scanning ssh_dir prefixes (cm-, control-, mux-, ctrl-) and /tmp/ssh-* via ssh -O check.