From c0fe1abf4ddbd5b7ccda5dc42d02cb0bcf0f6a26 Mon Sep 17 00:00:00 2001 From: Juan Font Alonso Date: Tue, 16 Aug 2022 17:51:43 +0200 Subject: [PATCH] Use node_key to find peers --- machine.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/machine.go b/machine.go index 1773e8f..89f0c7e 100644 --- a/machine.go +++ b/machine.go @@ -244,8 +244,8 @@ func (h *Headscale) ListPeers(machine *Machine) (Machines, error) { Msg("Finding direct peers") machines := Machines{} - if err := h.db.Preload("AuthKey").Preload("AuthKey.Namespace").Preload("Namespace").Where("machine_key <> ?", - machine.MachineKey).Find(&machines).Error; err != nil { + if err := h.db.Preload("AuthKey").Preload("AuthKey.Namespace").Preload("Namespace").Where("node_key <> ?", + machine.NodeKey).Find(&machines).Error; err != nil { log.Error().Err(err).Msg("Error accessing db") return Machines{}, err