mirror of
https://github.com/tim-beatham/smegmesh.git
synced 2025-02-01 18:19:21 +01:00
41-bugfix-fluctuating-ips
If the node is a peer then add the client in the WG configuration.
This commit is contained in:
parent
c40f7510b8
commit
245a2c5f58
@ -197,7 +197,17 @@ func (m *WgMeshConfigApplyer) updateWgConf(mesh MeshProvider) error {
|
|||||||
continue
|
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 {
|
hashFunc := func(mn MeshNode) int {
|
||||||
pubKey, _ := mn.GetPublicKey()
|
pubKey, _ := mn.GetPublicKey()
|
||||||
return lib.HashString(pubKey.String())
|
return lib.HashString(pubKey.String())
|
||||||
@ -219,6 +229,10 @@ func (m *WgMeshConfigApplyer) updateWgConf(mesh MeshProvider) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, n := range peers {
|
for _, n := range peers {
|
||||||
|
if NodeEquals(n, self) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
peer, err := m.convertMeshNode(n, dev, peerToClients, routes)
|
peer, err := m.convertMeshNode(n, dev, peerToClients, routes)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user