chore(KtorTcpTransport): add way to get localSocketAddress#136
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a way to expose the local TCP socket address from the default Ktor transport so higher layers can correlate SSH connections with network events. In the sshlib codebase, this extends the default transport/factory path rather than the generic Transport interface.
Changes:
- Added
getLocalAddress()toKtorTcpTransportandKtorTcpTransportFactory. - Introduced internal local-address plumbing from Ktor sockets to Java
InetSocketAddress. - Added unit coverage for transport-level local-address exposure and updated the public API surface file.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
sshlib/src/test/kotlin/org/connectbot/sshlib/transport/KtorTcpTransportTest.kt |
Adds unit test coverage for transport-level local address behavior and updates the mock socket. |
sshlib/src/main/kotlin/org/connectbot/sshlib/transport/TransportFactory.kt |
Stores the last created KtorTcpTransport and exposes its local address via the concrete factory. |
sshlib/src/main/kotlin/org/connectbot/sshlib/transport/TransportDependencies.kt |
Adds internal local-address support to the Ktor socket wrapper and conversion to java.net.InetSocketAddress. |
sshlib/src/main/kotlin/org/connectbot/sshlib/transport/KtorTcpTransport.kt |
Exposes the connected socket’s local address from the transport. |
sshlib/api.txt |
Records the new public methods in the API baseline. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This is needed for connection tracking in ConnectBot. If the local address for the socket is indicated in a network event, ConnectBot will either wait for it to come back or disconnect immediately.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is needed for connection tracking in ConnectBot. If the local address for the socket is indicated in a network event, ConnectBot will either wait for it to come back or disconnect immediately.