ddn.api.net.ssh

DDN SSH API.

This module defines the public contracts for SSH-2 client connections: the transport abstraction the protocol engine runs on, non-blocking progress and result types, typed errors, session lifecycle and driving, host-key verification, asynchronous signing for public-key authentication, and multiplexed channels with flow-control visibility.

Implementations are provided by separate packages (for example ddn-net-ssh); consumers of channels - such as an SFTP client - depend only on the interfaces defined here.

The API is non-blocking throughout: every potentially-blocking operation reports SshProgress, and the caller re-drives the owning session when the reported wait is satisfied.

Types 43

enumSshIoResult : ptrdiff_t

Result codes for raw transport operations.

Mirrors the convention used by the other ddn.api.net transports, declared locally so this module does not depend on the TLS API.

WOULD_BLOCK = - 1Operation would block, try again later
CLOSED = - 2Connection closed by peer (mid-stream closure, not clean EOF)
ERROR = - 3An error occurred

Progress indicator for non-blocking SSH operations.

Every potentially-blocking operation returns or reports an SshProgress value instead of blocking. The caller checks the result and re-drives the owning session when the corresponding wait is satisfiable.

DONEOperation completed successfully
NEED_READNeed to read from the session transport before continuing
NEED_WRITENeed to write to the session transport before continuing
NEED_IONeed to read from or write to the session transport
WAITWaiting on something other than session transport readiness: an application decision (host-key verdict, credential, prompt), an application-owned signer or agent transport, or a timer. Query the ow...
ERRORA fatal error occurred; the session or channel is unusable
structSshError

Typed error information for SSH operations.

Used by SshResult, operations, channels, and sessions to report failures without exceptions. Error reporting is per operation or per channel; a session-level error only exists for conditions that make the whole connection unusable.

Fields
SshErrorType typeThe error category
string messageHuman-readable error message
ushort reasonCodeSSH disconnect reason code when the error carries one (RFC 4250 assigned numbers), zero otherwise.
Methods
bool isNone() const pure nothrow @safe @nogcReturns: true if no error has occurred.
Nested Templates
SshErrorTypeCategories of SSH errors.
structSshResult

Result of an SSH read or write operation.

Combines a byte count with progress information, optional typed error details, and an end-of-stream flag.

Result conventions:

  • Positive bytes: number of bytes transferred.
  • progress == DONE with bytes == 0 and

    eof == true unambiguously means end of stream. Idle reads with nothing available never report DONE; they report NEED_READ or WAIT.

  • A zero-length buffer is a no-op that returns immediately with

    DONE and bytes == 0; it is distinct from both an idle read and end of stream.

  • Bytes reported as accepted by a write must never be resubmitted

    by the caller; the sender tracks the remainder.

Fields
ptrdiff_t bytesBytes transferred (positive), or 0 on EOF/error/idle
SshProgress progressProgress indicator
SshError errorError details (valid when progress == ERROR)
bool eofTrue when the peer signalled end of stream for this direction
Methods
bool done() const pure nothrow @safe @nogcReturns: true if the operation completed (successfully or EOF).
bool wouldBlock() const pure nothrow @safe @nogcReturns: true if the caller should retry after session transport readiness.
bool waiting() const pure nothrow @safe @nogcReturns: true if the caller should retry after the non-transport wait reported by the owning session was satisfied.
bool isEof() const pure nothrow @safe @nogcReturns: true if end of stream was reached.
interfaceSshTransport

Ordered byte transport underlying an SSH connection.

Implementations wrap a socket, a pipe, an in-memory buffer, or any other ordered stream. The SSH protocol engine performs all of its network interaction through this interface; it never opens sockets by itself, which keeps it embeddable in any event loop and testable on memory transports.

Return Value Convention:

  • Positive value: number of bytes read/written.
  • Zero (0): clean end-of-file, peer closed the connection.
  • Negative value: an SshIoResult code indicating

    error or would-block.

