|
@@ -3,12 +3,17 @@ package nodeacls
|
|
import (
|
|
import (
|
|
"encoding/json"
|
|
"encoding/json"
|
|
"fmt"
|
|
"fmt"
|
|
|
|
+ "sync"
|
|
|
|
|
|
"github.com/gravitl/netmaker/logic/acls"
|
|
"github.com/gravitl/netmaker/logic/acls"
|
|
)
|
|
)
|
|
|
|
|
|
|
|
+var NodesAllowedACLMutex = &sync.Mutex{}
|
|
|
|
+
|
|
// AreNodesAllowed - checks if nodes are allowed to communicate in their network ACL
|
|
// AreNodesAllowed - checks if nodes are allowed to communicate in their network ACL
|
|
func AreNodesAllowed(networkID NetworkID, node1, node2 NodeID) bool {
|
|
func AreNodesAllowed(networkID NetworkID, node1, node2 NodeID) bool {
|
|
|
|
+ NodesAllowedACLMutex.Lock()
|
|
|
|
+ defer NodesAllowedACLMutex.Unlock()
|
|
var currentNetworkACL, err = FetchAllACLs(networkID)
|
|
var currentNetworkACL, err = FetchAllACLs(networkID)
|
|
if err != nil {
|
|
if err != nil {
|
|
return false
|
|
return false
|