From 25b70af1963850c20974b7a120c701ebc0ed2aaa Mon Sep 17 00:00:00 2001 From: henrygd Date: Wed, 19 Feb 2025 20:29:45 -0500 Subject: [PATCH] feat: add unix socket support for system connections --- beszel/internal/hub/hub.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/beszel/internal/hub/hub.go b/beszel/internal/hub/hub.go index b8d062f..b42f797 100644 --- a/beszel/internal/hub/hub.go +++ b/beszel/internal/hub/hub.go @@ -421,7 +421,14 @@ func (h *Hub) deleteSystemConnection(record *core.Record) { } 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 { return nil, err }