forked from extern/smegmesh
Bugfix
This commit is contained in:
parent
7e6f2563c7
commit
3f82ef9cd7
@ -35,12 +35,12 @@ 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
|
||||||
routes map[string][]routeNode
|
routes map[string][]routeNode
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *WgMeshConfigApplyer) convertMeshNode(params convertMeshNodeParams) (*wgtypes.PeerConfig, error) {
|
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
|
// 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() {
|
||||||
@ -346,12 +346,12 @@ func (m *WgMeshConfigApplyer) getPeerConfig(params *GetConfigParams) (*wgtypes.C
|
|||||||
peerToClients[pubKey.String()] = append(clients, *n.GetWgHost())
|
peerToClients[pubKey.String()] = append(clients, *n.GetWgHost())
|
||||||
|
|
||||||
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,
|
||||||
routes: params.routes,
|
routes: params.routes,
|
||||||
})
|
})
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -372,12 +372,12 @@ 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,
|
||||||
device: params.dev,
|
device: params.dev,
|
||||||
})
|
})
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user