Methods
ptrdiff_t read(ubyte[] buffer)Reads raw bytes from the underlying transport.
ptrdiff_t write(const(ubyte)[] data)Writes raw bytes to the underlying transport.
void flush()Flushes any buffered output data.
void close()Closes the underlying transport.
bool isOpen() @property const;Returns: whether the transport is still open.

Lifecycle states of an SSH session.

A session moves forward through these states as SshSession.pump is driven; it never moves backward except to FAILED or DISCONNECTED, which are terminal.

CREATEDConstructed and configurable, handshake not yet started
VERSION_EXCHANGEExchanging SSH identification strings
KEY_EXCHANGERunning algorithm negotiation and key exchange
ESTABLISHEDTransport established and protected (NEWKEYS completed on both directions); user authentication has not completed.
AUTHENTICATINGA user authentication operation is in flight
AUTHENTICATEDUser authentication completed successfully
DISCONNECTINGDisconnect message sent or received, teardown in progress
DISCONNECTEDSession over, transport closed
FAILEDUnrecoverable failure; consult SshSession.sessionError

Kinds of waits an SSH session can report to its driver.

NONENo outstanding wait; there is pending work or the session is idle
IOSession transport readiness is required (see the readiness flags)
DECISIONAn application-owned wait is required: a host-key verdict, a credential or prompt answer, or readiness of an application-provided signer (agent) transport. The session transport alone cannot make p...
TIMERA timer deadline must expire before the session can progress

What the driver of a session should wait for when pumping cannot progress without external action.

For SshWaitKind.IO the flags select the readiness events of the session transport supplied by the application. Agent or signer I/O is application-owned and surfaces as SshWaitKind.DECISION; the application queries its signer for the concrete readiness it needs.

Fields
SshWaitKind kindThe kind of wait currently blocking progress
bool needReadSession transport readability is required (valid for IO)
bool needWriteSession transport writability is required (valid for IO)
bool hasDeadlineWhether deadline carries a meaningful absolute time. Valid for every wait kind: an IO or DECISION wait may also carry a timeout (keepalive, rekey, or handshake deadline) after which the driver must...
MonoTime deadlineAbsolute monotonic deadline the driver should sleep until. Valid only when hasDeadline is true; for every other case the value is unspecified and must not be used.

Algorithm preference lists for session negotiation.

Lists are ordered from most to least preferred. Cipher and MAC preferences apply to both directions. MAC preferences are used only when the selected cipher requires a separate MAC.

Names are SSH wire names (for example curve25519-sha256); unknown peer names are parsed safely and reported through negotiation results and diagnostics rather than crashing the session.

Fields
string[] kexPreferred key exchange methods, most preferred first
string[] hostKeyAccepted host key / signature algorithms, most preferred first
string[] cipherPreferred bulk ciphers (both directions), most preferred first
string[] macPreferred MACs for non-AEAD ciphers; may be empty
string[] compressionAccepted compression algorithms; the initial profile is none only
Methods
SshAlgorithmPreferences recommended() static pure @safeReturns: the recommended qualified preferences: the side-channel-qualified initial profile first, then the interoperable Phase 12 alternatives whose secret-bearing paths remain qualified only as ex...

Algorithms actually negotiated for a session.

Directional entries reflect the independent per-direction negotiation of the SSH transport protocol.

Fields
string kexNegotiated key exchange method
string hostKeyNegotiated host key / signature algorithm
string cipherC2SNegotiated client-to-server cipher
string cipherS2CNegotiated server-to-client cipher
string macC2SNegotiated client-to-server MAC (empty for AEAD ciphers)
string macS2CNegotiated server-to-client MAC (empty for AEAD ciphers)
string compressionC2SNegotiated client-to-server compression
string compressionS2CNegotiated server-to-client compression

An SSH-2 client connection driven by explicit pumping.

Ownership and threading rules:

  • The session owns all protocol state for the connection and

    advances all channels, key exchange, rekey, authentication operations, and control messages when pumped.

  • Sessions are single-threaded and non-reentrant: callbacks

    invoked during pump must not call back into the session.

  • The session references - but does not own - the supplied

    SshTransport; the application keeps the transport alive until the session reaches a terminal state.

