Class: Net::SSH::Transport::Session

Class | Net::SSH::Transport::Session
In: | lib/net/ssh/transport/session.rb
Parent: | Object

Represents a low-level SSH session, at the transport protocol level. This handles the algorithm negotiation and key exchange for any SSH connection.

### Methods

client_name close new peer ping! reader_ready? send_message version wait_for_message

### Included Modules

Constants

### Constants

NAME | = | "Ruby/Net::SSH" |  | The name that Net::SSH reports for itself
PROTOCOL | = | "SSH-2.0" |  | The SSH protocol supported by Net::SSH.
VALID_OPTIONS | = | [ :port, :host_key, :kex, :encryption, :hmac, :compression, :languages, :compression_level, :proxy, :timeout ]

### Attributes

algorithm_negotiator | [W] |
algorithms | [R] | the collection of algorithms currently being used
ciphers | [W] |
compressors | [W] |
decompressors | [W] |
default_port | [W] |
hmacs | [W] |
host | [R] | the hostname that was requested
kexs | [W] |
logger | [W] |
packet_receiver | [W] |
packet_sender | [W] |
port | [R] | the port that was requested
session_id | [R] | the unique session identifier
socket_factory | [W] |
version_negotiator | [W] |

### Public Class methods

new( host, options={} ) {|self| ...}

Create a new connection to the given host. This will negotiate the algorithms to use and exchange the keys. A block must be given. The uninitialized `self` will be passed to the block, so that dependencies may be injected.

version()

Returns the version string of this client.

### Public Instance methods

client_name()

Returns the name of the client‘s host, as reported by the socket.

close()

Closes the connection.

peer()

Returns info about the remote peer

ping!()

Sends an IGNORE packet to the server, as a way to ping the connection and make sure the server knows the client is still active.

reader_ready?()

Returns true if there are bytes to be read on the socket. Note that this only means there is an encrypted packet ready to be read, not that there is data available to any particular SSH channel.

send_message( message )

Sends the given payload, using the currently configured OutgoingPacketStream.

wait_for_message()

Waits for the next message from the server, handling common requests like DISCONNECT, IGNORE, DEBUG, and KEXINIT in the background. The next message is returned as a [ type, buffer ] tuple, where the buffer is a Net::SSH::Util::ReaderBuffer.

[Validate]