1
0
forked from extern/smegmesh

41-bugfix-fluctuating-ips

If the node is a peer then add the client in the WG
configuration.
This commit is contained in:
Tim Beatham 2023-12-04 17:40:24 +00:00
parent c40f7510b8
commit 245a2c5f58

View File

@ -197,7 +197,17 @@ func (m *WgMeshConfigApplyer) updateWgConf(mesh MeshProvider) error {
continue
}
if len(peers) > 0 && self.GetType() == conf.CLIENT_ROLE {
if self.GetType() == conf.PEER_ROLE {
client, err := m.convertMeshNode(n, dev, peerToClients, routes)
if err != nil {
return err
}
peerConfigs[count] = *client
count++
} else if len(peers) > 0 && self.GetType() == conf.CLIENT_ROLE {
hashFunc := func(mn MeshNode) int {
pubKey, _ := mn.GetPublicKey()
return lib.HashString(pubKey.String())
@ -219,6 +229,10 @@ func (m *WgMeshConfigApplyer) updateWgConf(mesh MeshProvider) error {
}
for _, n := range peers {
if NodeEquals(n, self) {
continue
}
peer, err := m.convertMeshNode(n, dev, peerToClients, routes)
if err != nil {