Driving model:

  • Call pump whenever any wait reported by

    waitState is satisfied, or to make initial progress.

  • pump performs pending non-blocking I/O on the session

    transport and returns the aggregate progress; when it cannot proceed, waitState describes what the driver should wait for (transport readiness, an application decision, or a timer deadline).

  • A blocked channel write may require reading the session

    transport (window adjustment), not transport writability; the session accounts for this when reporting waits.

An in-flight session-level global request (RFC 4254 section 4).

Global request replies arrive in request order without identifiers, so the session issues them strictly one reply at a time.

Methods
SshProgress progress() @property const;Returns: current progress of the request.
bool done() @property const;Returns: whether the request reached a terminal state.
SshError error() @property const;Returns: the failure details when the request failed or was rejected.
bool accepted() @property const;Returns: Whether the peer accepted the request; meaningful once done.
void cancel()Cancels the attempt; delivery that already happened is not undone.

A remote TCP/IP forward request (tcpip-forward).

Methods
ushort boundPort() @property const;Returns: the bound port allocated by the server. When port 0 was requested this is the allocated port; otherwise the requested port. Zero while the request is pending or refused.

Identity of an incoming forwarded TCP/IP channel (RFC 4254 7.2).

Fields
string boundAddressAddress the server accepted the TCP connection on
ushort boundPortPort the server accepted the TCP connection on (the bound port)
string originatorAddressAddress of the connecting TCP peer
ushort originatorPortPort of the connecting TCP peer

Decision states for an incoming forwarded channel.

PENDINGNot decided yet; the session asks again on later pumps
ACCEPTAccept the channel
REFUSERefuse the channel

The caller's decision for an incoming forwarded channel.

Fields
SshForwardAcceptStatus statusThe decision state; defaults to refuse

Caller-controlled bind/accept policy for remote TCP forwarding.

The handler decides every incoming forwarded channel; the session never accepts one on its own. While decideForwardedChannel reports PENDING the request stays queued and is asked again on later pump calls; the queue is bounded and overflow is refused.

Methods
SshForwardAcceptResult decideForwardedChannel( scope const SshForwardedChannelInfo info, SshChannel channel)Decides whether to accept an incoming forwarded TCP/IP channel.
interfaceSshSession
Methods
SshSessionState state() @property const;Returns: the current lifecycle state.
SshError sessionError() @property const;Returns: the session-fatal error once the state is FAILED. Per-operation and per-channel errors are reported on the affected operation or channel instead.
SshTransport transport() @propertyReturns: the transport this session runs on.
void setAlgorithmPreferences(scope const SshAlgorithmPreferences prefs)Sets algorithm preferences. Legal only before the handshake starts; later calls are rejected with an SshError.CAPABILITY-style exception in the implementation.
void setClock(MonoTime delegate() clock)Sets the monotonic clock used for keepalive, rekey, and handshake deadlines. Tests inject a deterministic clock; the default is the wall-clock MonoTime.currTime.
void setKeepAlive(Duration interval)Enables or disables keepalive messages.
SshProgress pump()Advances all session state machines.
SshWaitState waitState() @property const;Returns: what the driver should wait for while pump cannot progress without external action.
bool rekeying() @property const;Returns: whether a key re-exchange is currently in progress.
void requestRekey()Requests a key re-exchange at the next legal opportunity. The request is asynchronous; rekeying reflects when it starts.
string peerIdentification() @property const;Returns: the peer's SSH software identification string (for example OpenSSH_10.0), once version exchange completed.
SshNegotiatedAlgorithms negotiated() @property const;Returns: the algorithms negotiated for this session, once algorithm negotiation completed.
void setHostKeyVerifier(SshHostKeyVerifier verifier)Installs the host-key verifier consulted during the initial key exchange and on every rekey. No credentials are transmitted and no signer is invoked until the host key has been accepted.
SshAuthOperation discoverAuthenticationMethods()Discovers the authentication methods currently accepted by the server.
SshAuthOperation authenticatePublicKey(SshSigner signer)Starts (or resumes) public-key authentication with an application-owned signer.
SshAuthOperation authenticatePassword(SshPasswordProvider provider)Starts (or resumes) password authentication with an application-owned credential provider.
SshAuthOperation authenticateKeyboardInteractive( SshKeyboardInteractiveProvider provider)Starts (or resumes) keyboard-interactive authentication with an application-owned, UI-neutral challenge provider.
SshChannelOpenOperation openSessionChannel( scope const SshChannelOpenOptions options = SshChannelOpenOptions.init)Opens a new session channel for exec, shell, or subsystem requests.
SshChannelOpenOperation openDirectTcpIpChannel(string host, ushort port, string originatorAddress, ushort originatorPort, scope const SshChannelOpenOptions options = SshChannelOpenOptions .init)Opens a direct TCP/IP channel to a destination reachable from the server.
void setForwardedChannelHandler(SshForwardedChannelHandler handler)Registers the policy for incoming forwarded TCP/IP channels.
SshRemoteForwardOperation requestRemoteForward(string bindAddress, ushort bindPort)Requests a remote TCP/IP listener (tcpip-forward).
SshGlobalRequestOperation cancelRemoteForward(string bindAddress, ushort bindPort)Cancels a remote TCP/IP listener (cancel-tcpip-forward).
size_t channelCount() @property const;Returns: the number of currently open channels.
void disconnect(ushort reason, string description)Disconnects the session.

