0
0
mirror of https://github.com/bpg/terraform-provider-proxmox.git synced 2025-06-30 10:33:46 +00:00
terraform-provider-proxmox/proxmox/ssh/client_windows.go
Brian ccf4834c16
feat(provider): add support for ssh-agent on Windows (#1270)
* feat(provider): add support for `ssh-agent` on Windows

Signed-off-by: Brian Karshick <Sparta142@users.noreply.github.com>
2024-05-09 23:00:44 -04:00

25 lines
456 B
Go

//go:build windows
package ssh
import (
"fmt"
"net"
"github.com/Microsoft/go-winio"
)
// dialSocket dials a Windows named pipe. If address is empty, it dials the default ssh-agent pipe.
func dialSocket(address string) (net.Conn, error) {
if address == "" {
address = `\\.\pipe\openssh-ssh-agent`
}
conn, err := winio.DialPipe(address, nil)
if err != nil {
return nil, fmt.Errorf("error dialing named pipe: %w", err)
}
return conn, nil
}