From 3f82ef9cd79340822003cb30de94d6d7724ddd84 Mon Sep 17 00:00:00 2001 From: Tim Beatham Date: Tue, 16 Jan 2024 16:59:07 +0000 Subject: [PATCH] Bugfix --- pkg/mesh/config.go | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/pkg/mesh/config.go b/pkg/mesh/config.go index c9fc703..041b60c 100644 --- a/pkg/mesh/config.go +++ b/pkg/mesh/config.go @@ -35,12 +35,12 @@ type routeNode struct { } type convertMeshNodeParams struct { - node MeshNode - self MeshNode - mesh MeshProvider - device *wgtypes.Device - peerToClients map[string][]net.IPNet - routes map[string][]routeNode + node MeshNode + correspondingPeer MeshNode + mesh MeshProvider + device *wgtypes.Device + peerToClients map[string][]net.IPNet + routes map[string][]routeNode } func (m *WgMeshConfigApplyer) convertMeshNode(params convertMeshNodeParams) (*wgtypes.PeerConfig, error) { @@ -71,7 +71,7 @@ func (m *WgMeshConfigApplyer) convertMeshNode(params convertMeshNodeParams) (*wg } // Else there is more than one candidate so consistently hash - pickedRoute = lib.ConsistentHash(bestRoutes, params.self, bucketFunc, m.hashFunc) + pickedRoute = lib.ConsistentHash(bestRoutes, params.correspondingPeer, bucketFunc, m.hashFunc) } if pickedRoute.gateway == pubKey.String() { @@ -346,12 +346,12 @@ func (m *WgMeshConfigApplyer) getPeerConfig(params *GetConfigParams) (*wgtypes.C peerToClients[pubKey.String()] = append(clients, *n.GetWgHost()) cfg, err := m.convertMeshNode(convertMeshNodeParams{ - node: n, - self: self, - mesh: params.mesh, - device: params.dev, - peerToClients: peerToClients, - routes: params.routes, + node: n, + correspondingPeer: peer, + mesh: params.mesh, + device: params.dev, + peerToClients: peerToClients, + routes: params.routes, }) if err != nil { @@ -372,12 +372,12 @@ func (m *WgMeshConfigApplyer) getPeerConfig(params *GetConfigParams) (*wgtypes.C } peer, err := m.convertMeshNode(convertMeshNodeParams{ - node: n, - self: self, - mesh: params.mesh, - peerToClients: peerToClients, - routes: params.routes, - device: params.dev, + node: n, + correspondingPeer: self, + mesh: params.mesh, + peerToClients: peerToClients, + routes: params.routes, + device: params.dev, }) if err != nil {