sshpoke/internal/server/driver/ssh/sshtun/config.go

22 lines
402 B
Go

package sshtun
import (
"bytes"
"os"
"github.com/Neur0toxine/sshpoke/pkg/smarttypes"
"github.com/kevinburke/ssh_config"
)
func parseSSHConfig(filePath smarttypes.Path) (*ssh_config.Config, error) {
fileName, err := filePath.File()
if err != nil {
return nil, err
}
file, err := os.ReadFile(fileName)
if err != nil {
return nil, err
}
return ssh_config.Decode(bytes.NewReader(file))
}