mirror of
https://github.com/tim-beatham/smegmesh.git
synced 2025-03-06 09:31:13 +01:00
BUGIX Hash client by public key
This commit is contained in:
parent
0ff2a8eef9
commit
78d748770c
@ -99,6 +99,7 @@ func (m *WgMeshConfigApplyer) convertMeshNode(node MeshNode, device *wgtypes.Dev
|
|||||||
Endpoint: endpoint,
|
Endpoint: endpoint,
|
||||||
AllowedIPs: allowedips,
|
AllowedIPs: allowedips,
|
||||||
PersistentKeepaliveInterval: &keepAlive,
|
PersistentKeepaliveInterval: &keepAlive,
|
||||||
|
ReplaceAllowedIPs: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
return &peerConfig, nil
|
return &peerConfig, nil
|
||||||
@ -188,8 +189,10 @@ func (m *WgMeshConfigApplyer) updateWgConf(mesh MeshProvider) error {
|
|||||||
|
|
||||||
if n.GetType() == conf.CLIENT_ROLE && len(peers) > 0 && self.GetType() == conf.CLIENT_ROLE {
|
if n.GetType() == conf.CLIENT_ROLE && len(peers) > 0 && self.GetType() == conf.CLIENT_ROLE {
|
||||||
hashFunc := func(mn MeshNode) int {
|
hashFunc := func(mn MeshNode) int {
|
||||||
return lib.HashString(mn.GetWgHost().String())
|
pubKey, _ := mn.GetPublicKey()
|
||||||
|
return lib.HashString(pubKey.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
peer := lib.ConsistentHash(peers, n, hashFunc, hashFunc)
|
peer := lib.ConsistentHash(peers, n, hashFunc, hashFunc)
|
||||||
|
|
||||||
clients, ok := peerToClients[peer.GetWgHost().String()]
|
clients, ok := peerToClients[peer.GetWgHost().String()]
|
||||||
|
Loading…
Reference in New Issue
Block a user