mirror of
https://github.com/tim-beatham/smegmesh.git
synced 2024-12-04 21:50:49 +01:00
81-processes
- issue with client client traversal
This commit is contained in:
parent
4a92743880
commit
69b1790bb6
@ -1,6 +1,7 @@
|
|||||||
package mesh
|
package mesh
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
"slices"
|
"slices"
|
||||||
"strings"
|
"strings"
|
||||||
@ -233,8 +234,8 @@ func (m *WgMeshConfigApplyer) getClientConfig(params *GetConfigParams) (*wgtypes
|
|||||||
|
|
||||||
routesForMesh := lib.Map(lib.MapValues(params.routes), func(rns []routeNode) []routeNode {
|
routesForMesh := lib.Map(lib.MapValues(params.routes), func(rns []routeNode) []routeNode {
|
||||||
return lib.Filter(rns, func(rn routeNode) bool {
|
return lib.Filter(rns, func(rn routeNode) bool {
|
||||||
ip, _, _ := net.ParseCIDR(rn.gateway)
|
_, ipNet, _ := net.ParseCIDR(rn.gateway)
|
||||||
return meshNet.Contains(ip)
|
return meshNet.Contains(ipNet.IP) || ipNet.Contains(meshNet.IP)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -253,6 +254,10 @@ func (m *WgMeshConfigApplyer) getClientConfig(params *GetConfigParams) (*wgtypes
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(params.peers) == 0 {
|
||||||
|
return nil, fmt.Errorf("no peers in the mesh")
|
||||||
|
}
|
||||||
|
|
||||||
peer := m.getCorrespondingPeer(params.peers, self)
|
peer := m.getCorrespondingPeer(params.peers, self)
|
||||||
pubKey, _ := peer.GetPublicKey()
|
pubKey, _ := peer.GetPublicKey()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user