Information about a server host key offered for verification.

Fields
string algorithmHost key algorithm name (for example ssh-ed25519)
const(ubyte)[] blobRaw host key blob as transmitted
string fingerprintSha256Unpadded base64 SHA-256 fingerprint of blob

Verdict of an application host-key policy.

PENDINGNo decision yet; the verifier will be asked again on later pumps
ACCEPTTrust this host key
REJECTReject this host key; the session fails with an SshError.HOST_KEY-typed error.

Application-supplied host trust policy.

The session consults the verifier during the initial key exchange and on every rekey, always before any credential or signing request. Implementations must not block; interactions that need user input return SshVerdict.PENDING and answer on a later poll.

Methods
SshVerdict verifyHostKey(scope const SshHostKeyInfo info)Asks for a verdict on the offered host key.

A public key offered for public-key authentication.

Fields
string algorithmKey format name as used in the key blob (for example ssh-rsa)
const(ubyte)[] blobRaw public key blob
string commentOptional key comment

Result of an asynchronous signing request.

Fields
SshProgress progressDONE with a signature, WAIT to be asked again, or ERROR
SshError errorError details (valid when progress == ERROR)
const(ubyte)[] signatureSignature blob (valid when progress == DONE)
string signatureAlgorithmSignature algorithm of signature (valid when DONE)
Methods
bool done() const pure nothrow @safe @nogcReturns: true when the signature is available.
bool waiting() const pure nothrow @safe @nogcReturns: true when the signer must be polled again later.
interfaceSshSigner

Application-owned signer for public-key authentication.

Implementations wrap an in-memory private key or - asynchronously - an ssh-agent. Signatures cover the exact session-bound authentication request data supplied by the session, so a signature can never be replayed against another session.

Implementations must not block. An agent-backed signer reports SshProgress.WAIT while its own transport is pending; the application drives that transport independently of the session.

Methods
SshPublicKeyInfo publicKey() @property const;Returns: the public key to offer, never null.
SshSignResult sign(scope const(ubyte)[] requestData, string signatureAlgorithm)Signs the given request data with the requested signature algorithm, continuing a pending operation when called again.

Outcome of polling a password provider.

PENDINGNo password available yet; poll again later
PROVIDEDA password is available in this result
REFUSEDThe provider refuses or has no password; abort the attempt

Result of polling an SshPasswordProvider.

