ddn.net.ssh.session
SSH client session implementation.
Drives the SSH protocol over a caller-supplied transport: the identification exchange first, then the packet layer and key exchange phases. The session implements the public ddn.api.net.ssh.SshSession contract; pumping is explicit and every potentially-blocking step reports progress instead of blocking.
The session is single-threaded and non-reentrant, owns all protocol state for the connection, and references - but does not own - the transport.
Types 5
Session limits and defaults from the support matrix.
Configurable rekey thresholds (RFC 4253 section 9).
The defaults mirror SshRekeyLimits; every threshold applies to the bytes and packets moved under one installed direction-key set and resets at each NEWKEYS boundary. timeoutSeconds bounds a single rekey exchange against a stalled peer.
ulong bytesRekey after this many bytes sent or received under one key setulong packetsRekey after this many packets sent or received in one directionlong intervalSecondsRekey after this much time since the keys were installedlong timeoutSecondsFail the session when a rekey exchange takes longer than thisGlobal-request-operation implementation driven by session pumping.
Replies arrive in request order without identifiers; the session keeps the FIFO that pairs them.
void completeGlobalReply(bool accepted, ushort allocatedPort)Completes the operation from the peer's reply.void cancel()this(Kind kind, string bindAddress, ushort requestedPort)Constructs a global request operation.KindGlobal request flavour for reply bookkeeping.SshSessionImpl create(SshTransport transport,
SshAlgorithmPreferences preferences = SshAlgorithmPreferences
.recommended()) staticCreates a session over a transport.SshTransport transport() @propertyvoid setAlgorithmPreferences(scope const SshAlgorithmPreferences prefs)Sets algorithm preferences before the handshake starts.void setKeepAlive(Duration interval)Configures keepalive requests; the transport phase acts on them.void setRekeyLimits(SshRekeyConfig config)Configures automatic rekey thresholds; non-positive members revert that threshold to the default.SshProgress pump()Advances all session state machines by one step.void requestRekey()Requests a key re-exchange at the next legal opportunity.void setHostKeyVerifier(SshHostKeyVerifier verifier)Installs the host-key verifier consulted during key exchange.SshAuthOperation authenticatePublicKey(SshSigner signer)Starts (or resumes) public-key authentication with an application-owned signer. While an attempt is pending the same operation is returned; protocol requests are never duplicated.SshAuthOperation authenticatePassword(SshPasswordProvider provider)Starts (or resumes) password authentication with an application-owned credential provider. While an attempt is pending the same operation is returned; protocol requests are never duplicated.SshAuthOperation authenticateKeyboardInteractive(
SshKeyboardInteractiveProvider provider)Starts (or resumes) keyboard-interactive authentication with a non-blocking, application-owned challenge provider.inout(ubyte[32]) sessionId() inout @safe pure nothrowReturns: the session identifier bytes for signed requests.void queueAuthPacket(const(ubyte)[] payload) @trustedQueues an authentication packet; a null payload is a no-op used when the request awaits an asynchronous credential.SshChannelOpenOperation openSessionChannel(
scope const SshChannelOpenOptions options = SshChannelOpenOptions
.init)Opens a 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)SshRemoteForwardOperation requestRemoteForward(string bindAddress,
ushort bindPort)SshGlobalRequestOperation cancelRemoteForward(string bindAddress,
ushort bindPort)void disconnect(ushort reason, string description)Disconnects: sends nothing until the packet layer exists, then flushes pending writes and closes the transport.void queueChannelPacket(const(ubyte)[] payload) @trustedQueues a channel message through the session packet path.void channelConsumed(SshChannelImpl channel, size_t bytes)Records receive-window consumption by a channel read and sends WINDOW_ADJUST when the threshold is reached.void grantReceiveCredit(SshChannelImpl channel)Sends an accumulated receive-window re-grant when the channel's pending consumption crossed the replenish threshold.void channelProtocolViolation(string message)Reports a channel flow-control violation to the session.bool canQueueChannelBytes(size_t n)Returns: whether a channel packet of n further bytes still fits into the session write-queue budget.void reserveChannelBacklog(size_t bytes)Records bytes accepted into a channel-owned backlog.void releaseChannelBacklog(size_t bytes)Records bytes moved out of a channel-owned backlog.string serverSignatureAlgorithms() const @propertyReturns: the server's advertised server-sig-algs list, or an empty string when the server did not send EXT_INFO.void ensureServiceRequested()Sends the ssh-userauth service request once, when authentication starts.this(SshTransport transport,
SshAlgorithmPreferences preferences = SshAlgorithmPreferences
.recommended())Constructs a session over a transport.LineStatusLineEnd