1
0
forked from extern/smegmesh
This commit is contained in:
Tim Beatham 2024-01-16 16:59:07 +00:00
parent 7e6f2563c7
commit 3f82ef9cd7

View File

@ -36,7 +36,7 @@ type routeNode struct {
type convertMeshNodeParams struct { type convertMeshNodeParams struct {
node MeshNode node MeshNode
self MeshNode correspondingPeer MeshNode
mesh MeshProvider mesh MeshProvider
device *wgtypes.Device device *wgtypes.Device
peerToClients map[string][]net.IPNet peerToClients map[string][]net.IPNet
@ -71,7 +71,7 @@ func (m *WgMeshConfigApplyer) convertMeshNode(params convertMeshNodeParams) (*wg
} }
// Else there is more than one candidate so consistently hash // 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() { if pickedRoute.gateway == pubKey.String() {
@ -347,7 +347,7 @@ func (m *WgMeshConfigApplyer) getPeerConfig(params *GetConfigParams) (*wgtypes.C
cfg, err := m.convertMeshNode(convertMeshNodeParams{ cfg, err := m.convertMeshNode(convertMeshNodeParams{
node: n, node: n,
self: self, correspondingPeer: peer,
mesh: params.mesh, mesh: params.mesh,
device: params.dev, device: params.dev,
peerToClients: peerToClients, peerToClients: peerToClients,
@ -373,7 +373,7 @@ func (m *WgMeshConfigApplyer) getPeerConfig(params *GetConfigParams) (*wgtypes.C
peer, err := m.convertMeshNode(convertMeshNodeParams{ peer, err := m.convertMeshNode(convertMeshNodeParams{
node: n, node: n,
self: self, correspondingPeer: self,
mesh: params.mesh, mesh: params.mesh,
peerToClients: peerToClients, peerToClients: peerToClients,
routes: params.routes, routes: params.routes,