Fields
SshPasswordStatus statusPoll outcome
string passwordThe password (valid when status == PROVIDED)

Application-owned password source.

Implementations must not block; user interaction returns SshPasswordStatus.PENDING until the answer is available. Password-change-required responses from the server are surfaced as a distinct authentication error; the provider is never re-polled indefinitely for them.

Methods
SshPasswordResult password()Returns: The current password state; poll again after PENDING.

One RFC 4256 keyboard-interactive prompt.

Fields
string textText presented to the user
bool echoWhether the user's response may be echoed while entered

One bounded RFC 4256 challenge round from the server.

A zero-length prompts array is valid: providers still receive the round so they can surface instruction, then return an empty answer array.

Fields
string nameServer-supplied challenge name
string instructionServer-supplied instructions
SshKeyboardInteractivePrompt[] promptsPrompts in wire order

Outcome of polling a keyboard-interactive provider.

PENDINGAnswers are not available yet; poll again later
ANSWEREDAnswers are available and correspond one-for-one with the prompts
REFUSEDThe provider refuses or cancels this challenge

Result of polling an SshKeyboardInteractiveProvider.

Fields
SshKeyboardInteractiveStatus statusPoll outcome
string[] answersResponses in prompt order (valid when status == ANSWERED)

Application-owned keyboard-interactive challenge provider.

Implementations own all UI decisions and must not block. The SSH library never logs answers and discards provider results immediately after serializing one response. Providers should likewise avoid retaining answers after returning them.

Methods
SshKeyboardInteractiveResult respond( SshKeyboardInteractiveChallenge challenge)Polls for answers to one challenge round.

SSH user authentication methods, used for server capability discovery.

DISCOVERYCredential-free RFC 4252 `none` method discovery
PUBLICKEYPublic-key authentication
PASSWORDPassword authentication
KEYBOARD_INTERACTIVEKeyboard-interactive authentication
HOSTBASEDHost-based authentication

A user authentication operation driven by session pumping.

The handle is stable for the lifetime of the attempt: resuming or retrying the same operation never duplicates protocol requests. A partialSuccess result means the server accepted one factor and requires another; start the next method with a new authenticate call.

Methods
SshProgress progress() @property const;Returns: current progress of the attempt; WAIT means the session reported a decision or signer wait.
bool done() @property const;Returns: whether the attempt reached a terminal state.
bool succeeded() @property const;Returns: whether authentication succeeded overall; when false and done, consult error or continue after partialSuccess.
SshError error() @property const;Returns: the failure details of this attempt.
bool partialSuccess() @property const;Returns: whether the server accepted this factor and wants another.
SshAuthMethod[] availableMethods() @property const;Returns: authentication methods the server advertised, discovered during this attempt.
string banner() @property const;Returns: the bounded authentication banner, when the server sent one.
bool passwordChangeRequired() @property const;Returns: whether the server rejected this attempt because the account requires a password change. Password changes are not supported, so such attempts fail; this flag distinguishes the outcome from...
void cancel()Cancels the attempt. Subsequent progress reports a SshError.CANCELLED-typed error.

Channel types offered by this API.

SESSIONSession channel carrying exec, shell, or subsystem requests
DIRECT_TCPIPDirect TCP/IP forwarding channel opened towards the server
FORWARDED_TCPIPForwarded TCP/IP channel opened by the server (remote forwarding)

Flow-control parameters of a channel as requested by the client.

Fields
uint initialWindowInitial receive window the client grants the peer
uint maximumPacketSizeMaximum packet size the peer may send in one channel message

An in-flight channel-open operation driven by session pumping.

Methods
SshProgress progress() @property const;Returns: current progress of the open attempt.
bool done() @property const;Returns: whether the open attempt reached a terminal state.
SshError error() @property const;Returns: the failure details when the open failed.
SshChannel channel() @propertyReturns: The confirmed channel, or null while the operation is pending or has failed.
void cancel()Cancels the attempt; if the channel was already confirmed, it is closed instead.

