mirror of
https://github.com/fankes/beszel.git
synced 2025-10-19 17:59:28 +08:00
feat: add unix socket support for system connections
This commit is contained in:
@@ -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
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user