eve.net.ssh.forwarding

TCP forwarding bridges coupling EVE sockets to SSH channels.

The bridges sit on top of the existing channel contracts: every byte passes through SshChannel reads/writes and every wakeup runs through the session driver, so flow control, window accounting, and EOF/close semantics stay owned by the SSH layer. Per-direction bridge queues are bounded and couple socket read pause/resume to channel writability.

Half-close propagation is independent in both directions: a socket read EOF becomes a channel sendEof after the queued bytes, and a channel peer EOF becomes a socket write shutdown while socket data keeps flowing into the channel.

Bind, destination, and access decisions are explicit caller policy through EveLocalForwardPolicy and EveForwardedBridgePolicy; no bridge accepts traffic on its own.

Types 7

Bounds and defaults for the forwarding bridges.

bridgeQueueMaxDefault = 256 * 1024Default bounded queue per bridge direction (bytes)
bridgeQueueLowWaterDivisor = 2Bytes at which paused socket reads resume
connectTimeoutMs = 5000Default destination connect timeout

Scheduling surface the bridges need from the session driver.

EveBridgeHost.of adapts an EveSessionDriver; tests may provide their own host.

Fields
void delegate(SshChannel, void delegate()) watchChannelWatches a channel for readable data or send-window relief.
void delegate(SshChannel) unwatchChannelStops watching a channel.
void delegate() requestPumpRequests a coalesced session pump.
void delegate(SshChannelOpenOperation, void delegate(SshChannelOpenOperation)) watchOpenWatches a channel-open operation for terminal completion.
void delegate(SshChannelOpenOperation) unwatchOpenStops watching a channel-open operation.
Token delegate(Duration, void delegate()) registerDeadlineRegisters a one-shot deadline.
void delegate(Token) cancelDeadlineCancels a registered deadline.

Caller-controlled policy for a local forwarding bridge.

Fields
string listenAddressAddress the bridge listens on (bind policy).
ushort listenPortPort to bind; 0 lets the OS allocate one.
string destinationHostDestination host as seen by the SSH server (direct-tcpip).
ushort destinationPortDestination port as seen by the SSH server.
string originatorAddressOriginator identity reported to the SSH server.
ushort originatorPortOriginator port reported to the SSH server.
size_t bridgeQueueMaxBounded queue per bridge direction, in bytes.
bool delegate() admitAccess policy consulted for every accepted socket; returning false closes the connection without opening a channel. A null delegate refuses everything.

Caller-controlled policy for bridging incoming forwarded channels.

Fields
size_t bridgeQueueMaxBounded queue per bridge direction, in bytes.
Duration connectTimeoutTimeout for the destination connection attempt.
bool delegate(scope const SshForwardedChannelInfo info, out string destinationHost, out ushort destinationPort) admitAccess and destination policy consulted for every incoming forwarded channel. Returning false refuses the channel; otherwise destinationHost/destinationPort receive where to connect. A null delegat...

Bridges one EVE TCP connection and one SSH channel.

Data flows in both directions through bounded queues: socket reads pause when the channel-side queue is full and channel reads wait for socket writability. Independent half-closes propagate as described in the module documentation.

Methods
void attachChannel(SshChannel channel)Attaches the SSH channel and starts forwarding.
SshChannel channel() @propertyReturns: the bridged channel (null before attachment).
TcpConnection connection() @propertyReturns: the bridged socket.
void shutdown()Shuts the bridge down: closes the socket and the channel.
bool done() @property constReturns: whether this bridge finished and can be pruned.
void onDone(void delegate(EveChannelSocketBridge) onDone) @propertySets the callback invoked once when the bridge becomes terminal.
Constructors
this(EveBridgeHost host, TcpConnection conn, SshChannel channel = null, size_t queueMax = EveForwardBridgeLimits.bridgeQueueMaxDefault)Constructs a bridge over an established socket.

Local forwarding bridge: a caller-bound TCP listener whose accepted sockets each become one direct-tcpip channel.

The bridge never chooses the bind address, destination, or access decision; those come from EveLocalForwardPolicy.

Fields
EveChannelSocketBridge[] bridgesLive bridges for accepted connections.
Methods
ushort listenPort() @property constReturns: the actually bound listen port (after OS allocation).
void stop()Stops the bridge: closes the listener and every live bridge.
Constructors
this(EveBridgeHost host, ref EventLoop loop, SshSessionImpl session, scope const EveLocalForwardPolicy policy)Binds the listener described by the policy.
Nested Templates
OpeningOne accepted socket waiting for its SSH channel to open.

Destination bridge for incoming forwarded TCP/IP channels.

Implements SshForwardedChannelHandler: each admitted channel triggers a destination connection, and the decision stays PENDING until the connection attempt succeeds or fails. Pass handler to SshSession.setForwardedChannelHandler.

Methods
EveForwardedChannelBridge handler() @propertyThe handler surface to register with the session.
void stop()Shuts every pending and live bridge down and refuses further channels.
Constructors
this(EveBridgeHost host, ref EventLoop loop, scope const EveForwardedBridgePolicy policy)Constructs the bridge.
Nested Templates
Pending

Functions 1

fnEveBridgeHost bridgeHost(EveSessionDriver driver)Adapts an EveSessionDriver into a bridge host.