Channel request types carryable by SshChannel.request.

EXECExecute a command (command applies)
SHELLStart an interactive shell
SUBSYSTEMStart a subsystem (subsystem applies)
PTYAllocate a pseudo-terminal (terminal and sizes apply)
ENVSet an environment variable (envName and envValue apply)
SIGNALDeliver a signal (signalName applies)
WINDOW_CHANGEResize the terminal (sizes apply)
enumSshTerminalOpcode : ubyte

Terminal-mode opcodes for pseudo-terminal allocation (RFC 4254 section 8).

Each opcode takes one uint32 argument; boolean modes use 0/1. The encoded mode stream ends with TTY_OP_END, which the implementation appends automatically.

TTY_OP_END = 0Stream terminator (no argument)
VINTR = 1Interrupt character
VQUIT = 2Quit character
VERASE = 3Erase character
VKILL = 4Kill-line character
VEOF = 5End-of-file character
VEOL = 6Additional end-of-line character
VEOL2 = 7Second additional end-of-line character
VSTART = 8Continue-output character
VSTOP = 9Stop-output character
VSUSP = 10Suspend character
VDSUSP = 11Delayed suspend character
VREPRINT = 12Reprint-line character
VWERASE = 13Erase-word character
VLNEXT = 14Literal-next character
VFLUSH = 15Flush-output character
VSWTCH = 16Switch character
VSTATUS = 17Status character
VDISCARD = 18Discard-output character
IGNPAR = 30Ignore parity flag
PARMRK = 31Mark parity and framing errors
INPCK = 32Enable input parity checking
ISTRIP = 33Strip the eighth input bit
INLCR = 34Map NL to CR on input
IGNCR = 35Ignore CR on input
ICRNL = 36Map CR to NL on input
IUCLC = 37Translate upper-case input to lower case
IXON = 38Enable start/stop output control
IXANY = 39Any character restarts output
IXOFF = 40Enable start/stop input control
IMAXBEL = 41Ring bell on full input queue
IUTF8 = 42Input is UTF-8
ISIG = 50Enable signal-generating characters
ICANON = 51Canonical input with erase and kill
XCASE = 52Canonical upper/lower presentation
ECHO = 53Enable echo
ECHOE = 54Visually erase characters
ECHOK = 55Kill character discards the current line
ECHONL = 56Echo NL even if echo is disabled
NOFLSH = 57Disable flushing after interrupt and quit
TOSTOP = 58Stop background jobs writing to the terminal
IEXTEN = 59Enable implementation-defined input processing
ECHOCTL = 60Echo control characters
ECHOKE = 61Visual erase for line kill
PENDIN = 62Retype pending input
OPOST = 70Enable implementation-defined output processing
OLCUC = 71Translate lower-case output to upper case
ONLCR = 72Map NL to CR-NL on output
OCRNL = 73Map CR to NL on output
ONOCR = 74No CR output at column zero
ONLRET = 75NL performs the CR function
CS7 = 90Seven-bit character size
CS8 = 91Eight-bit character size
PARENB = 92Enable parity generation and checking
PARODD = 93Odd parity instead of even
TTY_OP_ISPEED = 128Input baud rate
TTY_OP_OSPEED = 129Output baud rate

One terminal-mode pair of a pseudo-terminal request (RFC 4254 section 8).

Fields
ubyte opcodeMode opcode; must be in the defined range 1 to 159
uint valueMode argument; boolean modes use 0 or 1

A request on a session channel.

Field applicability follows SshChannelRequestType; unused fields are ignored. Requests are issued in order; a reply-bearing request is not overtaken by later requests on the same channel because SSH ties replies to channels, not requests.

