Repository navigation
feat(ssh): wire BindAddress and interface from sshconfig to net.Dialer - #376
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR wires OpenSSH-style BindAddress / BindInterface from sshconfig into the SSH connection path by setting net.Dialer.LocalAddr during Connection.Connect(), enabling explicit source-address binding for outbound SSH connections.
Changes:
- Added
selectBindAddrhelper to pick the first global-unicast address from an interface that matches the requested dial family (tcp,tcp4,tcp6). - Added
Connection.localAddr()to derivenet.Dialer.LocalAddrfromBindAddress(IP) orBindInterface(interface address), with trace logging and safe fallbacks. - Added unit tests for
selectBindAddrand basiclocalAddrbehavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
protocol/ssh/connection.go |
Introduces local bind address selection and applies it to the net.Dialer used by Connect(). |
protocol/ssh/connection_test.go |
Adds tests covering address selection logic and BindAddress / missing-interface handling. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
kke
force-pushed
the
ssh-config-bind-address
branch
from
June 6, 2026 08:48
e656627 to
4e96a65
Compare
kke
force-pushed
the
ssh-config-bind-address
branch
from
June 6, 2026 09:16
4e96a65 to
76231a9
Compare
…ialer Sets LocalAddr on the net.Dialer in Connect() based on the ssh config BindAddress (parsed as IP) or BindInterface (first global-unicast address from the interface, respecting AddressFamily). Both are no-ops when unset. Signed-off-by: Kimmo Lehto <klehto@mirantis.com>
kke
force-pushed
the
ssh-config-bind-address
branch
from
June 6, 2026 09:41
76231a9 to
c02f5f9
Compare
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.
Sets LocalAddr on the net.Dialer in Connect() based on the ssh config BindAddress (parsed as IP) or BindInterface (first global-unicast address from the interface, respecting AddressFamily). Both are no-ops when unset.