feat: add unix socket support for system connections

This commit is contained in:
henrygd
2025-02-19 20:29:45 -05:00
parent c12b27afb5
commit 25b70af196

View File

@@ -421,7 +421,14 @@ func (h *Hub) deleteSystemConnection(record *core.Record) {
} }
func (h *Hub) createSystemConnection(record *core.Record) (*ssh.Client, error) { func (h *Hub) createSystemConnection(record *core.Record) (*ssh.Client, error) {
client, err := ssh.Dial("tcp", net.JoinHostPort(record.GetString("host"), record.GetString("port")), h.sshClientConfig) network := "tcp"
host := record.GetString("host")
if strings.HasPrefix(host, "/") {
network = "unix"
} else {
host = net.JoinHostPort(host, record.GetString("port"))
}
client, err := ssh.Dial(network, host, h.sshClientConfig)
if err != nil { if err != nil {
return nil, err return nil, err
} }