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 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
Remote port forwarding implementation (-R option)
spec
Port forwarding specification parsing
tunnel
Bidirectional data tunneling for SSH port forwarding

Structs§

ForwardingConfig
Configuration for port forwarding behavior
ForwardingStats
Statistics for a forwarding session

Enums§

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