Skip to content

feat: implement ping@openssh.com#134

Merged
kruton merged 1 commit into
mainfrom
ping
May 5, 2026
Merged

feat: implement ping@openssh.com#134
kruton merged 1 commit into
mainfrom
ping

Conversation

@kruton
Copy link
Copy Markdown
Member

@kruton kruton commented May 4, 2026

Adds support for OpenSSH ping/pong support in the protocol handler. Also adds a ping() method that sends SSH_MSG_PING and awaits SSH_MSG_PONG, queuing pings during active rekey and flushing them in rekeyComplete(). This can be used for measuring latency to the server.

Copilot AI review requested due to automatic review settings May 4, 2026 22:25
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds OpenSSH ping@openssh.com transport-level ping/pong support to sshlib, exposing a new SshClient.ping() API and wiring the underlying protocol handling into the SSH connection state machine.

Changes:

  • Added SSH ping/pong protocol message definitions, enum values, and a public PingResult API.
  • Implemented client-side EXT_INFO advertisement, ping/pong handling, and rekey-time ping queuing in SshConnection.
  • Added unit, fake-server, and real OpenSSH integration tests for ping/pong behavior.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
sshlib/src/test/kotlin/org/connectbot/sshlib/PingPongMessageTest.kt Adds round-trip serialization tests for ping/pong message bodies.
sshlib/src/test/kotlin/org/connectbot/sshlib/client/SshClientIntegrationTest.kt Adds real-server integration coverage for SshClient.ping().
sshlib/src/test/kotlin/org/connectbot/sshlib/client/PingConnectionTest.kt Adds connection-level tests for ping support, pong replies, and rekey behavior.
sshlib/src/test/kotlin/org/connectbot/sshlib/client/FakeSshServer.kt Extends the fake SSH server with EXT_INFO, ping/pong, and rekey test support.
sshlib/src/main/kotlin/org/connectbot/sshlib/SshClient.kt Adds the public suspend ping() API on SshClient.
sshlib/src/main/kotlin/org/connectbot/sshlib/protocol/SshClientStateMachine.kt Sends client EXT_INFO after initial NEWKEYS in the state machine flow.
sshlib/src/main/kotlin/org/connectbot/sshlib/PingResult.kt Introduces the sealed result type returned by SshClient.ping().
sshlib/src/main/kotlin/org/connectbot/sshlib/client/SshConnection.kt Implements ping capability negotiation, ping/pong handling, and queued sends during rekey.
sshlib/api.txt Updates the public API snapshot for PingResult and SshClient.ping().
protocol/src/main/resources/kaitai/ssh_msg_pong.ksy Defines the Kaitai schema for SSH pong payloads.
protocol/src/main/resources/kaitai/ssh_msg_ping.ksy Defines the Kaitai schema for SSH ping payloads.
protocol/src/main/resources/kaitai/ssh_enums.ksy Adds enum values for SSH_MSG_PING and SSH_MSG_PONG.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread sshlib/src/main/kotlin/org/connectbot/sshlib/client/SshConnection.kt Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 6 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread sshlib/src/main/kotlin/org/connectbot/sshlib/client/SshConnection.kt Outdated
Comment thread sshlib/src/main/kotlin/org/connectbot/sshlib/client/SshConnection.kt Outdated
Comment thread sshlib/src/main/kotlin/org/connectbot/sshlib/client/SshConnection.kt Outdated
Comment thread sshlib/src/main/kotlin/org/connectbot/sshlib/client/SshConnection.kt Outdated
Comment thread sshlib/src/main/kotlin/org/connectbot/sshlib/SshClient.kt
Comment thread sshlib/src/main/kotlin/org/connectbot/sshlib/client/SshConnection.kt Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 7 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread sshlib/src/main/kotlin/org/connectbot/sshlib/client/SshConnection.kt Outdated
Comment thread sshlib/src/main/kotlin/org/connectbot/sshlib/SshClient.kt
Comment thread sshlib/src/main/kotlin/org/connectbot/sshlib/SshClient.kt
Comment thread sshlib/src/main/kotlin/org/connectbot/sshlib/SshClient.kt Outdated
Comment thread sshlib/src/test/kotlin/org/connectbot/sshlib/client/ExtInfoNegotiationTest.kt Outdated
Comment thread sshlib/src/main/kotlin/org/connectbot/sshlib/PingResult.kt Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread sshlib/src/main/kotlin/org/connectbot/sshlib/client/SshConnection.kt Outdated
Comment thread sshlib/src/main/kotlin/org/connectbot/sshlib/client/SshConnection.kt Outdated
Comment thread sshlib/src/test/kotlin/org/connectbot/sshlib/client/FakeSshServer.kt Outdated
Comment thread sshlib/src/main/kotlin/org/connectbot/sshlib/client/SshConnection.kt Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread sshlib/src/test/kotlin/org/connectbot/sshlib/client/FakeSshServer.kt Outdated
Adds support for OpenSSH ping/pong support in the protocol handler. Also
adds a ping() method that sends SSH_MSG_PING and awaits SSH_MSG_PONG,
queuing pings during active rekey and flushing them in rekeyComplete().
This can be used for measuring latency to the server.
@kruton kruton enabled auto-merge (rebase) May 5, 2026 07:19
@kruton kruton merged commit d5177ec into main May 5, 2026
10 checks passed
@kruton kruton deleted the ping branch May 5, 2026 07:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants