Skip to content

Commit

Permalink
refactor rename
Browse files Browse the repository at this point in the history
Signed-off-by: Matej Vasek <[email protected]>
  • Loading branch information
matejvasek committed Oct 22, 2021
1 parent 58c5039 commit 93ad9fe
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions internal/sshdialer/ssh_dialer.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ func NewSSHClientConfig(url *urlPkg.URL, config Config) (*ssh.ClientConfig, erro

// add signer from explicit identity parameter
if config.Identity != "" {
s, err := publicKey(config.Identity, []byte(config.Identity), config.PassPhraseCallback)
s, err := loadSignerFromFile(config.Identity, []byte(config.Identity), config.PassPhraseCallback)
if err != nil {
return nil, fmt.Errorf("failed to parse identity file: %w", err)
}
Expand All @@ -240,7 +240,7 @@ func NewSSHClientConfig(url *urlPkg.URL, config Config) (*ssh.ClientConfig, erro
if len(signers) == 0 {
defaultKeyPaths := getDefaultKeys()
if len(defaultKeyPaths) == 1 {
s, err := publicKey(defaultKeyPaths[0], []byte(config.PassPhrase), config.PassPhraseCallback)
s, err := loadSignerFromFile(defaultKeyPaths[0], []byte(config.PassPhrase), config.PassPhraseCallback)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -346,7 +346,7 @@ func signersToAuthMethods(signers []ssh.Signer) []ssh.AuthMethod {

// reads key from given path
// if necessary it will decrypt it
func publicKey(path string, passphrase []byte, passPhraseCallback SecretCallback) (ssh.Signer, error) {
func loadSignerFromFile(path string, passphrase []byte, passPhraseCallback SecretCallback) (ssh.Signer, error) {
key, err := ioutil.ReadFile(path)
if err != nil {
return nil, fmt.Errorf("failed to read key file: %w", err)
Expand Down

0 comments on commit 93ad9fe

Please sign in to comment.