22 lines
425 B
Go
22 lines
425 B
Go
|
package ssh
|
||
|
|
||
|
import (
|
||
|
"bytes"
|
||
|
"os"
|
||
|
|
||
|
"github.com/Neur0toxine/sshpoke/internal/server/driver/ssh/types"
|
||
|
"github.com/kevinburke/ssh_config"
|
||
|
)
|
||
|
|
||
|
func parseSSHConfig(filePath types.SmartPath) (*ssh_config.Config, error) {
|
||
|
fileName, err := filePath.Resolve(false)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
file, err := os.ReadFile(fileName)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
return ssh_config.Decode(bytes.NewReader(file))
|
||
|
}
|