Skip to main content

Module forwarding

Module forwarding 

Source
Expand description

Port forwarding implementation for bssh

This module provides comprehensive SSH port forwarding capabilities including:

  • Local port forwarding (-L): Forward local port to remote destination via SSH
  • Remote port forwarding (-R): Forward remote port to local destination via SSH
  • Dynamic port forwarding (-D): SOCKS proxy for dynamic destination forwarding

§Architecture

The forwarding system is built around three core components:

  • ForwardingSpec: Parsing and validation of forwarding specifications
  • ForwardingManager: Lifecycle management and coordination of forwards
  • Forwarder: Individual forwarding implementations (local, remote, dynamic)

§Design Principles

  • Async-first: Built on Tokio for maximum concurrency and performance
  • Resource-managed: Proper cleanup and error handling with RAII patterns
  • Multiplexed: Multiple forwards over single SSH connection when possible
  • Resilient: Automatic reconnection with exponential backoff
  • Observable: Comprehensive status reporting and monitoring

Re-exports§

pub use manager::ForwardingId;
pub use manager::ForwardingManager;
pub use manager::ForwardingMessage;
pub use runtime::ForwardingRuntime;
pub use spec::ForwardingSpec;

Modules§

dynamic
Dynamic port forwarding implementation (-D option)
local
Local port forwarding implementation (-L option)
manager
ForwardingManager - Central coordination for port forwarding sessions
remote
Live remote forwarding over russh global requests and forwarded channels.
runtime
Forwarding lifetime attached to one authenticated SSH connection.
spec
Port forwarding specification parsing
tunnel
Bidirectional data tunneling for SSH port forwarding

Structs§

ForwardingConfig
Configuration for port forwarding behavior
ForwardingPlan
Forwarding policy resolved for one destination host.
ForwardingStats
Statistics for a forwarding session

Enums§

ForwardingDirective
One forwarding directive in the order OpenSSH obtained it.
ForwardingStatus
Status of a port forwarding session
ForwardingType
Port forwarding specification types
SocksVersion
SOCKS protocol version for dynamic forwarding

Functions§

parse_bind_spec
Parse a bind address specification with no address family constraint.
parse_bind_spec_with_family
Parse a bind address specification, using address_family to pick the default when the specification does not name an address.