Fields
SshChannelRequestType typeThe kind of request
bool wantReplyWhether to ask the peer for an explicit reply
string commandCommand string (EXEC)
string subsystemSubsystem name (SUBSYSTEM)
string terminalTerminal type name (PTY)
string envNameEnvironment variable name (ENV)
string envValueEnvironment variable value (ENV)
string signalNameSignal name without the SIG prefix, for example TERM (SIGNAL)
uint terminalWidthTerminal width in columns (PTY, WINDOW_CHANGE)
uint terminalHeightTerminal height in rows (PTY, WINDOW_CHANGE)
uint pixelWidthTerminal width in pixels (PTY, WINDOW_CHANGE)
uint pixelHeightTerminal height in pixels (PTY, WINDOW_CHANGE)
SshTerminalMode[] terminalModesTerminal modes (PTY), encoded as opcode/argument pairs per RFC 4254 section 8; the implementation appends the terminating TTY_OP_END. An empty list sends no modes.

An in-flight channel request driven by session pumping.

Methods
SshProgress progress() @property const;Returns: current progress of the request.
bool done() @property const;Returns: whether the request reached a terminal state.
SshError error() @property const;Returns: the failure details when the request failed or was rejected.
bool accepted() @property const;Returns: Whether the peer accepted the request; meaningful once done and only when a reply was requested.
void cancel()Cancels the attempt; delivery that already happened is not undone.

Exit information of a session channel, when the peer reported it.

Fields
bool presentWhether any exit information was received
int statusExit status (valid when present and isSignal is false)
string signalNameSignal name without the SIG prefix (exit-signal variant)
bool coreDumpedWhether the command died from a signal
Methods
bool isSignal() const pure nothrow @safe @nogcReturns: true when the exit information describes a signal.
interfaceSshChannel

An opened SSH channel.

Data conventions follow SshResult: reads return standard or extended data separately, idle reads report NEED_READ or WAIT, end-of-stream is DONE with the eof flag set, and a zero-length buffer is an immediate no-op. Bytes accepted by write must never be resubmitted.

Flow control: the SSH implementation owns protocol window accounting and grants receive credit as the application consumes buffered data. Consumers observe backpressure through canWrite and pendingWriteBytes; they never manage window adjustments themselves.

Ownership: the channel belongs to its session; closing the session closes all channels.

Methods
SshChannelType type() @property const;Returns: the channel type.
SshResult read(ubyte[] buffer)Reads standard data (stdout) into the buffer.
SshResult readExtended(ubyte[] buffer)Reads extended data (stderr) into the buffer. Extended data shares the channel receive window with standard data; draining or discarding it is required to keep receiving (see discardExtendedData).
SshResult write(const(ubyte)[] data)Writes data to the channel. May accept fewer bytes than requested (partial write); the accepted prefix is transmitted by the session and must not be resubmitted by the caller.
bool canRead() @property const;Returns: whether a read would immediately deliver data or EOF.
bool hasExtendedData() @property const;Returns: whether extended data is buffered and waiting.
bool canWrite() @property const;Returns: whether write would immediately accept at least one byte (send window and queue headroom available).
size_t pendingWriteBytes() @property const;Returns: the number of bytes accepted by write but not yet confirmed flushed to the session transport.
ulong sendWindowRemaining() @property const;Returns: the remaining send window in bytes (diagnostic; backpressure is observed through canWrite).
uint peerMaximumPacketSize() @property const;Returns: the maximum channel packet size the peer declared.
SshChannelRequestOperation request(scope const SshChannelRequest request)Issues a request on this channel.
void sendEof()Signals end-of-file for our direction (half-close). Buffered peer data remains readable; only our writing direction ends.
bool eofSent() @property const;Returns: whether we already sent EOF for our direction.
bool peerEof() @property const;Returns: whether the peer signalled EOF for its direction.
void close()Closes the channel. The close handshake completes through session pumping; closed reflects completion. Pending operations complete with cancellation errors or their outcomes.
bool closed() @property const;Returns: whether the channel finished its close handshake.
SshError channelError() @property const;Returns: the channel-fatal error, when this channel failed independently of the session.
SshExitStatus exitStatus() @property const;Returns: exit information when the peer reported it for this session channel.
void discardExtendedData(bool discard)Selects the extended-data policy.