Repository navigation
feat(ssh): add SSHConfigOptions to set sshconfig options - #375
Merged
Merged
Conversation
Move OptionArguments from protocol/openssh to sshconfig so both the pure-Go SSH and OpenSSH protocol implementations share the same type. Add ApplyTo(*Setter) to feed options into the sshconfig setter with bool→yes/no conversion. Add SSHConfigOptions sshconfig.OptionArguments to ssh.Config. Options are applied before ConfigParser.Apply so they take priority over ~/.ssh/config. Unknown key names are rejected at connection creation time. The openssh Options field retains a deprecated type alias for backwards compatibility. Signed-off-by: Kimmo Lehto <klehto@mirantis.com>
Signed-off-by: Kimmo Lehto <klehto@mirantis.com>
There was a problem hiding this comment.
Pull request overview
This PR centralizes SSH -o/ssh_config option handling by moving the shared OptionArguments type into the sshconfig package, so both the OpenSSH-based and pure-Go SSH protocol implementations use the same representation and conversion logic.
Changes:
- Added
sshconfig.OptionArgumentswith helpers for copy/set and conversions to OpenSSH-o Key=Valueargs. - Added
OptionArguments.ApplyTo(*sshconfig.Setter)to apply options directly to ansshconfig.Configfor the pure-Go SSH path. - Updated OpenSSH and pure-Go SSH protocol configs/connections to use
sshconfig.OptionArgumentsand added tests for the new type.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
sshconfig/option_arguments.go |
Introduces shared OptionArguments type plus ToArgs and ApplyTo helpers. |
sshconfig/option_arguments_test.go |
Adds unit tests covering copy/set semantics, arg rendering, and applying to a setter. |
protocol/ssh/connection.go |
Applies SSHConfigOptions to sshconfig.Config via a setter before parsing user ssh config. |
protocol/ssh/config.go |
Adds SSHConfigOptions field to pure-Go SSH config. |
protocol/openssh/connection.go |
Switches default and connection option maps to sshconfig.OptionArguments. |
protocol/openssh/config.go |
Replaces OpenSSH-specific OptionArguments with sshconfig.OptionArguments and removes duplicated implementation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Kimmo Lehto <klehto@mirantis.com>
Signed-off-by: Kimmo Lehto <klehto@mirantis.com>
Signed-off-by: Kimmo Lehto <klehto@mirantis.com>
Signed-off-by: Kimmo Lehto <klehto@mirantis.com>
Signed-off-by: Kimmo Lehto <klehto@mirantis.com>
Signed-off-by: Kimmo Lehto <klehto@mirantis.com>
Signed-off-by: Kimmo Lehto <klehto@mirantis.com>
Signed-off-by: Kimmo Lehto <klehto@mirantis.com>
Signed-off-by: Kimmo Lehto <klehto@mirantis.com>
Signed-off-by: Kimmo Lehto <klehto@mirantis.com>
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.
Allows setting the more "exotic" ssh options through the rig config like
ServerAliveIntervalviassh.options.ServerAliveIntervalinstead of modifying the ~/.ssh/config.Moves OptionArguments from protocol/openssh to sshconfig so both the pure-Go SSH and OpenSSH protocol implementations share the same type. Add ApplyTo(*Setter) to feed options into the sshconfig setter with bool→yes/no conversion.
Breaking API is not an issue as rig v2 is not released yet.